Activate API Communication

This commit is contained in:
TheJoKlLa 2023-02-03 00:16:47 +01:00
parent b09c6dd507
commit c6d6153932
4 changed files with 33 additions and 6 deletions

View File

@ -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>

View File

@ -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);

View File

@ -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;
}

2
external/NFC vendored

@ -1 +1 @@
Subproject commit e79b6aace26c8b362a5f450345a67ba700f06805
Subproject commit a6479be14e86add7a84b3a1a502608a665ec51f0