mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 23:01:52 +01:00
Fixed PageDialoge Threads
This commit is contained in:
parent
aa29d7d733
commit
f6105f10ac
@ -32,10 +32,28 @@ namespace Borepin.Base
|
|||||||
{
|
{
|
||||||
case ConnectionStatusChange.Connected:
|
case ConnectionStatusChange.Connected:
|
||||||
IsConnected = true;
|
IsConnected = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
await LoadAPIData().ConfigureAwait(false);
|
await LoadAPIData().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
IsConnected = false;
|
||||||
|
await _API.Disconnect().ConfigureAwait(false);
|
||||||
|
_API.UnbindAllEvents();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ConnectionStatusChange.Reconnected:
|
case ConnectionStatusChange.Reconnected:
|
||||||
|
try
|
||||||
|
{
|
||||||
await ReloadAPIData().ConfigureAwait(false);
|
await ReloadAPIData().ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
IsConnected = false;
|
||||||
|
await _API.Disconnect().ConfigureAwait(false);
|
||||||
|
_API.UnbindAllEvents();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ConnectionStatusChange.ConnectionLoss:
|
case ConnectionStatusChange.ConnectionLoss:
|
||||||
try
|
try
|
||||||
@ -83,9 +101,18 @@ namespace Borepin.Base
|
|||||||
await base.OnNavigatedToVirtual(parameters).ConfigureAwait(false);
|
await base.OnNavigatedToVirtual(parameters).ConfigureAwait(false);
|
||||||
|
|
||||||
if(_API.IsConnected)
|
if(_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await LoadAPIData().ConfigureAwait(false);
|
await LoadAPIData().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
IsConnected = false;
|
||||||
|
await _API.Disconnect().ConfigureAwait(false);
|
||||||
|
_API.UnbindAllEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,11 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
|
|
||||||
if (_API.IsConnected)
|
if (_API.IsConnected)
|
||||||
{
|
{
|
||||||
await _API.Disconnect().ConfigureAwait(false);
|
if (_API.IsConnected)
|
||||||
|
{
|
||||||
|
await _API.Disconnect().ConfigureAwait(true);
|
||||||
|
_API.UnbindAllEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -97,24 +101,33 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (ConnectingFailedException)
|
catch (ConnectingFailedException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (AuthenticationFailedException)
|
catch (AuthenticationFailedException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unexpected Error.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unexpected Error.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,10 +89,14 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
catch (UriFormatException)
|
catch (UriFormatException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Server address is invaild.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Server address is invaild.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +106,14 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
await api.TestConnection(_ConnectionData).ConfigureAwait(false);
|
await api.TestConnection(_ConnectionData).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch(ConnectingFailedException)
|
catch(ConnectingFailedException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,20 +128,26 @@ namespace Borepin.PageModel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _API.Connect(Connection_Item).ConfigureAwait(true);
|
await _API.Connect(Connection_Item).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch(ConnectingFailedException)
|
catch(ConnectingFailedException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch(AuthenticationFailedException)
|
catch(AuthenticationFailedException)
|
||||||
|
{
|
||||||
|
Device.BeginInvokeOnMainThread(async () =>
|
||||||
{
|
{
|
||||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user