mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 06:41:54 +01:00
Updated API Connect
This commit is contained in:
parent
1d0abbcff7
commit
e396e82fbc
@ -65,7 +65,6 @@ namespace Borepin
|
||||
|
||||
#region Register Dialog
|
||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||
containerRegistry.RegisterDialog<ScanDialog, ScanDialogModel>();
|
||||
#endregion
|
||||
|
||||
#region Register Service
|
||||
|
@ -99,9 +99,6 @@
|
||||
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Dialog\ScanDialog.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\AddServerProcess\SelectServerPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
@ -10,9 +10,9 @@
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
||||
</StackLayout>
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
||||
<StackLayout IsVisible="{Binding IsConnecting}" VerticalOptions="CenterAndExpand">
|
||||
<StackLayout IsVisible="{Binding RunConnecting}" VerticalOptions="CenterAndExpand">
|
||||
<Label Text="{x:Static resource_text:TextResource.StartPage_Connecting}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||
<ActivityIndicator IsRunning="{Binding IsConnecting}"/>
|
||||
<ActivityIndicator IsRunning="{Binding RunConnecting}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
@ -5,6 +5,7 @@ using System.Windows.Input;
|
||||
using Borepin.Base;
|
||||
using Borepin.Base.Exceptions;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service.ErrorMessage;
|
||||
using Borepin.Service.Storage;
|
||||
using FabAccessAPI;
|
||||
using FabAccessAPI.Exceptions;
|
||||
@ -21,12 +22,14 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
#region Private Fields
|
||||
private ConnectionData _ConnectionData;
|
||||
private readonly ILoginStorageService _LoginStorageService;
|
||||
private readonly IErrorMessageService _ErrorMessageService;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public AuthPlainPageModel(INavigationService navigationService, IAPIService apiService, IPageDialogService pageDialogService, ILoginStorageService loginStorageService) : base(navigationService, pageDialogService, apiService)
|
||||
public AuthPlainPageModel(INavigationService navigationService, IAPIService apiService, IPageDialogService pageDialogService, ILoginStorageService loginStorageService, IErrorMessageService errorMessageService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
_LoginStorageService = loginStorageService;
|
||||
_ErrorMessageService = errorMessageService;
|
||||
|
||||
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecute().ConfigureAwait(false));
|
||||
}
|
||||
@ -113,46 +116,13 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
||||
}
|
||||
catch (ConnectionException)
|
||||
catch (Exception exception)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||
IsBusy = false;
|
||||
return;
|
||||
}
|
||||
catch (InvalidCredentialsException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
catch (AuthenticationFailedException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
await _LoginStorageService.Add(_ConnectionData).ConfigureAwait(false);
|
||||
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
||||
|
||||
|
@ -32,11 +32,11 @@ namespace Borepin.PageModel
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private bool _IsConnecting;
|
||||
public bool IsConnecting
|
||||
private bool _RunConnecting;
|
||||
public bool RunConnecting
|
||||
{
|
||||
get => _IsConnecting;
|
||||
set => SetProperty(ref _IsConnecting, value);
|
||||
get => _RunConnecting;
|
||||
set => SetProperty(ref _RunConnecting, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -60,7 +60,7 @@ namespace Borepin.PageModel
|
||||
else if(connectionData_Default != null)
|
||||
{
|
||||
IsBusy = false;
|
||||
IsConnecting = true;
|
||||
RunConnecting = true;
|
||||
try
|
||||
{
|
||||
await _API.Connect(connectionData_Default).ConfigureAwait(false);
|
||||
|
2
external/capnproto-dotnetcore
vendored
2
external/capnproto-dotnetcore
vendored
@ -1 +1 @@
|
||||
Subproject commit a70eecd99112b16902128b8b4b2c95b2721fdf0e
|
||||
Subproject commit 1be9ffbf8acbc9770f2d5b67c961fb60e49e5ec5
|
Loading…
x
Reference in New Issue
Block a user