mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Updated API Connect
This commit is contained in:
parent
1d0abbcff7
commit
e396e82fbc
@ -65,7 +65,6 @@ namespace Borepin
|
|||||||
|
|
||||||
#region Register Dialog
|
#region Register Dialog
|
||||||
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
containerRegistry.RegisterDialog<ConfirmDialog, ConfirmDialogModel>();
|
||||||
containerRegistry.RegisterDialog<ScanDialog, ScanDialogModel>();
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Register Service
|
#region Register Service
|
||||||
|
@ -99,9 +99,6 @@
|
|||||||
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
|
<EmbeddedResource Update="Dialog\ConfirmDialog.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Dialog\ScanDialog.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Update="Page\AddServerProcess\SelectServerPage.xaml">
|
<EmbeddedResource Update="Page\AddServerProcess\SelectServerPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"/>
|
<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}"/>
|
<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>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
|
@ -5,6 +5,7 @@ using System.Windows.Input;
|
|||||||
using Borepin.Base;
|
using Borepin.Base;
|
||||||
using Borepin.Base.Exceptions;
|
using Borepin.Base.Exceptions;
|
||||||
using Borepin.Service;
|
using Borepin.Service;
|
||||||
|
using Borepin.Service.ErrorMessage;
|
||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using FabAccessAPI;
|
using FabAccessAPI;
|
||||||
using FabAccessAPI.Exceptions;
|
using FabAccessAPI.Exceptions;
|
||||||
@ -21,12 +22,14 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
private ConnectionData _ConnectionData;
|
private ConnectionData _ConnectionData;
|
||||||
private readonly ILoginStorageService _LoginStorageService;
|
private readonly ILoginStorageService _LoginStorageService;
|
||||||
|
private readonly IErrorMessageService _ErrorMessageService;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#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;
|
_LoginStorageService = loginStorageService;
|
||||||
|
_ErrorMessageService = errorMessageService;
|
||||||
|
|
||||||
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecute().ConfigureAwait(false));
|
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecute().ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
@ -113,46 +116,13 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
{
|
{
|
||||||
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
await _API.Connect(_ConnectionData).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (ConnectionException)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||||
{
|
IsBusy = false;
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
|
||||||
});
|
|
||||||
return;
|
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.Add(_ConnectionData).ConfigureAwait(false);
|
||||||
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ namespace Borepin.PageModel
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
private bool _IsConnecting;
|
private bool _RunConnecting;
|
||||||
public bool IsConnecting
|
public bool RunConnecting
|
||||||
{
|
{
|
||||||
get => _IsConnecting;
|
get => _RunConnecting;
|
||||||
set => SetProperty(ref _IsConnecting, value);
|
set => SetProperty(ref _RunConnecting, value);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace Borepin.PageModel
|
|||||||
else if(connectionData_Default != null)
|
else if(connectionData_Default != null)
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
IsConnecting = true;
|
RunConnecting = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _API.Connect(connectionData_Default).ConfigureAwait(false);
|
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