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>
|
<Capabilities>
|
||||||
<Capability Name="internetClient" />
|
<Capability Name="internetClient" />
|
||||||
|
<Capability Name="privateNetworkClientServer"/>
|
||||||
|
<Capability Name="allJoyn"/>
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
</Package>
|
</Package>
|
@ -12,6 +12,7 @@ using Borepin.PageModel.AddServerProcess;
|
|||||||
using System;
|
using System;
|
||||||
using Borepin.Service.Storage;
|
using Borepin.Service.Storage;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using Borepin.Service.ErrorMessage;
|
||||||
|
|
||||||
namespace Borepin
|
namespace Borepin
|
||||||
{
|
{
|
||||||
@ -69,6 +70,7 @@ namespace Borepin
|
|||||||
|
|
||||||
#region Register Service
|
#region Register Service
|
||||||
containerRegistry.RegisterSingleton<ILoginStorageService, LoginStorageService>();
|
containerRegistry.RegisterSingleton<ILoginStorageService, LoginStorageService>();
|
||||||
|
containerRegistry.RegisterSingleton<IErrorMessageService, ErrorMessageService>();
|
||||||
|
|
||||||
// NEED PLATFORM SPECIFIC SERVICE
|
// NEED PLATFORM SPECIFIC SERVICE
|
||||||
// IPreferenceStorageService
|
// IPreferenceStorageService
|
||||||
|
@ -42,11 +42,9 @@ namespace Borepin.Base
|
|||||||
{
|
{
|
||||||
await LoadAPIData().ConfigureAwait(false);
|
await LoadAPIData().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch(Exception exception)
|
||||||
{
|
{
|
||||||
IsConnected = false;
|
Log.Warn("Load API Data failed", exception);
|
||||||
await _API.Disconnect().ConfigureAwait(false);
|
|
||||||
_API.UnbindEventHandler();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ConnectionStatusChanged.ConnectionLoss:
|
case ConnectionStatusChanged.ConnectionLoss:
|
||||||
@ -101,10 +99,7 @@ namespace Borepin.Base
|
|||||||
}
|
}
|
||||||
catch(Exception exception)
|
catch(Exception exception)
|
||||||
{
|
{
|
||||||
IsConnected = false;
|
Log.Warn("Load API Data failed", exception);
|
||||||
await _API.Disconnect().ConfigureAwait(false);
|
|
||||||
_API.UnbindEventHandler();
|
|
||||||
Log.Error("LoadAPIData 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"
|
x:Class="Borepin.Page.AddUserPage"
|
||||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
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_AddUser}">
|
Title="{x:Static resource_text:TextResource.TITLE_AddUser}">
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<views:ConnectionStateView/>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<StackLayout>
|
||||||
</StackLayout>
|
<StackLayout.IsVisible>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<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>
|
<Label Text="{x:Static resource_text:TextResource.USERNAME}" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||||
<Entry Text="{Binding Username}" Keyboard="Url" IsSpellCheckEnabled="false"/>
|
<Entry Text="{Binding Username}" Keyboard="Url" IsSpellCheckEnabled="false"/>
|
||||||
<Label Text="{x:Static resource_text:TextResource.PASSWORD}" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
<Label Text="{x:Static resource_text:TextResource.PASSWORD}" Style="{StaticResource Style_Label_Property_Title}"></Label>
|
||||||
<Entry Text="{Binding Password}" Keyboard="Url" IsSpellCheckEnabled="false"/>
|
<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}"/>
|
<Button Text="{x:Static resource_text:TextResource.AddUserPage_AddUser}" Command="{Binding AddUserCommand}" 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>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -1,16 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?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:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:views="clr-namespace:Borepin.View"
|
xmlns:views="clr-namespace:Borepin.View"
|
||||||
x:Class="Borepin.Page.MachineListPage"
|
x:Class="Borepin.Page.MachineListPage"
|
||||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
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>
|
<NavigationPage.TitleView>
|
||||||
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
||||||
</NavigationPage.TitleView>
|
</NavigationPage.TitleView>
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@ -18,8 +21,13 @@
|
|||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<views:ConnectionStateView/>
|
<views:ConnectionStateView/>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<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 Text="{x:Static resource_text:TextResource.SCANQR}" Command="{Binding ScanCodeCommand}" Style="{StaticResource Style_Button_Primary}">
|
||||||
<Button.IsVisible>
|
<Button.IsVisible>
|
||||||
<OnPlatform x:TypeArguments="x:Boolean"
|
<OnPlatform x:TypeArguments="x:Boolean"
|
||||||
@ -47,6 +55,5 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
@ -4,26 +4,38 @@
|
|||||||
x:Class="Borepin.Page.MachinePage"
|
x:Class="Borepin.Page.MachinePage"
|
||||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
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_Machine}">
|
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>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||||
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
||||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</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>
|
<ContentPage.Content>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<views:ConnectionStateView/>
|
||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<StackLayout>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<StackLayout.IsVisible>
|
||||||
</StackLayout>
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<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.Name}" Style="{StaticResource LabelStyle_Title}"/>
|
||||||
<Label Text="{Binding MachineItem.Description}" Style="{StaticResource Style_Label_Text_Center}"/>
|
<Label Text="{Binding MachineItem.Description}" Style="{StaticResource Style_Label_Text_Center}"/>
|
||||||
<StackLayout Orientation="Horizontal" IsVisible="{Binding MachineItem.CurrentUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
<StackLayout Orientation="Horizontal" IsVisible="{Binding MachineItem.CurrentUser, Converter={StaticResource IsNotNullBoolConverter}}">
|
||||||
@ -47,8 +59,6 @@
|
|||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
|
|
||||||
</StackLayout>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="Borepin.Page.ProfilePage"
|
x:Class="Borepin.Page.ProfilePage"
|
||||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
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}">
|
Title="{x:Static resource_text:TextResource.TITLE_Profile}">
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
@ -12,11 +12,14 @@
|
|||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<views:ConnectionStateView/>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<StackLayout>
|
||||||
</StackLayout>
|
<StackLayout.IsVisible>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||||
|
<Binding Path="IsConnected" />
|
||||||
|
</MultiBinding>
|
||||||
|
</StackLayout.IsVisible>
|
||||||
<Label Text="{Binding Username}" Style="{StaticResource LabelStyle_Title}"/>
|
<Label Text="{Binding Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||||
<StackLayout IsVisible="{Binding CanManage}">
|
<StackLayout IsVisible="{Binding CanManage}">
|
||||||
<Label Text="{x:Static resource_text:TextResource.ProfilePage_ChangePassword}" Style="{StaticResource Style_Label_Property_Title}"/>
|
<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}"/>
|
<Button Text="{x:Static resource_text:TextResource.ProfilePage_UpdatePassword}" Command="{Binding UpdatePasswordCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -11,17 +11,21 @@
|
|||||||
</NavigationPage.TitleView>
|
</NavigationPage.TitleView>
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<views:ConnectionStateView/>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<StackLayout>
|
||||||
</StackLayout>
|
<StackLayout.IsVisible>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<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}"/>
|
<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 Text="{Binding SearchUsername}" SearchCommand="{Binding SearchUserCommand}">
|
||||||
<SearchBar.Behaviors>
|
<SearchBar.Behaviors>
|
||||||
@ -38,10 +42,6 @@
|
|||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
</ListView>
|
</ListView>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
@ -8,19 +8,23 @@
|
|||||||
Title="{x:Static resource_text:TextResource.TITLE_User}">
|
Title="{x:Static resource_text:TextResource.TITLE_User}">
|
||||||
<ContentPage.Resources>
|
<ContentPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||||
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
<converters:MachineStateStringConverter x:Key="MachineStateStringConverter"/>
|
||||||
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
<converters:IsNotNullBoolConverter x:Key="IsNotNullBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentPage.Resources>
|
</ContentPage.Resources>
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<views:ConnectionStateView/>
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<StackLayout>
|
||||||
</StackLayout>
|
<StackLayout.IsVisible>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<StackLayout IsVisible="{Binding IsConnected}">
|
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||||
|
<Binding Path="IsConnected" />
|
||||||
|
</MultiBinding>
|
||||||
|
</StackLayout.IsVisible>
|
||||||
<Label Text="{Binding UserItem.Username}" Style="{StaticResource LabelStyle_Title}"/>
|
<Label Text="{Binding UserItem.Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||||
<ListView ItemsSource="{Binding PermissionSelectViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
|
<ListView ItemsSource="{Binding PermissionSelectViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
@ -38,10 +42,6 @@
|
|||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Button Grid.Row="1" Text="{x:Static resource_text:TextResource.DELETE}" Command="{Binding DeleteCommand}" Style="{StaticResource Style_Button_Admin}" VerticalOptions="End"/>
|
<Button Grid.Row="1" Text="{x:Static resource_text:TextResource.DELETE}" Command="{Binding DeleteCommand}" Style="{StaticResource Style_Button_Admin}" VerticalOptions="End"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
|
||||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -1,4 +1,5 @@
|
|||||||
using Borepin.Base;
|
using Borepin.Base;
|
||||||
|
using Borepin.Service.ErrorMessage;
|
||||||
using FabAccessAPI;
|
using FabAccessAPI;
|
||||||
using FabAccessAPI.Exceptions;
|
using FabAccessAPI.Exceptions;
|
||||||
using Prism.Commands;
|
using Prism.Commands;
|
||||||
@ -16,11 +17,14 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
private ConnectionData _ConnectionData;
|
private ConnectionData _ConnectionData;
|
||||||
|
private IErrorMessageService _ErrorMessageService;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#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));
|
ConnectToServerCommand = new DelegateCommand(async () => await ConnectToServerExecute().ConfigureAwait(false));
|
||||||
DetectLocalServerCommand = new DelegateCommand(DetectHostCommandExecute);
|
DetectLocalServerCommand = new DelegateCommand(DetectHostCommandExecute);
|
||||||
ScanCodeCommand = new DelegateCommand(ScanCodeCommandExecute);
|
ScanCodeCommand = new DelegateCommand(ScanCodeCommandExecute);
|
||||||
@ -120,15 +124,10 @@ namespace Borepin.PageModel.AddServerProcess
|
|||||||
API api = new API();
|
API api = new API();
|
||||||
await api.TryToConnect(_ConnectionData).ConfigureAwait(false);
|
await api.TryToConnect(_ConnectionData).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch(ConnectionException)
|
catch(Exception exception)
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,9 +144,17 @@ namespace Borepin.PageModel
|
|||||||
public async Task RefreshCommandExecute()
|
public async Task RefreshCommandExecute()
|
||||||
{
|
{
|
||||||
if(_API.IsConnected)
|
if(_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await LoadAPIData().ConfigureAwait(true);
|
await LoadAPIData().ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
IsRefreshing = false;
|
IsRefreshing = false;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace Borepin.PageModel
|
|||||||
List<Task> tasks = new List<Task>();
|
List<Task> tasks = new List<Task>();
|
||||||
|
|
||||||
IList<ConnectionData> list = await _LoginStorageService.GetList().ConfigureAwait(false);
|
IList<ConnectionData> list = await _LoginStorageService.GetList().ConfigureAwait(false);
|
||||||
if (_API.IsConnected)
|
if (_API.IsConnected || _API.IsConnecting)
|
||||||
{
|
{
|
||||||
ActiveConnection = new ServerListItemViewModel(_NavigationService, _PageDialogService);
|
ActiveConnection = new ServerListItemViewModel(_NavigationService, _PageDialogService);
|
||||||
await ActiveConnection.LoadInstance(_API.ConnectionData).ConfigureAwait(false);
|
await ActiveConnection.LoadInstance(_API.ConnectionData).ConfigureAwait(false);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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;
|
||||||
@ -22,14 +23,16 @@ namespace Borepin.PageModel
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
private readonly IDialogService _DialogService;
|
private readonly IDialogService _DialogService;
|
||||||
private readonly ILoginStorageService _LoginStorageService;
|
private readonly ILoginStorageService _LoginStorageService;
|
||||||
|
private readonly IErrorMessageService _ErrorMessageService;
|
||||||
private bool IsDialog = false;
|
private bool IsDialog = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#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;
|
_DialogService = dialogService;
|
||||||
_LoginStorageService = loginStorageService;
|
_LoginStorageService = loginStorageService;
|
||||||
|
_ErrorMessageService = errorMessageService;
|
||||||
|
|
||||||
ConnectCommand = new DelegateCommand(async () => await ConnectCommandExecute().ConfigureAwait(false));
|
ConnectCommand = new DelegateCommand(async () => await ConnectCommandExecute().ConfigureAwait(false));
|
||||||
DisconnectCommand = new DelegateCommand(async () => await DisonnectCommandExecute().ConfigureAwait(false));
|
DisconnectCommand = new DelegateCommand(async () => await DisonnectCommandExecute().ConfigureAwait(false));
|
||||||
@ -52,7 +55,7 @@ namespace Borepin.PageModel
|
|||||||
throw new InstanceIncorrectException();
|
throw new InstanceIncorrectException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_API.IsConnected && Connection_Item != null)
|
if((_API.IsConnected || _API.IsConnecting) && Connection_Item != null)
|
||||||
{
|
{
|
||||||
InstanceIsActiveConnection = Connection_Item.Equals(_API.ConnectionData);
|
InstanceIsActiveConnection = Connection_Item.Equals(_API.ConnectionData);
|
||||||
}
|
}
|
||||||
@ -125,31 +128,16 @@ namespace Borepin.PageModel
|
|||||||
if(_API.IsConnected)
|
if(_API.IsConnected)
|
||||||
{
|
{
|
||||||
await _API.Disconnect().ConfigureAwait(true);
|
await _API.Disconnect().ConfigureAwait(true);
|
||||||
_API.UnbindEventHandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _API.Connect(Connection_Item).ConfigureAwait(false);
|
await _API.Connect(Connection_Item).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch(ConnectionException)
|
catch(Exception exception)
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||||
{
|
|
||||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
|
||||||
|
|
||||||
IsBusy = 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Borepin.Base;
|
using Borepin.Base;
|
||||||
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;
|
||||||
@ -19,12 +20,14 @@ namespace Borepin.PageModel
|
|||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
private readonly ILoginStorageService _LoginStorageService;
|
private readonly ILoginStorageService _LoginStorageService;
|
||||||
|
private readonly IErrorMessageService _ErrorMessageService;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#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;
|
_LoginStorageService = loginStorageService;
|
||||||
|
_ErrorMessageService = errorMessageService;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -70,33 +73,9 @@ namespace Borepin.PageModel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (ConnectionException)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(async () =>
|
_ErrorMessageService.DisplayConnectFailedMessage(exception);
|
||||||
{
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_API.IsConnected == false)
|
if (_API.IsConnected == false)
|
||||||
|
@ -89,9 +89,16 @@ namespace Borepin.PageModel
|
|||||||
public async Task RefreshCommandExecute()
|
public async Task RefreshCommandExecute()
|
||||||
{
|
{
|
||||||
if(_API.IsConnected)
|
if(_API.IsConnected)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await LoadAPIData().ConfigureAwait(true);
|
await LoadAPIData().ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IsRefreshing = false;
|
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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Unable to authenticate to server. ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Unable to authenticate to server. ähnelt.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Connection failed ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Connection failed ähnelt.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Credentials are invalid. ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Credentials are invalid. ähnelt.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Unable to connect to server. ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Unable to connect to server. ähnelt.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Delete ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Delete ähnelt.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Change Password ähnelt.
|
/// Sucht eine lokalisierte Zeichenfolge, die Change Password ähnelt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -151,39 +151,71 @@ You can also put down several servers and then connect to the desired server.</v
|
|||||||
</data>
|
</data>
|
||||||
<data name="ALERT_AddressInvalid" xml:space="preserve">
|
<data name="ALERT_AddressInvalid" xml:space="preserve">
|
||||||
<value>Server address is invaild.</value>
|
<value>Server address is invaild.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_AddUserFailed" xml:space="preserve">
|
<data name="ALERT_AddUserFailed" xml:space="preserve">
|
||||||
<value>Add User failed</value>
|
<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>
|
||||||
<data name="ALERT_AuthServer" xml:space="preserve">
|
<data name="ALERT_AuthServer" xml:space="preserve">
|
||||||
<value>Unable to authenticate to server.</value>
|
<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>
|
||||||
<data name="ALERT_ConnectionFailed" xml:space="preserve">
|
<data name="ALERT_ConnectionFailed" xml:space="preserve">
|
||||||
<value>Connection failed</value>
|
<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>
|
||||||
<data name="ALERT_CredentialsInvalid" xml:space="preserve">
|
<data name="ALERT_CredentialsInvalid" xml:space="preserve">
|
||||||
<value>Credentials are invalid.</value>
|
<value>Credentials are invalid.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_DuplicateConnection" xml:space="preserve">
|
<data name="ALERT_DuplicateConnection" xml:space="preserve">
|
||||||
<value>Connection already exist. Please delete old Connection before adding the new Connection.</value>
|
<value>Connection already exist. Please delete old Connection before adding the new Connection.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_PasswordInvalid" xml:space="preserve">
|
<data name="ALERT_PasswordInvalid" xml:space="preserve">
|
||||||
<value>Password is invalid.</value>
|
<value>Password is invalid.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_QRInvalid" xml:space="preserve">
|
<data name="ALERT_QRInvalid" xml:space="preserve">
|
||||||
<value>QR Code is invalid</value>
|
<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>
|
||||||
<data name="ALERT_UnableServer" xml:space="preserve">
|
<data name="ALERT_UnableServer" xml:space="preserve">
|
||||||
<value>Unable to connect to server.</value>
|
<value>Unable to connect to server.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_UnexpectedError" xml:space="preserve">
|
<data name="ALERT_UnexpectedError" xml:space="preserve">
|
||||||
<value>Unexpected Error.</value>
|
<value>Unexpected Error.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_UserExist" xml:space="preserve">
|
<data name="ALERT_UserExist" xml:space="preserve">
|
||||||
<value>User allready exist.</value>
|
<value>User allready exist.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ALERT_UsernameInvalid" xml:space="preserve">
|
<data name="ALERT_UsernameInvalid" xml:space="preserve">
|
||||||
<value>Username is invalid.</value>
|
<value>Username is invalid.</value>
|
||||||
|
<comment>Message Content</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="Bionade" xml:space="preserve">
|
<data name="Bionade" xml:space="preserve">
|
||||||
<value>It's Bionade</value>
|
<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">
|
<data name="CONFIRM" xml:space="preserve">
|
||||||
<value>Confirm</value>
|
<value>Confirm</value>
|
||||||
</data>
|
</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">
|
<data name="DELETE" xml:space="preserve">
|
||||||
<value>Delete</value>
|
<value>Delete</value>
|
||||||
</data>
|
</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">
|
<data name="PASSWORD" xml:space="preserve">
|
||||||
<value>Password</value>
|
<value>Password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="PLEASECONNECTTOSERVER" xml:space="preserve">
|
|
||||||
<value>Please connect to Server</value>
|
|
||||||
</data>
|
|
||||||
<data name="ProfilePage_ChangePassword" xml:space="preserve">
|
<data name="ProfilePage_ChangePassword" xml:space="preserve">
|
||||||
<value>Change Password</value>
|
<value>Change Password</value>
|
||||||
</data>
|
</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">
|
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||||
<ContentView.Resources>
|
<ContentView.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
|
<converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
|
||||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||||
<converters:ListNotEmptyConverter x:Key="ListNotEmptyConverter"/>
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</ContentView.Resources>
|
</ContentView.Resources>
|
||||||
<ContentView.Content>
|
<ContentView.Content>
|
||||||
@ -15,12 +15,17 @@
|
|||||||
<StackLayout IsVisible="{Binding IsBusy}">
|
<StackLayout IsVisible="{Binding IsBusy}">
|
||||||
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
|
||||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
<StackLayout>
|
||||||
<Label Text="No Connection to Server"/>
|
<StackLayout.IsVisible>
|
||||||
<Label Text="Connecting to Server ..." IsVisible="{Binding IsConnecting}"/>
|
<MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
|
||||||
<Label Text="Please select a Server." IsVisible="{Binding IsConnecting, Converter={StaticResource InvertBoolConverter}}"/>
|
<Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
|
||||||
</StackLayout>
|
<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>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentView.Content>
|
</ContentView.Content>
|
||||||
|
@ -290,8 +290,6 @@ namespace FabAccessAPI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="ConnectionException"> When API-Service can not connect to a server </exception>
|
/// <exception cref="ConnectionException"> When API-Service can not connect to a server </exception>
|
||||||
public async Task<ServerData> TryToConnect(ConnectionData connectionData, TcpRpcClient tcpRpcClient = null)
|
public async Task<ServerData> TryToConnect(ConnectionData connectionData, TcpRpcClient tcpRpcClient = null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if (tcpRpcClient == null)
|
if (tcpRpcClient == null)
|
||||||
{
|
{
|
||||||
@ -307,11 +305,6 @@ namespace FabAccessAPI
|
|||||||
|
|
||||||
return serverData;
|
return serverData;
|
||||||
}
|
}
|
||||||
catch(System.Exception ex)
|
|
||||||
{
|
|
||||||
throw new ConnectionException("Test Connection Failed", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Public Wrapper to run HeartbeatAsync
|
/// Public Wrapper to run HeartbeatAsync
|
||||||
@ -357,7 +350,7 @@ namespace FabAccessAPI
|
|||||||
sslStream.AuthenticateAsClient("bffhd");
|
sslStream.AuthenticateAsClient("bffhd");
|
||||||
return sslStream;
|
return sslStream;
|
||||||
}
|
}
|
||||||
catch (AuthenticationException exception)
|
catch (System.Security.Authentication.AuthenticationException exception)
|
||||||
{
|
{
|
||||||
sslStream.Close();
|
sslStream.Close();
|
||||||
Log.Warn(exception);
|
Log.Warn(exception);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user