mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Open every NTAG and select by resource id
This commit is contained in:
parent
b9bb50df87
commit
c8c07e502b
@ -70,68 +70,70 @@ namespace Borepin
|
|||||||
IAPI api = apiService.GetAPI();
|
IAPI api = apiService.GetAPI();
|
||||||
|
|
||||||
// TODO Preferred Account
|
// TODO Preferred Account
|
||||||
if (!api.IsConnected)
|
//if (!api.IsConnected)
|
||||||
{
|
//{
|
||||||
ILoginStorageService loginStorageService = Container.Resolve<ILoginStorageService>();
|
// ILoginStorageService loginStorageService = Container.Resolve<ILoginStorageService>();
|
||||||
List<ConnectionData> list = (List<ConnectionData>)await loginStorageService.GetList().ConfigureAwait(false);
|
// List<ConnectionData> list = (List<ConnectionData>)await loginStorageService.GetList().ConfigureAwait(false);
|
||||||
|
|
||||||
ConnectionData connectionData = list.Find(x => string.Equals(x.Host.Host, uri.Host, StringComparison.OrdinalIgnoreCase));
|
// ConnectionData connectionData = list.Find(x => string.Equals(x.Host.Host, uri.Host, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if(connectionData == null)
|
// if(connectionData == null)
|
||||||
{
|
// {
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
// Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
// {
|
||||||
await pageDialogService.DisplayAlertAsync("NFC connect failed", "No ConnectionData", "Ok").ConfigureAwait(false);
|
// await pageDialogService.DisplayAlertAsync("NFC connect failed", "No ConnectionData", "Ok").ConfigureAwait(false);
|
||||||
});
|
// });
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
await api.Connect(connectionData).ConfigureAwait(false);
|
// await api.Connect(connectionData).ConfigureAwait(false);
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
// TODO
|
// // TODO
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
// Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
// {
|
||||||
await pageDialogService.DisplayAlertAsync("NFC connect failed", ex.ToString(), "Ok").ConfigureAwait(false);
|
// await pageDialogService.DisplayAlertAsync("NFC connect failed", ex.ToString(), "Ok").ConfigureAwait(false);
|
||||||
});
|
// });
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (api.IsConnected)
|
if (api.IsConnected)
|
||||||
{
|
{
|
||||||
if (string.Equals(uri.Host, api.ConnectionData.Host.Host, StringComparison.OrdinalIgnoreCase))
|
Optional < Machine> optional = await api.Session.MachineSystem.Info.GetMachine(resource_id).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (optional.Just == null)
|
||||||
{
|
{
|
||||||
Optional<Machine> optional = await api.Session.MachineSystem.Info.GetMachine(resource_id).ConfigureAwait(false);
|
|
||||||
|
|
||||||
if (optional.Just == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Prism.Navigation.NavigationParameters parameters = new Prism.Navigation.NavigationParameters
|
|
||||||
{
|
|
||||||
{ "instance", optional.Just.Id },
|
|
||||||
};
|
|
||||||
|
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
INavigationResult result = await Container.Resolve<INavigationService>().NavigateAsync("/MainPage/NavigationPage/MachineListPage/MachinePage", parameters).ConfigureAwait(false);
|
await pageDialogService.DisplayAlertAsync("NFC Error", "Unknown ID" + resource_id, "Ok").ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Prism.Navigation.NavigationParameters parameters = new Prism.Navigation.NavigationParameters
|
||||||
|
{
|
||||||
|
{ "instance", optional.Just.Id },
|
||||||
|
};
|
||||||
|
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
|
{
|
||||||
|
INavigationResult result = await Container.Resolve<INavigationService>().NavigateAsync("/MainPage/NavigationPage/MachineListPage/MachinePage", parameters).ConfigureAwait(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
return;
|
||||||
{
|
//Device.BeginInvokeOnMainThread(async () =>
|
||||||
await pageDialogService.DisplayAlertAsync("Intent", "No Services", "Ok").ConfigureAwait(false);
|
//{
|
||||||
});
|
// INavigationResult result = await NavigationService.NavigateAsync(new Uri("https://borepin.fab-access.org/StartPage")).ConfigureAwait(false);
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 19f20f5154f0eced6288ff56cac840025ee51da1
|
Subproject commit cde4677575f8e133ac764663e131c80fc891d545
|
Loading…
x
Reference in New Issue
Block a user