mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-03-12 14:51:44 +01:00
Merge branch 'feature/user' into 'main'
Feature/user See merge request fabinfra/fabaccess/borepin!57
This commit is contained in:
commit
5ca2e66443
@ -47,6 +47,11 @@ namespace Borepin
|
||||
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ScanURNPage, ScanURNPageModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<UserListPage, UserListPageModel>();
|
||||
containerRegistry.RegisterForNavigation<UserPage, UserPageModel>();
|
||||
containerRegistry.RegisterForNavigation<AddUserPage, AddUserPageModel>();
|
||||
containerRegistry.RegisterForNavigation<ProfilePage, ProfilePageModel>();
|
||||
#endregion
|
||||
|
||||
#region Register Sequence Navigation
|
||||
|
@ -13,11 +13,14 @@ namespace Borepin.Base
|
||||
{
|
||||
#region Private Fields
|
||||
protected readonly IAPI _API;
|
||||
protected readonly IAPIService _APIService;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
protected ConnectionModelBase(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService)
|
||||
{
|
||||
_APIService = apiService;
|
||||
|
||||
_API = apiService.GetAPI();
|
||||
_API.ConnectionStatusChanged += OnConnectionStatusChanged;
|
||||
|
||||
|
@ -56,6 +56,9 @@
|
||||
<Compile Update="Page\ScanURNPage.xaml.cs">
|
||||
<DependentUpon>ScanURNPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Page\ProfilePage.xaml.cs">
|
||||
<DependentUpon>ProfilePage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Page\UserPage.xaml.cs">
|
||||
<DependentUpon>UserPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -108,6 +111,9 @@
|
||||
<EmbeddedResource Update="Page\AddServerProcess\AuthPlainPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\AddUserPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Page\MachinePage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
@ -142,6 +148,9 @@
|
||||
<EmbeddedResource Update="View\IsBusyView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="View\PermissionSelectView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="View\ScanView.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
@ -2,13 +2,14 @@
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Dialog.ConfirmDialog"
|
||||
BackgroundColor="White">
|
||||
BackgroundColor="White"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||
<ContentView.Content>
|
||||
<StackLayout Background="{StaticResource EighthColor}" Padding="10">
|
||||
<Label Text="{Binding Title}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<Label Text="{Binding Message}" Style="{StaticResource Style_Label_Property_Text}"/>
|
||||
<Button Text="Confirm" Command="{Binding ConfirmCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="Abort" Command="{Binding AbortCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.CONFIRM}" Command="{Binding ConfirmCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding AbortCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -2,11 +2,12 @@
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:zxing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"
|
||||
x:Class="Borepin.Dialog.ScanDialog">
|
||||
x:Class="Borepin.Dialog.ScanDialog"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||
<ContentView.Content>
|
||||
<StackLayout IsVisible="{Binding IsVisible}">
|
||||
<zxing:ZXingScannerView Result="{Binding ScanResult, Mode=TwoWay}" ScanResultCommand="{Binding ScannedCommand}" IsScanning="{Binding IsScanning}" WidthRequest="300" HeightRequest="500" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"/>
|
||||
<Button Text="Abort" Command="{Binding AbortCommand}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.CANCEL}" Command="{Binding AbortCommand}"/>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
@ -1,4 +1,4 @@
|
||||
using FabAccessAPI.Schema;
|
||||
using FabAccessAPI.Schema;
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace Borepin.Model
|
||||
|
@ -4,7 +4,7 @@
|
||||
x:Class="Borepin.Page.AddServerProcess.AuthPlainPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Connect to Server">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_ConnectToServer}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
|
@ -4,7 +4,7 @@
|
||||
x:Class="Borepin.Page.AddServerProcess.ChooseAuthTypePage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Connect to Server">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_ConnectToServer}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
|
@ -4,7 +4,7 @@
|
||||
x:Class="Borepin.Page.AddServerProcess.SelectServerPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Connect to Server">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_ConnectToServer}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
|
32
Borepin/Borepin/Page/AddUserPage.xaml
Normal file
32
Borepin/Borepin/Page/AddUserPage.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.AddUserPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_AddUser}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<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}">
|
||||
<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>
|
20
Borepin/Borepin/Page/AddUserPage.xaml.cs
Normal file
20
Borepin/Borepin/Page/AddUserPage.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.Page
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class AddUserPage : ContentPage
|
||||
{
|
||||
public AddUserPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
x:Class="Borepin.Page.MachineListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
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>
|
||||
|
@ -4,7 +4,7 @@
|
||||
x:Class="Borepin.Page.MachinePage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
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>
|
||||
|
@ -2,15 +2,19 @@
|
||||
<FlyoutPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.MainPage"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="MainPage">
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||
<FlyoutPage.Flyout>
|
||||
<ContentPage Title="FabAccess" BackgroundColor="{StaticResource SecondColor}">
|
||||
<StackLayout>
|
||||
<StackLayout Margin="0,50,0,0" VerticalOptions="FillAndExpand">
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Machines}" Command="{Binding NavigateCommand}" CommandParameter="MachineListPage" VerticalOptions="Start" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Users}" IsVisible="{Binding CanManageUsers}" Command="{Binding NavigateCommand}" CommandParameter="UserListPage" VerticalOptions="Start" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Servers}" Command="{Binding NavigateCommand}" CommandParameter="ServerListPage" VerticalOptions="Start" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Machines}" Command="{Binding NavigateCommand}" CommandParameter="MachineListPage" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Users}" IsVisible="{Binding CanManageUsers}" Command="{Binding NavigateCommand}" CommandParameter="UserListPage" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}"/>
|
||||
</StackLayout>
|
||||
<StackLayout Margin="0,50,0,50">
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Servers}" Command="{Binding NavigateCommand}" CommandParameter="ServerListPage" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" VerticalOptions="End"/>
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<Button Text="{x:Static resource_text:TextResource.MainPage_Profile}" Command="{Binding NavigateCommand}" CommandParameter="ProfilePage" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" VerticalOptions="End"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
<StackLayout Margin="0,0,0,10">
|
||||
<Label Text="{Binding CurrentVersion, StringFormat='Version: {0}'}" VerticalOptions="End" Margin="10,0,0,0" TextColor="{StaticResource FirstColor}"/>
|
||||
|
32
Borepin/Borepin/Page/ProfilePage.xaml
Normal file
32
Borepin/Borepin/Page/ProfilePage.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
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"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Profile}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<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}">
|
||||
<Label Text="{Binding UserItem.Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<Label Text="{x:Static resource_text:TextResource.ProfilePage_ChangePassword}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||
<Entry Placeholder="{x:Static resource_text:TextResource.ProfilePage_OldPassword}" Text="{Binding OldPassword}"/>
|
||||
<Entry Placeholder="{x:Static resource_text:TextResource.ProfilePage_NewPassword}" Text="{Binding NewPassword}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.ProfilePage_UpdatePassword}" Command="{Binding UpdatePasswordCommand}" 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>
|
15
Borepin/Borepin/Page/ProfilePage.xaml.cs
Normal file
15
Borepin/Borepin/Page/ProfilePage.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.Page
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class ProfilePage : ContentPage
|
||||
{
|
||||
public ProfilePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
x:Class="Borepin.Page.ServerListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Servers">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Servers}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
|
@ -4,7 +4,7 @@
|
||||
x:Class="Borepin.Page.ServerPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Server">
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Server}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.SetUpProcess.WelcomePage"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="FabAccess">
|
||||
Title="{x:Static resource_text:TextResource.FABACCESS}">
|
||||
<ContentPage.Content>
|
||||
<ScrollView>
|
||||
<StackLayout Style="{StaticResource Style_StackLayout_Content}">
|
||||
|
@ -2,7 +2,8 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.SettingsPage"
|
||||
Title="Settings">
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Settings}">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="Settings Page"
|
||||
|
@ -2,8 +2,7 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.StartPage"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="Start">
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
|
||||
<ContentPage.Content>
|
||||
<StackLayout Padding="20">
|
||||
<StackLayout IsVisible="{Binding IsBusy}" VerticalOptions="CenterAndExpand">
|
||||
|
@ -4,7 +4,8 @@
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
x:Class="Borepin.Page.UserListPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
Title="Machines">
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_Users}">
|
||||
<NavigationPage.TitleView>
|
||||
<Button Text="Refresh" HorizontalOptions="End" BackgroundColor="{StaticResource SecondColor}" TextColor="{StaticResource FirstColor}" Command="{Binding RefreshCommand}"/>
|
||||
</NavigationPage.TitleView>
|
||||
@ -21,6 +22,7 @@
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<Button Text="{x:Static resource_text:TextResource.UserListPage_AddUser}" Command="{Binding AddUserCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<ListView ItemsSource="{Binding UserListItemViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@ -32,7 +34,7 @@
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
<StackLayout IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}">
|
||||
<Label Text="Please connect to Server" ></Label>
|
||||
<Label Text="{x:Static resource_text:TextResource.PLEASECONNECTTOSERVER}"/>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
|
@ -2,8 +2,10 @@
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.Page.UserPage"
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
Title="Machine">
|
||||
xmlns:converters="clr-namespace:Borepin.Converter"
|
||||
xmlns:views="clr-namespace:Borepin.View"
|
||||
xmlns:resource_text="clr-namespace:Borepin.Resources.Text"
|
||||
Title="{x:Static resource_text:TextResource.TITLE_User}">
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<converters:MachineStateColorConverter x:Key="MachineStateColorConverter"/>
|
||||
@ -20,8 +22,23 @@
|
||||
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
|
||||
<StackLayout IsVisible="{Binding IsConnected}">
|
||||
<Label Text="{Binding UserItem.Username}" Style="{StaticResource LabelStyle_Title}"/>
|
||||
<ListView ItemsSource="{Binding PermissionSelectViewModel_List}" SelectionMode="None" SeparatorColor="Transparent">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<views:PermissionSelectView />
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<Label Text="{x:Static resource_text:TextResource.UserPage_ChangePassword}" Style="{StaticResource Style_Label_Property_Title}"/>
|
||||
<Entry Placeholder="{x:Static resource_text:TextResource.UserPage_NewPassword}" Text="{Binding NewPassword}"/>
|
||||
<Button Text="{x:Static resource_text:TextResource.UserPage_UpdatePassword}" Command="{Binding UpdatePasswordCommand}" Style="{StaticResource Style_Button_Primary}"/>
|
||||
<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>
|
||||
<Label Text="Please connect to Server" IsVisible="{Binding IsConnected, Converter={StaticResource InvertBoolConverter}}"></Label>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
|
@ -6,6 +6,7 @@ using Borepin.Base;
|
||||
using Borepin.Base.Exceptions;
|
||||
using Borepin.Service;
|
||||
using Borepin.Service.Storage;
|
||||
using Borepin.Service.Storage.Exceptions;
|
||||
using FabAccessAPI;
|
||||
using FabAccessAPI.Exceptions;
|
||||
using Prism.Commands;
|
||||
@ -104,7 +105,7 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
@ -114,7 +115,7 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
@ -124,16 +125,15 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unexpected Error.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnexpectedError, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await _LoginStorageService.Add(_ConnectionData).ConfigureAwait(false);
|
||||
await _LoginStorageService.UpdateTimestamp(_ConnectionData).ConfigureAwait(false);
|
||||
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
INavigationResult result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/MachineListPage").ConfigureAwait(false);
|
||||
|
@ -107,7 +107,7 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Server address is invaild.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AddressInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
@ -124,7 +124,7 @@ namespace Borepin.PageModel.AddServerProcess
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
|
116
Borepin/Borepin/PageModel/AddUserPageModel.cs
Normal file
116
Borepin/Borepin/PageModel/AddUserPageModel.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using Borepin.Base;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using System.Windows.Input;
|
||||
using FabAccessAPI.Schema;
|
||||
using Prism.Services;
|
||||
using Borepin.Service;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using static FabAccessAPI.Schema.UserSystem.ManageInterface;
|
||||
using static FabAccessAPI.Schema.UserSystem.ManageInterface.AddUserError;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class AddUserPageModel : ConnectionModelBase
|
||||
{
|
||||
#region Contructors
|
||||
public AddUserPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
AddUserCommand = new DelegateCommand(AddUserCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private string _Username;
|
||||
public string Username
|
||||
{
|
||||
get => _Username;
|
||||
set => SetProperty(ref _Username, value);
|
||||
}
|
||||
|
||||
private string _Password;
|
||||
public string Password
|
||||
{
|
||||
get => _Password;
|
||||
set => SetProperty(ref _Password, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private ICommand _AddUserCommand;
|
||||
|
||||
public ICommand AddUserCommand
|
||||
{
|
||||
get => _AddUserCommand;
|
||||
set => SetProperty(ref _AddUserCommand, value);
|
||||
}
|
||||
|
||||
public async void AddUserCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
|
||||
if(_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
Fallible<User, AddUserError> user_result = await _API.Session.UserSystem.Manage.AddUserFallible(Username, Password).ConfigureAwait(false);
|
||||
if(user_result.Failed != null)
|
||||
{
|
||||
switch(user_result.Failed.Error)
|
||||
{
|
||||
case AddUserErrorEnum.alreadyExists:
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_UserExist, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
break;
|
||||
case AddUserErrorEnum.usernameInvalid:
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_UsernameInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
break;
|
||||
case AddUserErrorEnum.passwordInvalid:
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_AddUserFailed, Resources.Text.TextResource.ALERT_PasswordInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationParameters parameters = new NavigationParameters
|
||||
{
|
||||
{ "instance", user_result.Successful.Username },
|
||||
};
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
INavigationResult result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/UserListPage/UserPage", parameters).ConfigureAwait(false);
|
||||
if (result.Exception != null)
|
||||
{
|
||||
Log.Fatal(result.Exception, "Navigating failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||
{
|
||||
Log.Debug("RPC Connection Loss");
|
||||
}
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -134,11 +134,17 @@ namespace Borepin.PageModel
|
||||
|
||||
if (_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
Machine.IManageInterface manageInterface = _Machine.Manage;
|
||||
|
||||
Machine.IManageInterface manageInterface = _Machine.Manage;
|
||||
|
||||
await manageInterface.ForceFree().ConfigureAwait(false);
|
||||
await LoadAPIData().ConfigureAwait(false);
|
||||
await manageInterface.ForceFree().ConfigureAwait(false);
|
||||
await LoadAPIData().ConfigureAwait(false);
|
||||
}
|
||||
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||
{
|
||||
Log.Debug("RPC Connection Loss");
|
||||
}
|
||||
}
|
||||
|
||||
IsBusy = false;
|
||||
|
@ -30,8 +30,8 @@ namespace Borepin.PageModel
|
||||
#region LoadData
|
||||
public override Task LoadAPIData()
|
||||
{
|
||||
//UserSystem.ManageInterface_Proxy manageInterface = (UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage;
|
||||
//CanManageUsers = !manageInterface.IsNull;
|
||||
UserSystem.ManageInterface_Proxy manageInterface = (UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage;
|
||||
CanManageUsers = !manageInterface.IsNull;
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
98
Borepin/Borepin/PageModel/ProfilePageModel.cs
Normal file
98
Borepin/Borepin/PageModel/ProfilePageModel.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using Borepin.Base;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using FabAccessAPI.Schema;
|
||||
using Borepin.Model;
|
||||
using Prism.Services;
|
||||
using Borepin.Service;
|
||||
using Borepin.Base.Exceptions;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using Borepin.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using NaturalSort.Extension;
|
||||
using System.Linq;
|
||||
using Prism.Services.Dialogs;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
public class ProfilePageModel : ConnectionModelBase
|
||||
{
|
||||
#region Contructors
|
||||
public ProfilePageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
UpdatePasswordCommand = new DelegateCommand(UpdatePasswordCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
public override Task LoadInstance(object instance)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task LoadAPIData()
|
||||
{
|
||||
_UserItem = new UserVisualize(await _API.Session.UserSystem.Info.GetUserSelf().ConfigureAwait(false));
|
||||
_UserItem.LoadData();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
private UserVisualize _UserItem;
|
||||
public UserVisualize UserItem
|
||||
{
|
||||
get => _UserItem;
|
||||
set => SetProperty(ref _UserItem, value);
|
||||
}
|
||||
|
||||
private string _OldPassword = null;
|
||||
public string OldPassword
|
||||
{
|
||||
get => _OldPassword;
|
||||
set => SetProperty(ref _OldPassword, value);
|
||||
}
|
||||
|
||||
private string _NewPassword = null;
|
||||
public string NewPassword
|
||||
{
|
||||
get => _NewPassword;
|
||||
set => SetProperty(ref _NewPassword, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private ICommand _UpdatePasswordCommand;
|
||||
public ICommand UpdatePasswordCommand
|
||||
{
|
||||
get => _UpdatePasswordCommand;
|
||||
set => SetProperty(ref _UpdatePasswordCommand, value);
|
||||
}
|
||||
|
||||
public async void UpdatePasswordCommandExecute()
|
||||
{
|
||||
IsBusy = true;
|
||||
if (_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(OldPassword != null && OldPassword != string.Empty && NewPassword != null && NewPassword != string.Empty)
|
||||
{
|
||||
User self = await _API.Session.UserSystem.Info.GetUserSelf().ConfigureAwait(false);
|
||||
await self.Manage.Pwd(OldPassword, NewPassword).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||
{
|
||||
Log.Debug("RPC Connection Loss");
|
||||
}
|
||||
}
|
||||
IsBusy = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -84,7 +84,7 @@ namespace Borepin.PageModel
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("YAY", "It's Bionade", "OK").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.YAY, Resources.Text.TextResource.Bionade, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
IsScanning = true;
|
||||
});
|
||||
return;
|
||||
@ -109,7 +109,7 @@ namespace Borepin.PageModel
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Alert", "QR Code is invalid", "OK").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT, Resources.Text.TextResource.Alert_QRInvalid, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
IsScanning = true;
|
||||
});
|
||||
return;
|
||||
|
@ -135,7 +135,7 @@ namespace Borepin.PageModel
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to connect to server.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_UnableServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
@ -145,7 +145,7 @@ namespace Borepin.PageModel
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok").ConfigureAwait(false);
|
||||
await _PageDialogService.DisplayAlertAsync(Resources.Text.TextResource.ALERT_ConnectionFailed, Resources.Text.TextResource.ALERT_AuthServer, Resources.Text.TextResource.OK).ConfigureAwait(false);
|
||||
|
||||
IsBusy = false;
|
||||
});
|
||||
@ -201,8 +201,8 @@ namespace Borepin.PageModel
|
||||
{
|
||||
DialogParameters parameters = new DialogParameters
|
||||
{
|
||||
{ "title", "Delete Server" },
|
||||
{ "message", "Do you really want to delete this Server?" },
|
||||
{ "title", Resources.Text.TextResource.DIALOG_DeleteServer },
|
||||
{ "message", Resources.Text.TextResource.DIALOG_DeleteServerConfirm },
|
||||
{ "instance", Connection_Item },
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@ using System;
|
||||
using NaturalSort.Extension;
|
||||
using System.Linq;
|
||||
using Borepin.Service;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
@ -20,6 +21,7 @@ namespace Borepin.PageModel
|
||||
public UserListPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
RefreshCommand = new DelegateCommand(async ()=> await RefreshCommandExecute().ConfigureAwait(true));
|
||||
AddUserCommand = new DelegateCommand(AddUserCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -36,7 +38,7 @@ namespace Borepin.PageModel
|
||||
viewmodel_list.Add(new_viewmodel);
|
||||
}
|
||||
|
||||
user_list.OrderBy(x => x.Username, StringComparison.OrdinalIgnoreCase.WithNaturalSort());
|
||||
viewmodel_list.OrderBy(x => x.Instance.Username, StringComparison.OrdinalIgnoreCase.WithNaturalSort());
|
||||
UserListItemViewModel_List = viewmodel_list;
|
||||
}
|
||||
#endregion
|
||||
@ -73,6 +75,24 @@ namespace Borepin.PageModel
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
||||
private ICommand _AddUserCommand;
|
||||
public ICommand AddUserCommand
|
||||
{
|
||||
get => _AddUserCommand;
|
||||
set => SetProperty(ref _AddUserCommand, value);
|
||||
}
|
||||
public void AddUserCommandExecute()
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
INavigationResult result = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/AddUserPage").ConfigureAwait(false);
|
||||
if (result.Exception != null)
|
||||
{
|
||||
Log.Fatal(result.Exception, "Navigating failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,12 @@ using Borepin.Service;
|
||||
using Borepin.Base.Exceptions;
|
||||
using Capnp.Rpc;
|
||||
using System;
|
||||
using Borepin.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using NaturalSort.Extension;
|
||||
using System.Linq;
|
||||
using Prism.Services.Dialogs;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Borepin.PageModel
|
||||
{
|
||||
@ -18,12 +24,16 @@ namespace Borepin.PageModel
|
||||
#region Private Fields
|
||||
private string _ID;
|
||||
private User _User;
|
||||
private IDialogService _DialogService;
|
||||
private bool _IsDialog;
|
||||
#endregion
|
||||
|
||||
#region Contructors
|
||||
public UserPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
||||
public UserPageModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService, IDialogService dialogService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
|
||||
_DialogService = dialogService;
|
||||
DeleteCommand = new DelegateCommand(DeleteCommandExecute);
|
||||
UpdatePasswordCommand = new DelegateCommand(UpdatePasswordCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -33,6 +43,10 @@ namespace Borepin.PageModel
|
||||
if(instance is string)
|
||||
{
|
||||
_ID = instance as string;
|
||||
}
|
||||
else if(instance == null && _IsDialog)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -44,23 +58,144 @@ namespace Borepin.PageModel
|
||||
|
||||
public override async Task LoadAPIData()
|
||||
{
|
||||
if(_IsDialog)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_User = (await _API.Session.UserSystem.Search.GetUserByName(_ID).ConfigureAwait(false)).Just;
|
||||
UserItem = new UserVisualize(_User);
|
||||
UserItem.LoadData();
|
||||
|
||||
IReadOnlyList<Role> role_list = await _API.Session.PermissionSystem.Info.GetRoleList().ConfigureAwait(false);
|
||||
List<Role> user_role_list = new List<Role>(await _User.Info.ListRoles().ConfigureAwait(false));
|
||||
|
||||
List<PermissionSelectViewModel> viewmodel_list = new List<PermissionSelectViewModel>();
|
||||
foreach (Role role in role_list)
|
||||
{
|
||||
PermissionSelectViewModel new_viewmodel = new PermissionSelectViewModel(_NavigationService, _PageDialogService, _APIService);
|
||||
object[] array = new object[]
|
||||
{
|
||||
role,
|
||||
_User,
|
||||
user_role_list.Exists(x => string.Equals(x.Name, role.Name, StringComparison.Ordinal))
|
||||
};
|
||||
|
||||
await new_viewmodel.LoadInstance(array).ConfigureAwait(false);
|
||||
viewmodel_list.Add(new_viewmodel);
|
||||
}
|
||||
|
||||
viewmodel_list.OrderBy(x => x.RoleName, StringComparison.OrdinalIgnoreCase.WithNaturalSort());
|
||||
PermissionSelectViewModel_List = viewmodel_list;
|
||||
|
||||
CanAdmin = !((UserSystem.ManageInterface_Proxy)_API.Session.UserSystem.Manage).IsNull;
|
||||
CanManage = !((User.ManageInterface_Proxy)_User.Manage).IsNull;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private IList<PermissionSelectViewModel> _PermissionSelectViewModel_List;
|
||||
public IList<PermissionSelectViewModel> PermissionSelectViewModel_List
|
||||
{
|
||||
get => _PermissionSelectViewModel_List;
|
||||
set => SetProperty(ref _PermissionSelectViewModel_List, value);
|
||||
}
|
||||
|
||||
private UserVisualize _UserItem;
|
||||
public UserVisualize UserItem
|
||||
{
|
||||
get => _UserItem;
|
||||
set => SetProperty(ref _UserItem, value);
|
||||
}
|
||||
|
||||
private bool _CanAdmin;
|
||||
public bool CanAdmin
|
||||
{
|
||||
get => _CanAdmin;
|
||||
set => SetProperty(ref _CanAdmin, value);
|
||||
}
|
||||
|
||||
private bool _CanManage;
|
||||
public bool CanManage
|
||||
{
|
||||
get => _CanManage;
|
||||
set => SetProperty(ref _CanManage, value);
|
||||
}
|
||||
|
||||
private string _NewPassword;
|
||||
public string NewPassword
|
||||
{
|
||||
get => _NewPassword;
|
||||
set => SetProperty(ref _NewPassword, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
|
||||
private ICommand _DeleteCommand;
|
||||
public ICommand DeleteCommand
|
||||
{
|
||||
get => _DeleteCommand;
|
||||
set => SetProperty(ref _DeleteCommand, value);
|
||||
}
|
||||
|
||||
public void DeleteCommandExecute()
|
||||
{
|
||||
_IsDialog = true;
|
||||
|
||||
DialogParameters parameters = new DialogParameters
|
||||
{
|
||||
{ "title", Resources.Text.TextResource.DIALOG_DeleteUser },
|
||||
{ "message", Resources.Text.TextResource.DIALOG_DeleteUserConfirm },
|
||||
{ "instance", _User },
|
||||
};
|
||||
|
||||
_DialogService.ShowDialog("ConfirmDialog", parameters, DeleteCommandExecute_Dialog);
|
||||
}
|
||||
|
||||
public async void DeleteCommandExecute_Dialog(IDialogResult result)
|
||||
{
|
||||
if (string.Equals(result.Parameters.GetValue<string>("result"), "confirm", StringComparison.Ordinal))
|
||||
{
|
||||
IsBusy = true;
|
||||
if (_API.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(PermissionSelectViewModel viewModel in PermissionSelectViewModel_List)
|
||||
{
|
||||
viewModel.Dispose();
|
||||
}
|
||||
|
||||
await _API.Session.UserSystem.Manage.RemoveUser(_User).ConfigureAwait(false);
|
||||
|
||||
Device.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
INavigationResult result_nav = await _NavigationService.NavigateAsync("/MainPage/NavigationPage/UserListPage").ConfigureAwait(false);
|
||||
if (result_nav.Exception != null)
|
||||
{
|
||||
Log.Fatal(result.Exception, "Navigating failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||
{
|
||||
Log.Debug("RPC Connection Loss");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _UpdatePasswordCommand;
|
||||
public ICommand UpdatePasswordCommand
|
||||
{
|
||||
get => _UpdatePasswordCommand;
|
||||
set => SetProperty(ref _UpdatePasswordCommand, value);
|
||||
}
|
||||
|
||||
public void UpdatePasswordCommandExecute()
|
||||
{
|
||||
_User.Manage.Pwd(null, NewPassword);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
394
Borepin/Borepin/Resources/Text/TextResource.Designer.cs
generated
394
Borepin/Borepin/Resources/Text/TextResource.Designer.cs
generated
@ -124,7 +124,9 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to PLACEHOLDER.
|
||||
/// Looks up a localized string similar to FabAccess is a decentralized machine management system. Each Space thus uses its own server.
|
||||
///Ask your Space for the address of your server.
|
||||
///You can also put down several servers and then connect to the desired server..
|
||||
/// </summary>
|
||||
internal static string AddServerProcess_SelectServerPage_Info {
|
||||
get {
|
||||
@ -132,6 +134,141 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add User.
|
||||
/// </summary>
|
||||
internal static string AddUserPage_AddUser {
|
||||
get {
|
||||
return ResourceManager.GetString("AddUserPage_AddUser", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Alert.
|
||||
/// </summary>
|
||||
internal static string ALERT {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server address is invaild..
|
||||
/// </summary>
|
||||
internal static string ALERT_AddressInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_AddressInvalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add User failed.
|
||||
/// </summary>
|
||||
internal static string ALERT_AddUserFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_AddUserFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unable to authenticate to server..
|
||||
/// </summary>
|
||||
internal static string ALERT_AuthServer {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_AuthServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connection failed.
|
||||
/// </summary>
|
||||
internal static string ALERT_ConnectionFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_ConnectionFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connection already exist. Please delete old Connection before adding the new Connection..
|
||||
/// </summary>
|
||||
internal static string ALERT_DuplicateConnection {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_DuplicateConnection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password is invalid..
|
||||
/// </summary>
|
||||
internal static string ALERT_PasswordInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_PasswordInvalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to QR Code is invalid.
|
||||
/// </summary>
|
||||
internal static string Alert_QRInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString("Alert_QRInvalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unable to connect to server..
|
||||
/// </summary>
|
||||
internal static string ALERT_UnableServer {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_UnableServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unexpected Error..
|
||||
/// </summary>
|
||||
internal static string ALERT_UnexpectedError {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_UnexpectedError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User allready exist..
|
||||
/// </summary>
|
||||
internal static string ALERT_UserExist {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_UserExist", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Username is invalid..
|
||||
/// </summary>
|
||||
internal static string ALERT_UsernameInvalid {
|
||||
get {
|
||||
return ResourceManager.GetString("ALERT_UsernameInvalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to It's Bionade.
|
||||
/// </summary>
|
||||
internal static string Bionade {
|
||||
get {
|
||||
return ResourceManager.GetString("Bionade", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Build.
|
||||
/// </summary>
|
||||
internal static string BUILD {
|
||||
get {
|
||||
return ResourceManager.GetString("BUILD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
@ -141,6 +278,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Confirm.
|
||||
/// </summary>
|
||||
internal static string CONFIRM {
|
||||
get {
|
||||
return ResourceManager.GetString("CONFIRM", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
@ -150,6 +296,51 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete Server.
|
||||
/// </summary>
|
||||
internal static string DIALOG_DeleteServer {
|
||||
get {
|
||||
return ResourceManager.GetString("DIALOG_DeleteServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to "Do you really want to delete this Server?".
|
||||
/// </summary>
|
||||
internal static string DIALOG_DeleteServerConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("DIALOG_DeleteServerConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete User.
|
||||
/// </summary>
|
||||
internal static string DIALOG_DeleteUser {
|
||||
get {
|
||||
return ResourceManager.GetString("DIALOG_DeleteUser", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you really want to delete this User?.
|
||||
/// </summary>
|
||||
internal static string DIALOG_DeleteUserConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("DIALOG_DeleteUserConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to FabAccess.
|
||||
/// </summary>
|
||||
internal static string FABACCESS {
|
||||
get {
|
||||
return ResourceManager.GetString("FABACCESS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host.
|
||||
/// </summary>
|
||||
@ -160,7 +351,8 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to PLACEHOLDER.
|
||||
/// Looks up a localized string similar to You do not have the authorization to use this machine.
|
||||
///Ask in your Space if you can be trained on the machine to be unlocked for the machine..
|
||||
/// </summary>
|
||||
internal static string MachinePage_CanNotUseByPermission {
|
||||
get {
|
||||
@ -240,6 +432,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to My Profile.
|
||||
/// </summary>
|
||||
internal static string MainPage_Profile {
|
||||
get {
|
||||
return ResourceManager.GetString("MainPage_Profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Servers.
|
||||
/// </summary>
|
||||
@ -267,6 +468,15 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Ok.
|
||||
/// </summary>
|
||||
internal static string OK {
|
||||
get {
|
||||
return ResourceManager.GetString("OK", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to or.
|
||||
/// </summary>
|
||||
@ -294,6 +504,42 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Change Password.
|
||||
/// </summary>
|
||||
internal static string ProfilePage_ChangePassword {
|
||||
get {
|
||||
return ResourceManager.GetString("ProfilePage_ChangePassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New Password.
|
||||
/// </summary>
|
||||
internal static string ProfilePage_NewPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("ProfilePage_NewPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Old Password.
|
||||
/// </summary>
|
||||
internal static string ProfilePage_OldPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("ProfilePage_OldPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Update Password.
|
||||
/// </summary>
|
||||
internal static string ProfilePage_UpdatePassword {
|
||||
get {
|
||||
return ResourceManager.GetString("ProfilePage_UpdatePassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Scan QR-Code.
|
||||
/// </summary>
|
||||
@ -429,6 +675,105 @@ namespace Borepin.Resources.Text {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add User.
|
||||
/// </summary>
|
||||
internal static string TITLE_AddUser {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_AddUser", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connect to Server.
|
||||
/// </summary>
|
||||
internal static string TITLE_ConnectToServer {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_ConnectToServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Machine.
|
||||
/// </summary>
|
||||
internal static string TITLE_Machine {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Machine", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Machines.
|
||||
/// </summary>
|
||||
internal static string TITLE_Machines {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Machines", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to My Profile.
|
||||
/// </summary>
|
||||
internal static string TITLE_Profile {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Server.
|
||||
/// </summary>
|
||||
internal static string TITLE_Server {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Server", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Servers.
|
||||
/// </summary>
|
||||
internal static string TITLE_Servers {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Servers", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Settings.
|
||||
/// </summary>
|
||||
internal static string TITLE_Settings {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Settings", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User.
|
||||
/// </summary>
|
||||
internal static string TITLE_User {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_User", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Users.
|
||||
/// </summary>
|
||||
internal static string TITLE_Users {
|
||||
get {
|
||||
return ResourceManager.GetString("TITLE_Users", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add User.
|
||||
/// </summary>
|
||||
internal static string UserListPage_AddUser {
|
||||
get {
|
||||
return ResourceManager.GetString("UserListPage_AddUser", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Username.
|
||||
/// </summary>
|
||||
@ -437,5 +782,50 @@ namespace Borepin.Resources.Text {
|
||||
return ResourceManager.GetString("USERNAME", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Update Password.
|
||||
/// </summary>
|
||||
internal static string UserPage_ChangePassword {
|
||||
get {
|
||||
return ResourceManager.GetString("UserPage_ChangePassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New Password.
|
||||
/// </summary>
|
||||
internal static string UserPage_NewPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("UserPage_NewPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Force Password Update.
|
||||
/// </summary>
|
||||
internal static string UserPage_UpdatePassword {
|
||||
get {
|
||||
return ResourceManager.GetString("UserPage_UpdatePassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Version.
|
||||
/// </summary>
|
||||
internal static string VERSION {
|
||||
get {
|
||||
return ResourceManager.GetString("VERSION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to YAY.
|
||||
/// </summary>
|
||||
internal static string YAY {
|
||||
get {
|
||||
return ResourceManager.GetString("YAY", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,21 +139,85 @@
|
||||
<value>Connect to Server</value>
|
||||
</data>
|
||||
<data name="AddServerProcess_SelectServerPage_Info" xml:space="preserve">
|
||||
<value>PLACEHOLDER</value>
|
||||
<comment>Server Struktur erklären, auf QR-Code hinweisen, ansonsten im Space fragen</comment>
|
||||
<value>FabAccess is a decentralized machine management system. Each Space thus uses its own server.
|
||||
Ask your Space for the address of your server.
|
||||
You can also put down several servers and then connect to the desired server.</value>
|
||||
</data>
|
||||
<data name="AddUserPage_AddUser" xml:space="preserve">
|
||||
<value>Add User</value>
|
||||
</data>
|
||||
<data name="ALERT" xml:space="preserve">
|
||||
<value>Alert</value>
|
||||
</data>
|
||||
<data name="ALERT_AddressInvalid" xml:space="preserve">
|
||||
<value>Server address is invaild.</value>
|
||||
</data>
|
||||
<data name="ALERT_AddUserFailed" xml:space="preserve">
|
||||
<value>Add User failed</value>
|
||||
</data>
|
||||
<data name="ALERT_AuthServer" xml:space="preserve">
|
||||
<value>Unable to authenticate to server.</value>
|
||||
</data>
|
||||
<data name="ALERT_ConnectionFailed" xml:space="preserve">
|
||||
<value>Connection failed</value>
|
||||
</data>
|
||||
<data name="ALERT_DuplicateConnection" xml:space="preserve">
|
||||
<value>Connection already exist. Please delete old Connection before adding the new Connection.</value>
|
||||
</data>
|
||||
<data name="ALERT_PasswordInvalid" xml:space="preserve">
|
||||
<value>Password is invalid.</value>
|
||||
</data>
|
||||
<data name="Alert_QRInvalid" xml:space="preserve">
|
||||
<value>QR Code is invalid</value>
|
||||
</data>
|
||||
<data name="ALERT_UnableServer" xml:space="preserve">
|
||||
<value>Unable to connect to server.</value>
|
||||
</data>
|
||||
<data name="ALERT_UnexpectedError" xml:space="preserve">
|
||||
<value>Unexpected Error.</value>
|
||||
</data>
|
||||
<data name="ALERT_UserExist" xml:space="preserve">
|
||||
<value>User allready exist.</value>
|
||||
</data>
|
||||
<data name="ALERT_UsernameInvalid" xml:space="preserve">
|
||||
<value>Username is invalid.</value>
|
||||
</data>
|
||||
<data name="Bionade" xml:space="preserve">
|
||||
<value>It's Bionade</value>
|
||||
</data>
|
||||
<data name="BUILD" xml:space="preserve">
|
||||
<value>Build</value>
|
||||
</data>
|
||||
<data name="CANCEL" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="CONFIRM" xml:space="preserve">
|
||||
<value>Confirm</value>
|
||||
</data>
|
||||
<data name="DELETE" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
<data name="DIALOG_DeleteServer" xml:space="preserve">
|
||||
<value>Delete Server</value>
|
||||
</data>
|
||||
<data name="DIALOG_DeleteServerConfirm" xml:space="preserve">
|
||||
<value>"Do you really want to delete this Server?"</value>
|
||||
</data>
|
||||
<data name="DIALOG_DeleteUser" xml:space="preserve">
|
||||
<value>Delete User</value>
|
||||
</data>
|
||||
<data name="DIALOG_DeleteUserConfirm" xml:space="preserve">
|
||||
<value>Do you really want to delete this User?</value>
|
||||
</data>
|
||||
<data name="FABACCESS" xml:space="preserve">
|
||||
<value>FabAccess</value>
|
||||
</data>
|
||||
<data name="HOST" xml:space="preserve">
|
||||
<value>Host</value>
|
||||
</data>
|
||||
<data name="MachinePage_CanNotUseByPermission" xml:space="preserve">
|
||||
<value>PLACEHOLDER</value>
|
||||
<comment>Nutzer darf die Maschine nicht nutzten, dass sollte erklärt werden, also beim Admin nachfragen</comment>
|
||||
<value>You do not have the authorization to use this machine.
|
||||
Ask in your Space if you can be trained on the machine to be unlocked for the machine.</value>
|
||||
</data>
|
||||
<data name="MachinePage_CurrentUser" xml:space="preserve">
|
||||
<value>Current User:</value>
|
||||
@ -179,6 +243,9 @@
|
||||
<data name="MainPage_Machines" xml:space="preserve">
|
||||
<value>Machines</value>
|
||||
</data>
|
||||
<data name="MainPage_Profile" xml:space="preserve">
|
||||
<value>My Profile</value>
|
||||
</data>
|
||||
<data name="MainPage_Servers" xml:space="preserve">
|
||||
<value>Servers</value>
|
||||
</data>
|
||||
@ -188,6 +255,9 @@
|
||||
<data name="MainPage_Version" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="OK" xml:space="preserve">
|
||||
<value>Ok</value>
|
||||
</data>
|
||||
<data name="OR" xml:space="preserve">
|
||||
<value>or</value>
|
||||
</data>
|
||||
@ -197,6 +267,18 @@
|
||||
<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>
|
||||
<data name="ProfilePage_NewPassword" xml:space="preserve">
|
||||
<value>New Password</value>
|
||||
</data>
|
||||
<data name="ProfilePage_OldPassword" xml:space="preserve">
|
||||
<value>Old Password</value>
|
||||
</data>
|
||||
<data name="ProfilePage_UpdatePassword" xml:space="preserve">
|
||||
<value>Update Password</value>
|
||||
</data>
|
||||
<data name="SCANQR" xml:space="preserve">
|
||||
<value>Scan QR-Code</value>
|
||||
</data>
|
||||
@ -242,7 +324,55 @@
|
||||
<data name="StartPage_Starting" xml:space="preserve">
|
||||
<value>Starting App</value>
|
||||
</data>
|
||||
<data name="TITLE_AddUser" xml:space="preserve">
|
||||
<value>Add User</value>
|
||||
</data>
|
||||
<data name="TITLE_ConnectToServer" xml:space="preserve">
|
||||
<value>Connect to Server</value>
|
||||
</data>
|
||||
<data name="TITLE_Machine" xml:space="preserve">
|
||||
<value>Machine</value>
|
||||
</data>
|
||||
<data name="TITLE_Machines" xml:space="preserve">
|
||||
<value>Machines</value>
|
||||
</data>
|
||||
<data name="TITLE_Profile" xml:space="preserve">
|
||||
<value>My Profile</value>
|
||||
</data>
|
||||
<data name="TITLE_Server" xml:space="preserve">
|
||||
<value>Server</value>
|
||||
</data>
|
||||
<data name="TITLE_Servers" xml:space="preserve">
|
||||
<value>Servers</value>
|
||||
</data>
|
||||
<data name="TITLE_Settings" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="TITLE_User" xml:space="preserve">
|
||||
<value>User</value>
|
||||
</data>
|
||||
<data name="TITLE_Users" xml:space="preserve">
|
||||
<value>Users</value>
|
||||
</data>
|
||||
<data name="UserListPage_AddUser" xml:space="preserve">
|
||||
<value>Add User</value>
|
||||
</data>
|
||||
<data name="USERNAME" xml:space="preserve">
|
||||
<value>Username</value>
|
||||
</data>
|
||||
<data name="UserPage_ChangePassword" xml:space="preserve">
|
||||
<value>Update Password</value>
|
||||
</data>
|
||||
<data name="UserPage_NewPassword" xml:space="preserve">
|
||||
<value>New Password</value>
|
||||
</data>
|
||||
<data name="UserPage_UpdatePassword" xml:space="preserve">
|
||||
<value>Force Password Update</value>
|
||||
</data>
|
||||
<data name="VERSION" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="YAY" xml:space="preserve">
|
||||
<value>YAY</value>
|
||||
</data>
|
||||
</root>
|
@ -41,7 +41,7 @@ namespace Borepin.Service.Storage
|
||||
IList<ConnectionData> connectionData_List = await _LoadConnectionData().ConfigureAwait(false);
|
||||
if(connectionData_List.Contains(connectionData))
|
||||
{
|
||||
throw new DuplicateConnectionException(connectionData);
|
||||
connectionData_List.Remove(connectionData);
|
||||
}
|
||||
|
||||
connectionData_List.Add(connectionData);
|
||||
|
23
Borepin/Borepin/View/PermissionSelectView.xaml
Normal file
23
Borepin/Borepin/View/PermissionSelectView.xaml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Borepin.View.PermissionSelectView">
|
||||
<ContentView.Content>
|
||||
<Grid RowSpacing="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="1"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="1" Text="{Binding RoleName, StringFormat='{0}'}" Style="{StaticResource LabelStyle_Primary}" VerticalOptions="Center"/>
|
||||
<CheckBox Grid.Row="0" Grid.Column="3" Margin="0, 3, 0, 3" IsChecked="{Binding IsChecked}" IsEnabled="{Binding CanChange}" VerticalOptions="Center"/>
|
||||
<BoxView Grid.Row="1" Grid.ColumnSpan="5" BackgroundColor="{StaticResource FifthColor}"/>
|
||||
</Grid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
20
Borepin/Borepin/View/PermissionSelectView.xaml.cs
Normal file
20
Borepin/Borepin/View/PermissionSelectView.xaml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace Borepin.View
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class PermissionSelectView : ContentView
|
||||
{
|
||||
public PermissionSelectView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
128
Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs
Normal file
128
Borepin/Borepin/ViewModel/PermissionSelectViewModel.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using Borepin.Base;
|
||||
using Borepin.Service;
|
||||
using Capnp.Rpc;
|
||||
using FabAccessAPI.Schema;
|
||||
using Prism.Commands;
|
||||
using Prism.Navigation;
|
||||
using Prism.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Borepin.ViewModel
|
||||
{
|
||||
public class PermissionSelectViewModel : ConnectionModelBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
private User _User;
|
||||
private Role _Role;
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public PermissionSelectViewModel(INavigationService navigationService, IPageDialogService pageDialogService, IAPIService apiService) : base(navigationService, pageDialogService, apiService)
|
||||
{
|
||||
UpdateRoleCommand = new DelegateCommand(UpdateRoleCommandExecute);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadData
|
||||
public override Task LoadInstance(object instance)
|
||||
{
|
||||
if(instance is object[])
|
||||
{
|
||||
object[] array = instance as object[];
|
||||
if (array[0] is Role && array[1] is User && array[2] is bool)
|
||||
{
|
||||
_Role = array[0] as Role;
|
||||
_User = array[1] as User;
|
||||
|
||||
RoleName = _Role.Name;
|
||||
|
||||
CanChange = !((User.AdminInterface_Proxy)_User.Admin).IsNull;
|
||||
IsChecked = (bool)array[2];
|
||||
}
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private bool _IsChecked;
|
||||
public bool IsChecked
|
||||
{
|
||||
get => _IsChecked;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _IsChecked, value);
|
||||
UpdateRoleCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _CanChange;
|
||||
public bool CanChange
|
||||
{
|
||||
get => _CanChange;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _CanChange, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _RoleName;
|
||||
public string RoleName
|
||||
{
|
||||
get => _RoleName;
|
||||
set => SetProperty(ref _RoleName, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private ICommand _UpdateRoleCommand;
|
||||
public ICommand UpdateRoleCommand
|
||||
{
|
||||
get => _UpdateRoleCommand;
|
||||
set => SetProperty(ref _UpdateRoleCommand, value);
|
||||
}
|
||||
public async void UpdateRoleCommandExecute()
|
||||
{
|
||||
if(!CanChange)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(_API.IsConnected && _User != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Role> user_role_list = new List<Role>(await _User.Info.ListRoles().ConfigureAwait(false));
|
||||
if(IsChecked)
|
||||
{
|
||||
if(!user_role_list.Exists(x => string.Equals(x.Name, _Role.Name, StringComparison.Ordinal)))
|
||||
{
|
||||
await _User.Admin.AddRole(_Role).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(user_role_list.Exists(x => string.Equals(x.Name, _Role.Name, StringComparison.Ordinal)))
|
||||
{
|
||||
await _User.Admin.RemoveRole(_Role).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RpcException exception) when (string.Equals(exception.Message, "RPC connection is broken. Task would never return.", StringComparison.Ordinal))
|
||||
{
|
||||
Log.Debug("RPC Connection Loss");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_User = null;
|
||||
_Role = null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user