mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Added: Create Card Page
This commit is contained in:
parent
0e92447a3e
commit
c425e05e8b
@ -54,6 +54,7 @@
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<Capability Name="privateNetworkClientServer"/>
|
||||
<DeviceCapability Name="pointOfService"/>
|
||||
<uap:Capability Name="sharedUserCertificates"/>
|
||||
<DeviceCapability Name="proximity"/>
|
||||
</Capabilities>
|
||||
</Package>
|
@ -51,6 +51,7 @@ namespace Borepin
|
||||
|
||||
containerRegistry.RegisterForNavigation<UserListPage, UserListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<UserPage, UserPageModel>();
|
||||
containerRegistry.RegisterForNavigation<CreateCardPage, CreateCardPageModel>();
|
||||
containerRegistry.RegisterForNavigation<AddUserPage, AddUserPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ProfilePage, ProfilePageModel>();
|
||||
#endregion
|
||||
|
@ -111,6 +111,9 @@
|
||||
<EmbeddedResource Update="Page\AddUserPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\CreateCardPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\MachinePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
@ -156,6 +159,7 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\external\NFC\NFC\NFC.csproj" />
|
||||
<ProjectReference Include="..\..\FabAccessAPI\FabAccessAPI.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
63
Borepin/Borepin/Model/CardConfig.cs
Normal file
63
Borepin/Borepin/Model/CardConfig.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using NFC.Helper;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Borepin.Model
|
||||
{
|
||||
public class CardConfig
|
||||
{
|
||||
#region Constructors
|
||||
public CardConfig()
|
||||
{
|
||||
PICCKey = ByteOperation.GenerateEmptyArray(16);
|
||||
APPKey = ByteOperation.GenerateEmptyArray(16);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
public string UserID;
|
||||
|
||||
public byte[] PICCKey;
|
||||
public byte[] APPKey;
|
||||
|
||||
public bool DoFormat;
|
||||
|
||||
public byte[] CardToken;
|
||||
public byte[] MetaInfo;
|
||||
public byte[] SpaceInfo;
|
||||
#endregion
|
||||
|
||||
#region Mehtods
|
||||
public string ConvertToString(byte[] array)
|
||||
{
|
||||
string data = HexConverter.ConvertToHexString(array);
|
||||
data = data.ToUpper(CultureInfo.InvariantCulture);
|
||||
|
||||
for(int i = 2; i < data.Length; i += 3)
|
||||
{
|
||||
data = data.Insert(i, " ");
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte[] ConvertFromString(string data)
|
||||
{
|
||||
data = data.Trim();
|
||||
data = data.Replace(" ", "");
|
||||
|
||||
byte[] array = HexConverter.ConvertFromHexString(data);
|
||||
return array;
|
||||
}
|
||||
|
||||
public byte[] GenerateRandomKey()
|
||||
{
|
||||
byte[] key = ByteOperation.GenerateEmptyArray(16);
|
||||
Random random= new Random();
|
||||
|
||||
random.NextBytes(key);
|
||||
return key;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
34
Borepin/Borepin/Model/FabFireCard.cs
Normal file
34
Borepin/Borepin/Model/FabFireCard.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using Borepin.Service.ErrorMessage;
|
||||
using NFC.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace Borepin.Model
|
||||
{
|
||||
public class FabFireCard
|
||||
{
|
||||
#region Private Fields
|
||||
INFCService _NFCService;
|
||||
IErrorMessageService _ErrorMessageService;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public FabFireCard(INFCService nfcService, IErrorMessageService errorMessageService)
|
||||
{
|
||||
_NFCService = nfcService;
|
||||
_ErrorMessageService = errorMessageService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public void FormatCard(string readerID, CardConfig cardConfig)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CreateCard(string readerID, CardConfig cardConfig)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
65
Borepin/Borepin/Page/CreateCardPage.xaml
Normal file
65
Borepin/Borepin/Page/CreateCardPage.xaml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.CreateCardPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
Title="Create Card">
|
||||
<NavigationPage.TitleView>
|
||||
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="NFC Reader" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||
<Picker ItemsSource="{Binding ReaderIDs}" SelectedItem="{Binding ReaderID}"></Picker>
|
||||
|
||||
|
||||
<Label Text="PICC Key" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Entry Grid.Column="0" Text="{Binding PICCKey}" IsSpellCheckEnabled="false"/>
|
||||
<Button Grid.Column="1" Text="Random" Command="{Binding RandomPICCKeyCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Grid.Column="2" Text="Scan QR-Code" Command="{Binding ScanPICCKeyCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</Grid>
|
||||
|
||||
<Label Text="Application Key" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Entry Grid.Column="0" Text="{Binding APPKey}" IsSpellCheckEnabled="false"/>
|
||||
<Button Grid.Column="1" Text="Random" Command="{Binding RandomAPPKeyCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Grid.Column="2" Text="Scan QR-Code" Command="{Binding ScanAPPKeyCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</Grid>
|
||||
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding FormatCard}"/>
|
||||
<Label Text="Format Card" VerticalOptions="Center"/>
|
||||
</StackLayout>
|
||||
|
||||
<Button Text="Create Card" Command="{Binding CreateCardCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
20
Borepin/Borepin/Page/CreateCardPage.xaml.cs
Normal file
20
Borepin/Borepin/Page/CreateCardPage.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.Page
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class CreateCardPage : ContentPage
|
||||
{
|
||||
public CreateCardPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -40,7 +40,11 @@
|
||||
<Entry Placeholder="{x:Static resource_text:TextResource.UserPage_NewPassword}" Text="{Binding NewPassword}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.UserPage_UpdatePassword}" Command="{Binding UpdatePasswordCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
<Button Grid.Row="1" Text="{x:Static resource_text:TextResource.DELETE}" Command="{Binding DeleteCommand}" Style="{StaticResource Style_Button_Admin}" VerticalOptions="End"/>
|
||||
<StackLayout IsVisible="{Binding CanCreateCard}">
|
||||
<Button Text="Create Card" Command="{Binding CreateCardCommand}" IsVisible="{Binding HasCardBinded, Converter={StaticResource InvertBoolConverter}}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="Unbind Card" Command="{Binding CreateCardCommand}" IsVisible="{Binding HasCardBinded}" Style="{StaticResource Style_Button_Admin}"/>
|
||||
</StackLayout>
|
||||
<Button Text="{x:Static resource_text:TextResource.DELETE}" Command="{Binding DeleteCommand}" Style="{StaticResource Style_Button_Admin}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
259
Borepin/Borepin/PageModel/CreateCardPageModel.cs
Normal file
259
Borepin/Borepin/PageModel/CreateCardPageModel.cs
Normal file
@ -0,0 +1,259 @@
|
||||
using Borepin.Base;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using System.Windows.Input;
|
||||
using FabAccessAPI.Schema;
|
||||
using Prism.Services;
|
||||
using Borepin.Service;
|
||||
using System.Threading.Tasks;
|
||||
using Borepin.Base.Exceptions;
|
||||
using NFC.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using Borepin.Model;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class CreateCardPageModel : ConnectionModelBase
|
||||
{
|
||||
#region Private Fields
|
||||
private CardConfig _CardConfig;
|
||||
private User _User;
|
||||
private INFCService _NFCService;
|
||||
#endregion
|
||||
|
||||
#region Contructors
|
||||
public CreateCardPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, INFCService nfcService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
_NFCService = nfcService;
|
||||
_CardConfig= new CardConfig();
|
||||
|
||||
CreateCardCommand = new DelegateCommand(CreateCardCommandExecute);
|
||||
|
||||
ScanPICCKeyCommand = new DelegateCommand(ScanPICCKeyCommandExecute);
|
||||
RandomPICCKeyCommand = new DelegateCommand(RandomPICCKeyCommandExecute);
|
||||
|
||||
ScanAPPKeyCommand = new DelegateCommand(ScanAPPKeyCommandExecute);
|
||||
RandomAPPKeyCommand = new DelegateCommand(RandomAPPKeyCommandExecute);
|
||||
|
||||
RefreshCommand = new DelegateCommand(async () => await RefreshCommandExecute().ConfigureAwait(true));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override Task LoadInstance(object instance)
|
||||
{
|
||||
if (instance is string)
|
||||
{
|
||||
_CardConfig.UserID = instance as string;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InstanceIncorrectException();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task LoadAPIData()
|
||||
{
|
||||
_User = (await _API.Session.UserSystem.Search.GetUserByName(_CardConfig.UserID).ConfigureAwait(false)).Just;
|
||||
|
||||
ReaderIDs = await Task.Run(() =>
|
||||
{
|
||||
return _NFCService.GetReaderIDs();
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
if (ReaderIDs.Count > 0)
|
||||
{
|
||||
ReaderID = ReaderIDs[0];
|
||||
}
|
||||
|
||||
PICCKey = _CardConfig.ConvertToString(_CardConfig.PICCKey);
|
||||
APPKey = _CardConfig.ConvertToString(_CardConfig.APPKey);
|
||||
}
|
||||
|
||||
public override Task<object> CreateInstance()
|
||||
{
|
||||
return Task.FromResult<object>(_CardConfig);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private IList<string> _ReaderIDs;
|
||||
public IList<string> ReaderIDs
|
||||
{
|
||||
get => _ReaderIDs;
|
||||
set => SetProperty(ref _ReaderIDs, value);
|
||||
}
|
||||
|
||||
private string _ReaderID;
|
||||
public string ReaderID
|
||||
{
|
||||
get => _ReaderID;
|
||||
set => SetProperty(ref _ReaderID, value);
|
||||
}
|
||||
|
||||
private string _PICCKey;
|
||||
public string PICCKey
|
||||
{
|
||||
get => _PICCKey;
|
||||
set => SetProperty(ref _PICCKey, value);
|
||||
}
|
||||
|
||||
private string _APPKey;
|
||||
public string APPKey
|
||||
{
|
||||
get => _APPKey;
|
||||
set => SetProperty(ref _APPKey, value);
|
||||
}
|
||||
|
||||
private string _FormatCard;
|
||||
public string FormatCard
|
||||
{
|
||||
get => _FormatCard;
|
||||
set => SetProperty(ref _FormatCard, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private ICommand _RefreshCommand;
|
||||
public ICommand RefreshCommand
|
||||
{
|
||||
get => _RefreshCommand;
|
||||
set => SetProperty(ref _RefreshCommand, value);
|
||||
}
|
||||
public async Task RefreshCommandExecute()
|
||||
{
|
||||
if (_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadAPIData().ConfigureAwait(true);
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _CreateCardCommand;
|
||||
|
||||
public ICommand CreateCardCommand
|
||||
{
|
||||
get => _CreateCardCommand;
|
||||
set => SetProperty(ref _CreateCardCommand, value);
|
||||
}
|
||||
|
||||
public async void CreateCardCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
#region PICCKey
|
||||
private ICommand _ScanPICCKeyCommand;
|
||||
|
||||
public ICommand ScanPICCKeyCommand
|
||||
{
|
||||
get => _ScanPICCKeyCommand;
|
||||
set => SetProperty(ref _ScanPICCKeyCommand, value);
|
||||
}
|
||||
|
||||
public async void ScanPICCKeyCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private ICommand _RandomPICCKeyCommand;
|
||||
|
||||
public ICommand RandomPICCKeyCommand
|
||||
{
|
||||
get => _RandomPICCKeyCommand;
|
||||
set => SetProperty(ref _RandomPICCKeyCommand, value);
|
||||
}
|
||||
|
||||
public void RandomPICCKeyCommandExecute()
|
||||
{
|
||||
_CardConfig.PICCKey = _CardConfig.GenerateRandomKey();
|
||||
PICCKey = _CardConfig.ConvertToString(_CardConfig.PICCKey);
|
||||
}
|
||||
|
||||
private ICommand _ExportPICCKeyCommand;
|
||||
|
||||
public ICommand ExportPICCKeyCommand
|
||||
{
|
||||
get => _ExportPICCKeyCommand;
|
||||
set => SetProperty(ref _ExportPICCKeyCommand, value);
|
||||
}
|
||||
|
||||
public async void ExportPICCKeyCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region APPKey
|
||||
private ICommand _ScanAPPKeyCommand;
|
||||
|
||||
public ICommand ScanAPPKeyCommand
|
||||
{
|
||||
get => _ScanAPPKeyCommand;
|
||||
set => SetProperty(ref _ScanAPPKeyCommand, value);
|
||||
}
|
||||
|
||||
public async void ScanAPPKeyCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private ICommand _RandomAPPKeyCommand;
|
||||
|
||||
public ICommand RandomAPPKeyCommand
|
||||
{
|
||||
get => _RandomAPPKeyCommand;
|
||||
set => SetProperty(ref _RandomAPPKeyCommand, value);
|
||||
}
|
||||
|
||||
public void RandomAPPKeyCommandExecute()
|
||||
{
|
||||
_CardConfig.APPKey = _CardConfig.GenerateRandomKey();
|
||||
APPKey = _CardConfig.ConvertToString(_CardConfig.APPKey);
|
||||
}
|
||||
|
||||
private ICommand _ExportAPPKeyCommand;
|
||||
|
||||
public ICommand ExportAPPKeyCommand
|
||||
{
|
||||
get => _ExportAPPKeyCommand;
|
||||
set => SetProperty(ref _ExportAPPKeyCommand, value);
|
||||
}
|
||||
|
||||
public async void ExportAPPKeyCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -125,13 +125,6 @@ namespace Borepin.PageModel
|
||||
get => _MachineListItemViewModel_List;
|
||||
set => SetProperty(ref _MachineListItemViewModel_List, value);
|
||||
}
|
||||
|
||||
private bool _IsRefreshing;
|
||||
public bool IsRefreshing
|
||||
{
|
||||
get => _IsRefreshing;
|
||||
set => SetProperty(ref _IsRefreshing, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
@ -155,8 +148,6 @@ namespace Borepin.PageModel
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
||||
private ICommand _ScanCodeCommand;
|
||||
|
@ -64,13 +64,6 @@ namespace Borepin.PageModel
|
||||
set => SetProperty(ref _FilteredUserListItemViewModel_List, value);
|
||||
}
|
||||
|
||||
private bool _IsRefreshing;
|
||||
public bool IsRefreshing
|
||||
{
|
||||
get => _IsRefreshing;
|
||||
set => SetProperty(ref _IsRefreshing, value);
|
||||
}
|
||||
|
||||
private string _SearchUsername;
|
||||
public string SearchUsername
|
||||
{
|
||||
@ -99,8 +92,6 @@ namespace Borepin.PageModel
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
||||
private ICommand _AddUserCommand;
|
||||
|
@ -16,6 +16,7 @@ using NaturalSort.Extension;
|
||||
using System.Linq;
|
||||
using Prism.Services.Dialogs;
|
||||
using Xamarin.Forms;
|
||||
using ZXing;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
@ -34,6 +35,8 @@ namespace Borepin.PageModel
|
||||
_DialogService = dialogService;
|
||||
DeleteCommand = new DelegateCommand(DeleteCommandExecute);
|
||||
UpdatePasswordCommand = new DelegateCommand(UpdatePasswordCommandExecute);
|
||||
CreateCardCommand = new DelegateCommand(CreateCardCommandExecute);
|
||||
UnbindCardCommand = new DelegateCommand(UnbindCardCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -44,6 +47,10 @@ namespace Borepin.PageModel
|
||||
{
|
||||
_ID = instance as string;
|
||||
}
|
||||
else if (instance is CardConfig)
|
||||
{
|
||||
_ID = (instance as CardConfig).UserID;
|
||||
}
|
||||
else if(instance == null && _IsDialog)
|
||||
{
|
||||
|
||||
@ -89,6 +96,10 @@ namespace Borepin.PageModel
|
||||
|
||||
CanAdmin = !((UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage).IsNull;
|
||||
CanManage = !((User.ManageInterface_Proxy)_User.Manage).IsNull;
|
||||
|
||||
// TODO CanCreateCard = !((User.CardDESFireInterface_Proxy)_User.CardDESFireEV2).IsNull;
|
||||
CanCreateCard = true;
|
||||
HasCardBinded = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -121,6 +132,20 @@ namespace Borepin.PageModel
|
||||
set => SetProperty(ref _CanManage, value);
|
||||
}
|
||||
|
||||
private bool _CanCreateCard;
|
||||
public bool CanCreateCard
|
||||
{
|
||||
get => _CanCreateCard;
|
||||
set => SetProperty(ref _CanCreateCard, value);
|
||||
}
|
||||
|
||||
private bool _HasCardBinded;
|
||||
public bool HasCardBinded
|
||||
{
|
||||
get => _HasCardBinded;
|
||||
set => SetProperty(ref _HasCardBinded, value);
|
||||
}
|
||||
|
||||
private string _NewPassword;
|
||||
public string NewPassword
|
||||
{
|
||||
@ -208,6 +233,46 @@ namespace Borepin.PageModel
|
||||
}
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private ICommand _UnbindCardCommand;
|
||||
public ICommand UnbindCardCommand
|
||||
{
|
||||
get => _UnbindCardCommand;
|
||||
set => SetProperty(ref _UnbindCardCommand, value);
|
||||
}
|
||||
|
||||
public void UnbindCardCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
||||
private ICommand _CreateCardCommand;
|
||||
public ICommand CreateCardCommand
|
||||
{
|
||||
get => _CreateCardCommand;
|
||||
set => SetProperty(ref _CreateCardCommand, value);
|
||||
}
|
||||
|
||||
public void CreateCardCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
NavigationParameters parameters = new NavigationParameters
|
||||
{
|
||||
{ "instance", _ID },
|
||||
};
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
INavigationResult result_nav = await _NavigationService.NavigateAsync("CreateCardPage", parameters).ConfigureAwait(false);
|
||||
if (result_nav.Exception != null)
|
||||
{
|
||||
Log.Fatal(result_nav.Exception, "Navigating failed");
|
||||
}
|
||||
});
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user