mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-06-11 02:53:23 +02:00
Activate API Communication
This commit is contained in:
@ -42,7 +42,7 @@
|
||||
</StackLayout>
|
||||
<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}"/>
|
||||
<Button Text="Unbind Card" Command="{Binding UnbindCardCommand}" 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>
|
||||
|
@ -238,6 +238,17 @@ namespace Borepin.PageModel
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
if(ReaderID == null)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("NFC Error", "No Card Reader selected", Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_CardConfig.PICCKey = _CardConfig.ConvertFromString(PICCKey);
|
||||
|
@ -97,9 +97,11 @@ 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;
|
||||
CanCreateCard = !((User.CardDESFireInterface_Proxy)_User.CardDESFireEV2).IsNull;
|
||||
if(CanCreateCard)
|
||||
{
|
||||
HasCardBinded = (await _User.CardDESFireEV2.GetTokenList().ConfigureAwait(false)).Count > 0;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -241,9 +243,23 @@ namespace Borepin.PageModel
|
||||
set => SetProperty(ref _UnbindCardCommand, value);
|
||||
}
|
||||
|
||||
public void UnbindCardCommandExecute()
|
||||
public async void UnbindCardCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
IReadOnlyList<IReadOnlyList<byte>> list = await _User.CardDESFireEV2.GetTokenList().ConfigureAwait(false);
|
||||
|
||||
if(list.Count > 0)
|
||||
{
|
||||
await _User.CardDESFireEV2.Unbind(list[0]).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
await LoadAPIData().ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user