mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-04-20 18:36:31 +02:00
Added: Reconnect in UI
This commit is contained in:
parent
b2cce15464
commit
492ed2e3ce
@ -53,5 +53,7 @@
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<Capability Name="privateNetworkClientServer"/>
|
||||
<Capability Name="allJoyn"/>
|
||||
</Capabilities>
|
||||
</Package>
|
@ -12,6 +12,7 @@ using Borepin.PageModel.AddServerProcess;
|
||||
using System;
|
||||
using Borepin.Service.Storage;
|
||||
using NLog;
|
||||
using Borepin.Service.ErrorMessage;
|
||||
|
||||
namespace Borepin
|
||||
{
|
||||
@ -69,6 +70,7 @@ namespace Borepin
|
||||
|
||||
#region Register Service
|
||||
containerRegistry.RegisterSingleton<ILoginStorageService, LoginStorageService>();
|
||||
containerRegistry.RegisterSingleton<IErrorMessageService, ErrorMessageService>();
|
||||
|
||||
// NEED PLATFORM SPECIFIC SERVICE
|
||||
// IPreferenceStorageService
|
||||
|
@ -42,11 +42,9 @@ namespace Borepin.Base
|
||||
{
|
||||
await LoadAPIData().ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
catch(Exception exception)
|
||||
{
|
||||
IsConnected = false;
|
||||
await _API.Disconnect().ConfigureAwait(false);
|
||||
_API.UnbindEventHandler();
|
||||
Log.Warn("Load API Data failed", exception);
|
||||
}
|
||||
break;
|
||||
case ConnectionStatusChanged.ConnectionLoss:
|
||||
@ -101,10 +99,7 @@ namespace Borepin.Base
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
IsConnected = false;
|
||||
await _API.Disconnect().ConfigureAwait(false);
|
||||
_API.UnbindEventHandler();
|
||||
Log.Error("LoadAPIData failed", exception);
|
||||
Log.Warn("Load API Data failed", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Borepin/Borepin/Base/ErrorMessages.cs
Normal file
11
Borepin/Borepin/Base/ErrorMessages.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Borepin.Base
|
||||
{
|
||||
public static class ErrorMessages
|
||||
{
|
||||
|
||||
}
|
||||
}
|
35
Borepin/Borepin/Converter/AllTrueBoolConverter.cs
Normal file
35
Borepin/Borepin/Converter/AllTrueBoolConverter.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.Converter
|
||||
{
|
||||
public class AllTrueBoolConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values == null || !targetType.IsAssignableFrom(typeof(bool)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var value in values)
|
||||
{
|
||||
if (!(value is bool b))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!b)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,29 +4,30 @@
|
||||
x:Class="Borepin.Page.AddUserPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_AddUser}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="{x:Static resource_text:TextResource.USERNAME}" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||
<Entry Text="{Binding Username}" Keyboard="Url" IsSpellCheckEnabled="false"/>
|
||||
<Label Text="{x:Static resource_text:TextResource.PASSWORD}" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||
<Entry Text="{Binding Password}" Keyboard="Url" IsSpellCheckEnabled="false"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.AddUserPage_AddUser}" Command="{Binding AddUserCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -1,16 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
x:Class="Borepin.Page.MachineListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Machines}">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Machines}"
|
||||
>
|
||||
<NavigationPage.TitleView>
|
||||
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
||||
</ResourceDictionary>
|
||||
@ -18,8 +21,13 @@
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected"/>
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Button Text="{x:Static resource_text:TextResource.SCANQR}" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}">
|
||||
<Button.IsVisible>
|
||||
<OnPlatform x:TypeArguments="x:Boolean"
|
||||
@ -47,6 +55,5 @@
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
@ -4,26 +4,38 @@
|
||||
x:Class="Borepin.Page.MachinePage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Machine}">
|
||||
<NavigationPage.TitleView>
|
||||
<Label Text="{Binding MachineItem.State, Converter={StaticResource MachineStateStringConverter}}" FontAttributes="Bold" HorizontalOptions="End" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" WidthRequest="150" Margin="7.5" VerticalOptions="FillAndExpand" FontSize="Small" BackgroundColor="{Binding MachineItem.State, Converter={StaticResource MachineStateColorConverter}}"/>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<NavigationPage.TitleView>
|
||||
<Label Text="{Binding MachineItem.State, Converter={StaticResource MachineStateStringConverter}}" FontAttributes="Bold" HorizontalOptions="End" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" WidthRequest="150" Margin="7.5" VerticalOptions="FillAndExpand" FontSize="Small" BackgroundColor="{Binding MachineItem.State, Converter={StaticResource MachineStateColorConverter}}">
|
||||
<Label.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</Label.IsVisible>
|
||||
</Label>
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="{Binding MachineItem.Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<Label Text="{Binding MachineItem.Description}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||
<StackLayout Orientation="Horizontal" IsVisible="{Binding MachineItem.CurrentUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
||||
@ -47,8 +59,6 @@
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.ProfilePage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text" xmlns:views="clr-namespace:Borepin.View"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Profile}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
@ -12,11 +12,14 @@
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="{Binding Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<StackLayout IsVisible="{Binding CanManage}">
|
||||
<Label Text="{x:Static resource_text:TextResource.ProfilePage_ChangePassword}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||
@ -25,10 +28,6 @@
|
||||
<Button Text="{x:Static resource_text:TextResource.ProfilePage_UpdatePassword}" Command="{Binding UpdatePasswordCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -11,17 +11,21 @@
|
||||
</NavigationPage.TitleView>
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Button Text="{x:Static resource_text:TextResource.UserListPage_AddUser}" Command="{Binding AddUserCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<SearchBar Text="{Binding SearchUsername}" SearchCommand="{Binding SearchUserCommand}">
|
||||
<SearchBar.Behaviors>
|
||||
@ -38,10 +42,6 @@
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
|
@ -8,19 +8,23 @@
|
||||
Title="{x:Static resource_text:TextResource.TITLE_User}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<views:ConnectionStateView/>
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" />
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="{Binding UserItem.Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<ListView ItemsSource="{Binding PermissionSelectViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
|
||||
<ListView.ItemTemplate>
|
||||
@ -38,10 +42,6 @@
|
||||
</StackLayout>
|
||||
<Button Grid.Row="1" Text="{x:Static resource_text:TextResource.DELETE}" Command="{Binding DeleteCommand}" Style="{StaticResource Style_Button_Admin}" VerticalOptions="End"/>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@ -1,4 +1,5 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Service.ErrorMessage;
|
||||
using FabAccessAPI;
|
||||
using FabAccessAPI.Exceptions;
|
||||
using Prism.Commands;
|
||||
@ -16,11 +17,14 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
#region Private Fields
|
||||
private ConnectionData _ConnectionData;
|
||||
private IErrorMessageService _ErrorMessageService;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public SelectServerPageModel(INavigationService navigationService, IPageDialogService pageDialogService) : base(navigationService, pageDialogService)
|
||||
public SelectServerPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IErrorMessageService errorMessageService) : base(navigationService, pageDialogService)
|
||||
{
|
||||
_ErrorMessageService = errorMessageService;
|
||||
|
||||
ConnectToServerCommand = new DelegateCommand(async () => await ConnectToServerExecute().ConfigureAwait(false));
|
||||
DetectLocalServerCommand = new DelegateCommand(DetectHostCommandExecute);
|
||||
ScanCodeCommand = new DelegateCommand(ScanCodeCommandExecute);
|
||||
@ -120,15 +124,10 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
API api = new API();
|
||||
await api.TryToConnect(_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);
|
||||
|
||||
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||
IsBusy = false;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -144,9 +144,17 @@ namespace Borepin.PageModel
|
||||
public async Task RefreshCommandExecute()
|
||||
{
|
||||
if(_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadAPIData().ConfigureAwait(true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Borepin.PageModel
|
||||
List<Task> tasks = new List<Task>();
|
||||
|
||||
IList<ConnectionData> list = await _LoginStorageService.GetList().ConfigureAwait(false);
|
||||
if (_API.IsConnected)
|
||||
if (_API.IsConnected || _API.IsConnecting)
|
||||
{
|
||||
ActiveConnection = new ServerListItemViewModel(_NavigationService, _PageDialogService);
|
||||
await ActiveConnection.LoadInstance(_API.ConnectionData).ConfigureAwait(false);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Base.Exceptions;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service.ErrorMessage;
|
||||
using Borepin.Service.Storage;
|
||||
using FabAccessAPI;
|
||||
using FabAccessAPI.Exceptions;
|
||||
@ -22,14 +23,16 @@ namespace Borepin.PageModel
|
||||
#region Private Fields
|
||||
private readonly IDialogService _DialogService;
|
||||
private readonly ILoginStorageService _LoginStorageService;
|
||||
private readonly IErrorMessageService _ErrorMessageService;
|
||||
private bool IsDialog = false;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public ServerPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, IDialogService dialogService, ILoginStorageService loginStorageService) : base(navigationService, pageDialogService, apiService)
|
||||
public ServerPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, IDialogService dialogService, ILoginStorageService loginStorageService, IErrorMessageService errorMessageService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
_DialogService = dialogService;
|
||||
_LoginStorageService = loginStorageService;
|
||||
_ErrorMessageService = errorMessageService;
|
||||
|
||||
ConnectCommand = new DelegateCommand(async () => await ConnectCommandExecute().ConfigureAwait(false));
|
||||
DisconnectCommand = new DelegateCommand(async () => await DisonnectCommandExecute().ConfigureAwait(false));
|
||||
@ -52,7 +55,7 @@ namespace Borepin.PageModel
|
||||
throw new InstanceIncorrectException();
|
||||
}
|
||||
|
||||
if(_API.IsConnected && Connection_Item != null)
|
||||
if((_API.IsConnected || _API.IsConnecting) && Connection_Item != null)
|
||||
{
|
||||
InstanceIsActiveConnection = Connection_Item.Equals(_API.ConnectionData);
|
||||
}
|
||||
@ -125,31 +128,16 @@ namespace Borepin.PageModel
|
||||
if(_API.IsConnected)
|
||||
{
|
||||
await _API.Disconnect().ConfigureAwait(true);
|
||||
_API.UnbindEventHandler();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _API.Connect(Connection_Item).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);
|
||||
|
||||
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service.ErrorMessage;
|
||||
using Borepin.Service.Storage;
|
||||
using FabAccessAPI;
|
||||
using FabAccessAPI.Exceptions;
|
||||
@ -19,12 +20,14 @@ namespace Borepin.PageModel
|
||||
{
|
||||
#region Private Fields
|
||||
private readonly ILoginStorageService _LoginStorageService;
|
||||
private readonly IErrorMessageService _ErrorMessageService;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public StartPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, ILoginStorageService loginStorageService) : base(navigationService, pageDialogService, apiService)
|
||||
public StartPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, ILoginStorageService loginStorageService, IErrorMessageService errorMessageService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
_LoginStorageService = loginStorageService;
|
||||
_ErrorMessageService = errorMessageService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -70,33 +73,9 @@ namespace Borepin.PageModel
|
||||
}
|
||||
});
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
catch (AuthenticationFailedException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
catch (InvalidCredentialsException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||
}
|
||||
|
||||
if (_API.IsConnected == false)
|
||||
|
@ -89,9 +89,16 @@ namespace Borepin.PageModel
|
||||
public async Task RefreshCommandExecute()
|
||||
{
|
||||
if(_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadAPIData().ConfigureAwait(true);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
@ -170,6 +170,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Authentication failed ähnelt.
|
||||
/// </summary>
|
||||
internal static string ALERT_AuthFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_AuthFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Unable to authenticate to server. ähnelt.
|
||||
/// </summary>
|
||||
@ -179,6 +188,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die SASL Mechanism is not supported- ähnelt.
|
||||
/// </summary>
|
||||
internal static string ALERT_BadMechanism {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_BadMechanism", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Connection failed ähnelt.
|
||||
/// </summary>
|
||||
@ -188,6 +206,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Connection time exceeded. ähnelt.
|
||||
/// </summary>
|
||||
internal static string ALERT_ConnectionTimeout {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_ConnectionTimeout", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Credentials are invalid. ähnelt.
|
||||
/// </summary>
|
||||
@ -224,6 +251,24 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die SASL Authenticaiton failed ähnelt.
|
||||
/// </summary>
|
||||
internal static string ALERT_SASLAuth {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_SASLAuth", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die TLS certificate is invalid. ähnelt.
|
||||
/// </summary>
|
||||
internal static string ALERT_TLSInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_TLSInvalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Unable to connect to server. ähnelt.
|
||||
/// </summary>
|
||||
@ -296,6 +341,33 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Connecting to Server ... ähnelt.
|
||||
/// </summary>
|
||||
internal static string ConnectionStatus_Connecting {
|
||||
get {
|
||||
return ResourceManager.GetString("ConnectionStatus_Connecting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die No Connection to Server ähnelt.
|
||||
/// </summary>
|
||||
internal static string ConnectionStatus_NoConnection {
|
||||
get {
|
||||
return ResourceManager.GetString("ConnectionStatus_NoConnection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Please select a Server. ähnelt.
|
||||
/// </summary>
|
||||
internal static string ConnectionStatus_NotConnected {
|
||||
get {
|
||||
return ResourceManager.GetString("ConnectionStatus_NotConnected", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Delete ähnelt.
|
||||
/// </summary>
|
||||
@ -558,15 +630,6 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Please connect to Server ähnelt.
|
||||
/// </summary>
|
||||
internal static string PLEASECONNECTTOSERVER {
|
||||
get {
|
||||
return ResourceManager.GetString("PLEASECONNECTTOSERVER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Change Password ähnelt.
|
||||
/// </summary>
|
||||
|
@ -151,39 +151,71 @@ You can also put down several servers and then connect to the desired server.</v
|
||||
</data>
|
||||
<data name="ALERT_AddressInvalid" xml:space="preserve">
|
||||
<value>Server address is invaild.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_AddUserFailed" xml:space="preserve">
|
||||
<value>Add User failed</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_AuthFailed" xml:space="preserve">
|
||||
<value>Authentication failed</value>
|
||||
<comment>Message Title</comment>
|
||||
</data>
|
||||
<data name="ALERT_AuthServer" xml:space="preserve">
|
||||
<value>Unable to authenticate to server.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_BadMechanism" xml:space="preserve">
|
||||
<value>SASL Mechanism is not supported-</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_ConnectionFailed" xml:space="preserve">
|
||||
<value>Connection failed</value>
|
||||
<comment>Message Title</comment>
|
||||
</data>
|
||||
<data name="ALERT_ConnectionTimeout" xml:space="preserve">
|
||||
<value>Connection time exceeded.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_CredentialsInvalid" xml:space="preserve">
|
||||
<value>Credentials are invalid.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_DuplicateConnection" xml:space="preserve">
|
||||
<value>Connection already exist. Please delete old Connection before adding the new Connection.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_PasswordInvalid" xml:space="preserve">
|
||||
<value>Password is invalid.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_QRInvalid" xml:space="preserve">
|
||||
<value>QR Code is invalid</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_SASLAuth" xml:space="preserve">
|
||||
<value>SASL Authenticaiton failed</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_TLSInvalid" xml:space="preserve">
|
||||
<value>TLS certificate is invalid.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_UnableServer" xml:space="preserve">
|
||||
<value>Unable to connect to server.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_UnexpectedError" xml:space="preserve">
|
||||
<value>Unexpected Error.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_UserExist" xml:space="preserve">
|
||||
<value>User allready exist.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="ALERT_UsernameInvalid" xml:space="preserve">
|
||||
<value>Username is invalid.</value>
|
||||
<comment>Message Content</comment>
|
||||
</data>
|
||||
<data name="Bionade" xml:space="preserve">
|
||||
<value>It's Bionade</value>
|
||||
@ -197,6 +229,15 @@ You can also put down several servers and then connect to the desired server.</v
|
||||
<data name="CONFIRM" xml:space="preserve">
|
||||
<value>Confirm</value>
|
||||
</data>
|
||||
<data name="ConnectionStatus_Connecting" xml:space="preserve">
|
||||
<value>Connecting to Server ...</value>
|
||||
</data>
|
||||
<data name="ConnectionStatus_NoConnection" xml:space="preserve">
|
||||
<value>No Connection to Server</value>
|
||||
</data>
|
||||
<data name="ConnectionStatus_NotConnected" xml:space="preserve">
|
||||
<value>Please select a Server.</value>
|
||||
</data>
|
||||
<data name="DELETE" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
@ -285,9 +326,6 @@ Ask in your Space if you can be trained on the machine to be unlocked for the ma
|
||||
<data name="PASSWORD" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
<data name="PLEASECONNECTTOSERVER" xml:space="preserve">
|
||||
<value>Please connect to Server</value>
|
||||
</data>
|
||||
<data name="ProfilePage_ChangePassword" xml:space="preserve">
|
||||
<value>Change Password</value>
|
||||
</data>
|
||||
|
108
Borepin/Borepin/Service/ErrorMessage/ErrorMessageService.cs
Normal file
108
Borepin/Borepin/Service/ErrorMessage/ErrorMessageService.cs
Normal file
@ -0,0 +1,108 @@
|
||||
using Capnp.Rpc;
|
||||
using FabAccessAPI.Exceptions;
|
||||
using FabAccessAPI.Exceptions.SASL;
|
||||
using Prism.Services;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.Service.ErrorMessage
|
||||
{
|
||||
public class ErrorMessageService : IErrorMessageService
|
||||
{
|
||||
#region Private Members
|
||||
private IPageDialogService _PageDialogService;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public ErrorMessageService(IPageDialogService pageDialogService)
|
||||
{
|
||||
_PageDialogService = pageDialogService;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods to Display Connection Error
|
||||
|
||||
public void DisplayConnectFailedMessage(System.Exception exception)
|
||||
{
|
||||
if(exception is ConnectionException)
|
||||
{
|
||||
DisplayConnectionMessage(exception as ConnectionException);
|
||||
}
|
||||
else if(exception is AuthenticationException)
|
||||
{
|
||||
DisplayAuthenticationMessage(exception as AuthenticationException);
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayAuthenticationMessage(AuthenticationException exception)
|
||||
{
|
||||
if (exception.InnerException is BadMechanismException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AuthFailed, Resources.Text.TextResource.ALERT_BadMechanism, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else if (exception.InnerException is InvalidCredentialsException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AuthFailed, Resources.Text.TextResource.ALERT_CredentialsInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else if (exception.InnerException is AuthenticationFailedException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AuthFailed, Resources.Text.TextResource.ALERT_SASLAuth, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AuthFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayConnectionMessage(ConnectionException exception)
|
||||
{
|
||||
if(exception.InnerException is System.Security.Authentication.AuthenticationException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_TLSInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else if(exception.InnerException is FabAccessAPI.Exceptions.TimeoutException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_ConnectionTimeout, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else if(exception.InnerException is RpcException)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
14
Borepin/Borepin/Service/ErrorMessage/IErrorMessageService.cs
Normal file
14
Borepin/Borepin/Service/ErrorMessage/IErrorMessageService.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using FabAccessAPI.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Borepin.Service.ErrorMessage
|
||||
{
|
||||
public interface IErrorMessageService
|
||||
{
|
||||
void DisplayConnectFailedMessage(Exception exception);
|
||||
void DisplayConnectionMessage(ConnectionException exception);
|
||||
void DisplayAuthenticationMessage(AuthenticationException exception);
|
||||
}
|
||||
}
|
@ -6,8 +6,8 @@
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||
<ContentView.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ContentView.Resources>
|
||||
<ContentView.Content>
|
||||
@ -15,12 +15,17 @@
|
||||
<StackLayout IsVisible="{Binding IsBusy}">
|
||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="No Connection to Server"/>
|
||||
<Label Text="Connecting to Server ..." IsVisible="{Binding IsConnecting}"/>
|
||||
<Label Text="Please select a Server." IsVisible="{Binding IsConnecting, Converter={StaticResource InvertBoolConverter}}"/>
|
||||
</StackLayout>
|
||||
|
||||
<StackLayout>
|
||||
<StackLayout.IsVisible>
|
||||
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
<Binding Path="IsConnected" Converter="{StaticResource InvertBoolConverter}"/>
|
||||
</MultiBinding>
|
||||
</StackLayout.IsVisible>
|
||||
<Label Text="{x:Static resource_text:TextResource.ConnectionStatus_NoConnection}"/>
|
||||
<Label Text="{x:Static resource_text:TextResource.ConnectionStatus_Connecting}" IsVisible="{Binding IsConnecting}"/>
|
||||
<Label Text="{x:Static resource_text:TextResource.ConnectionStatus_NotConnected}" IsVisible="{Binding IsConnecting, Converter={StaticResource InvertBoolConverter}}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
|
@ -290,8 +290,6 @@ namespace FabAccessAPI
|
||||
/// </summary>
|
||||
/// <exception cref="ConnectionException"> When API-Service can not connect to a server </exception>
|
||||
public async Task<ServerData> TryToConnect(ConnectionData connectionData, TcpRpcClient tcpRpcClient = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (tcpRpcClient == null)
|
||||
{
|
||||
@ -307,11 +305,6 @@ namespace FabAccessAPI
|
||||
|
||||
return serverData;
|
||||
}
|
||||
catch(System.Exception ex)
|
||||
{
|
||||
throw new ConnectionException("Test Connection Failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Public Wrapper to run HeartbeatAsync
|
||||
@ -357,7 +350,7 @@ namespace FabAccessAPI
|
||||
sslStream.AuthenticateAsClient("bffhd");
|
||||
return sslStream;
|
||||
}
|
||||
catch (AuthenticationException exception)
|
||||
catch (System.Security.Authentication.AuthenticationException exception)
|
||||
{
|
||||
sslStream.Close();
|
||||
Log.Warn(exception);
|
||||
|
Loading…
x
Reference in New Issue
Block a user