From f7a6944363818bd629a0981e5e89e010e4b4d5da Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Thu, 28 Apr 2022 13:57:11 +0200 Subject: [PATCH] Fixed: #57 --- Borepin/Borepin/PageModel/ScanURNPageModel.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Borepin/Borepin/PageModel/ScanURNPageModel.cs b/Borepin/Borepin/PageModel/ScanURNPageModel.cs index b7484a0..52bdeae 100644 --- a/Borepin/Borepin/PageModel/ScanURNPageModel.cs +++ b/Borepin/Borepin/PageModel/ScanURNPageModel.cs @@ -1,5 +1,6 @@ using Borepin.Base; using Borepin.Service.BFFH; +using Borepin.Service.BFFH.Exceptions; using FabAccessAPI.Schema; using Prism.Commands; using Prism.Navigation; @@ -97,8 +98,21 @@ namespace Borepin.PageModel return; } // END HACK + string id = null; + try + { + id = await QRToID(ScanResult.Text).ConfigureAwait(false); + } + catch(ReconnectingFailedException) + { + Device.BeginInvokeOnMainThread(async () => + { + await _PageDialogService.DisplayAlertAsync("Connection failed", "Please reconnect to the server.", "OK").ConfigureAwait(false); + IsScanning = true; + }); - string id = await QRToID(ScanResult.Text).ConfigureAwait(false); + return; + } if (id != null) { @@ -119,13 +133,18 @@ namespace Borepin.PageModel await _PageDialogService.DisplayAlertAsync("Alert", "QR Code is invalid", "OK").ConfigureAwait(false); IsScanning = true; }); + return; } + + IsScanning = true; } public async Task QRToID(string value) { if (!_BFFHService.IsConnected) { + await _BFFHService.Reconnect().ConfigureAwait(false); + IsConnected = false; return null; }