Merge branch 'alpha' into 'beta'

Check Alpha to Beta

See merge request fabinfra/fabaccess/borepin!19
This commit is contained in:
TheJoKlLa 2021-09-21 23:09:47 +00:00
commit 6edb1e69f2
35 changed files with 364 additions and 134 deletions

View File

@ -2,6 +2,7 @@
using Android.App; using Android.App;
using Android.Content.PM; using Android.Content.PM;
using Android.OS; using Android.OS;
using AndroidX.AppCompat.App;
namespace Borepin.Droid namespace Borepin.Droid
{ {
@ -10,6 +11,8 @@ namespace Borepin.Droid
{ {
protected override void OnCreate(Bundle savedInstanceState) protected override void OnCreate(Bundle savedInstanceState)
{ {
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
TabLayoutResource = Resource.Layout.Tabbar; TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar; ToolbarResource = Resource.Layout.Toolbar;

View File

@ -2,6 +2,5 @@
x:Class="Borepin.UWP.App" x:Class="Borepin.UWP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Borepin.UWP"> xmlns:local="using:Borepin.UWP" RequestedTheme="Light">
</Application> </Application>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -193,4 +193,8 @@
<ItemGroup> <ItemGroup>
<Folder Include="Assets.xcassets\LaunchIcon.imageset\" /> <Folder Include="Assets.xcassets\LaunchIcon.imageset\" />
</ItemGroup> </ItemGroup>
</Project> <Target Name="BeforeBuild" Condition=" '$(GITLAB_CI)' == 'true' ">
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" Value="$(CI_PIPELINE_ID)" />
<XmlPoke XmlInputPath="Info.plist" Query="//dict/key[. = 'CFBundleShortVersionString']/following-sibling::string[1]" Value="0.1.0" />
</Target>
</Project>

View File

@ -40,5 +40,7 @@
<false/> <false/>
<key>NFCReaderUsageDescription</key> <key>NFCReaderUsageDescription</key>
<string>FabAccess needs to be able to read your card for authentication with the server.</string> <string>FabAccess needs to be able to read your card for authentication with the server.</string>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict> </dict>
</plist> </plist>

View File

@ -45,6 +45,7 @@ namespace Borepin
containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>(); containerRegistry.RegisterForNavigation<MachineListPage, MachineListPageModel>();
containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>(); containerRegistry.RegisterForNavigation<ServerListPage, ServerListPageModel>();
containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>(); containerRegistry.RegisterForNavigation<ServerPage, ServerPageModel>();
containerRegistry.RegisterForNavigation<ListPage, ListPageModel>();
containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage"); containerRegistry.RegisterForNavigation<WelcomePage, WelcomePageModel>("SetUpProcess_WelcomePage");
containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage"); containerRegistry.RegisterForNavigation<ScanPage, ScanPageModel>("SetUpProcess_ScanPage");

View File

@ -68,6 +68,9 @@
<EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml"> <EmbeddedResource Update="Page\AddServerProcess\HostSelectPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Page\ListPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml"> <EmbeddedResource Update="Page\AddServerProcess\LoginChoosePage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
@ -98,6 +101,9 @@
<EmbeddedResource Update="Page\StartUpDistributorPage.xaml"> <EmbeddedResource Update="Page\StartUpDistributorPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Page\TestPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -109,6 +115,12 @@
<EmbeddedResource Update="Styles\LightTheme.xaml"> <EmbeddedResource Update="Styles\LightTheme.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="View\IsBusyView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ListItemView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Update="View\ScanView.xaml"> <EmbeddedResource Update="View\ScanView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>

View File

@ -29,12 +29,12 @@ namespace Borepin.Model
State = _Machine.State; State = _Machine.State;
Manager = new UserVisualize(_Machine.Manager); Manager = new UserVisualize(_Machine.Manager);
CanUse = _Machine.Use != null; CanUse = !((UseInterface_Proxy)_Machine.Use).IsNull;
CanInUse = _Machine.Inuse != null; CanInUse = !((InUseInterface_Proxy) _Machine.Inuse).IsNull;
CanTransfer = _Machine.Transfer != null; CanTransfer = !((TransferInterface_Proxy) _Machine.Transfer).IsNull;
CanCheck = _Machine.Check != null; CanCheck = !((CheckInterface_Proxy) _Machine.Check).IsNull;
CanManage = _Machine.Manage != null; CanManage = !((ManageInterface_Proxy) _Machine.Manage).IsNull;
CanAdmin = _Machine.Admin != null; CanAdmin = !((AdminInterface_Proxy) _Machine.Admin).IsNull;
} }
#endregion #endregion

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Borepin.View"
x:Class="Borepin.Page.ListPage">
<ContentPage.Content>
<StackLayout>
<ListView ItemsSource="{Binding ListItemViewModel_List}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<views:ListItemView />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.Page
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListPage : ContentPage
{
public ListPage()
{
InitializeComponent();
}
}
}

View File

@ -3,26 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Borepin.Page.SetUpProcess.ScanPage" x:Class="Borepin.Page.SetUpProcess.ScanPage"
xmlns:i18n="clr-namespace:Borepin.Helpers" xmlns:i18n="clr-namespace:Borepin.Helpers"
xmlns:views="clr-namespace:Borepin.View" xmlns:views="clr-namespace:Borepin.View">
xmlns:converters="clr-namespace:Borepin.Converter">
<NavigationPage.TitleView>
<Label Text="FabAccess" HorizontalOptions="End" Margin="0, 0, 10, 0" VerticalOptions="CenterAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
</NavigationPage.TitleView>
<ContentPage.Resources>
<ResourceDictionary>
<converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content> <ContentPage.Content>
<StackLayout Padding="20"> <ScrollView>
<StackLayout IsVisible="{Binding IsBusy}"> <StackLayout Style="{StaticResource Style_StackLayout_Content}">
<ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
</StackLayout>
<StackLayout IsVisible="{Binding IsBusy, Converter={StaticResource InvertBoolConverter}}">
<views:ScanView /> <views:ScanView />
<Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/> <Label Text="{i18n:Translate SetUp_ScanPage_Text}" Style="{StaticResource Style_Label_Text}"/>
<Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/> <Button Text="{i18n:Translate SetUp_ScanPage_Button}" Command="{Binding NextCommand}" Style="{StaticResource Style_Button_Primary}"/>
</StackLayout> </StackLayout>
</StackLayout> </ScrollView>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>

View File

@ -0,0 +1,21 @@
<?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.TestPage"
xmlns:converters="clr-namespace:Borepin.Converter">
<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}}">
<Label Text="TestPage"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View 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 TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
}
}
}

View File

@ -31,12 +31,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -125,8 +124,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -16,12 +16,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -51,8 +50,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true; IsBusy = false;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -4,6 +4,7 @@ using Borepin.Service.BFFH;
using Borepin.Service.Connections; using Borepin.Service.Connections;
using Prism.Commands; using Prism.Commands;
using Prism.Navigation; using Prism.Navigation;
using Prism.Services;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
@ -15,13 +16,16 @@ namespace Borepin.PageModel.AddServerProcess
#region Private Properties #region Private Properties
private readonly IBFFHService _BFFHService; private readonly IBFFHService _BFFHService;
private readonly IConnectionService _ConnectionService; private readonly IConnectionService _ConnectionService;
private readonly IPageDialogService _PageDialogService;
#endregion #endregion
#region Constructors #region Constructors
public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService) : base(navigationService) public LoginPasswordPageModel(INavigationService navigationService, IBFFHService bffhService, IConnectionService connectionService, IPageDialogService pageDialogService) : base(navigationService)
{ {
_BFFHService = bffhService; _BFFHService = bffhService;
_ConnectionService = connectionService; _ConnectionService = connectionService;
_PageDialogService = pageDialogService;
AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecuted()); AuthenticateCommand = new DelegateCommand(async () => await AuthenticateCommandExecuted());
@ -30,12 +34,11 @@ namespace Borepin.PageModel.AddServerProcess
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true;
IsBusy = false; IsBusy = false;
await Task.CompletedTask;
return Task.CompletedTask;
} }
#endregion #endregion
@ -65,11 +68,19 @@ namespace Borepin.PageModel.AddServerProcess
private async Task AuthenticateCommandExecuted() private async Task AuthenticateCommandExecuted()
{ {
IsBusy = true;
Connection connection_update = _BFFHService.ActiveConnection; Connection connection_update = _BFFHService.ActiveConnection;
connection_update.Username = Username; connection_update.Username = Username;
await _BFFHService.Authenticate(connection_update, Password).ConfigureAwait(false); if(!await _BFFHService.Authenticate(connection_update, Password))
{
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok");
IsBusy = false;
return;
}
try try
{ {
@ -77,7 +88,7 @@ namespace Borepin.PageModel.AddServerProcess
} }
catch (ArgumentException) catch (ArgumentException)
{ {
// Could be better catched
} }
await _ConnectionService.LogConnect(_BFFHService.ActiveConnection); await _ConnectionService.LogConnect(_BFFHService.ActiveConnection);
@ -99,8 +110,7 @@ namespace Borepin.PageModel.AddServerProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -0,0 +1,57 @@
using Borepin.Model;
using Borepin.ViewModel;
using Prism.Mvvm;
using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Forms;
namespace Borepin.PageModel
{
public class ListPageModel : BindableBase
{
public ListPageModel()
{
ListItemViewModel_List = new List<ListItemViewModel>()
{
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 1"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 2"
}),
new ListItemViewModel(
new ListItem()
{
Value1 = "ListItem 3"
}),
};
SelectListItemCommand = new Command<object>(SelectListItemCommandExecuted);
}
private List<ListItemViewModel> _ListItemViewModel_List;
public List<ListItemViewModel> ListItemViewModel_List
{
get => _ListItemViewModel_List;
set => SetProperty(ref _ListItemViewModel_List, value);
}
private ICommand _SelectListItemCommand;
public ICommand SelectListItemCommand
{
get => _SelectListItemCommand;
set => SetProperty(ref _SelectListItemCommand, value);
}
private void SelectListItemCommandExecuted(object obj)
{
System.Diagnostics.Debugger.Break();
}
}
}

View File

@ -25,11 +25,9 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true;
if (_BFFHService.ActiveConnection == null) if (_BFFHService.ActiveConnection == null)
{ {
IsBusy = false; IsBusy = false;

View File

@ -28,7 +28,7 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true; IsBusy = true;

View File

@ -1,31 +1,20 @@
using Borepin.Base; using Prism.Mvvm;
using Prism.Navigation; using Prism.Navigation;
using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace Borepin.PageModel namespace Borepin.PageModel
{ {
public class MainPagePageModel : PageModelBase public class MainPagePageModel : BindableBase
{ {
#region Constructors private INavigationService _NavigationService;
public MainPagePageModel(INavigationService navigationService) : base(navigationService)
public MainPagePageModel(INavigationService navigationService)
{ {
_NavigationService = navigationService;
NavigateCommand = new Command<string>(NavigateCommandExecuted); NavigateCommand = new Command<string>(NavigateCommandExecuted);
} }
#endregion
#region LoadData
public override async Task LoadData()
{
IsBusy = true;
IsBusy = false;
await LoadData();
}
#endregion
#region Commands
private ICommand _NavigationCommand; private ICommand _NavigationCommand;
public ICommand NavigateCommand public ICommand NavigateCommand
@ -42,19 +31,5 @@ namespace Borepin.PageModel
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
} }
} }
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
} }
} }

View File

@ -31,11 +31,9 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override async Task LoadData()
{ {
IsBusy = true;
List<Connection> list = await _ConnectionService.GetConnectionList(); List<Connection> list = await _ConnectionService.GetConnectionList();
if (_BFFHService.ActiveConnection != null) if (_BFFHService.ActiveConnection != null)
{ {

View File

@ -37,13 +37,10 @@ namespace Borepin.PageModel
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; throw new System.NotImplementedException();
IsBusy = false;
await LoadData();
} }
#endregion #endregion
@ -94,7 +91,14 @@ namespace Borepin.PageModel
IsBusy = false; IsBusy = false;
return; return;
} }
await _BFFHService.Authenticate();
if(!await _BFFHService.Authenticate())
{
await _PageDialogService.DisplayAlertAsync("Connection failed", "Unable to authenticate to server.", "Ok");
IsBusy = false;
return;
}
IsConnected = true; IsConnected = true;
} }
@ -169,8 +173,7 @@ namespace Borepin.PageModel
IsConnected = false; IsConnected = false;
} }
IsBusy = true; IsBusy = false;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await Task.CompletedTask;
} }
#endregion #endregion
@ -50,8 +47,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -15,13 +15,10 @@ namespace Borepin.PageModel.SetUpProcess
} }
#endregion #endregion
#region LoadData #region Data
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await Task.CompletedTask;
} }
#endregion #endregion
@ -34,7 +31,8 @@ namespace Borepin.PageModel.SetUpProcess
} }
private async void NextCommandCommandExecuted(object obj) private async void NextCommandCommandExecuted(object obj)
{ {
INavigationResult result = await _NavigationService.NavigateAsync("SetUpProcess_ScanPage"); //INavigationResult result = await _NavigationService.NavigateAsync("SetUpProcess_ScanPage");
INavigationResult result = await _NavigationService.NavigateAsync("AddServerProcess_HostSelectPage");
if (!result.Success) if (!result.Success)
{ {
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
@ -50,8 +48,7 @@ namespace Borepin.PageModel.SetUpProcess
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -27,12 +27,9 @@ namespace Borepin.PageModel
#endregion #endregion
#region LoadData #region LoadData
public override async Task LoadData() public override Task LoadData()
{ {
IsBusy = true; return Task.CompletedTask;
IsBusy = false;
await LoadData();
} }
#endregion #endregion
@ -78,8 +75,7 @@ namespace Borepin.PageModel
public override void OnNavigatedTo(INavigationParameters parameters) public override void OnNavigatedTo(INavigationParameters parameters)
{ {
IsBusy = true;
Task.Run(LoadData);
} }
#endregion #endregion
} }

View File

@ -0,0 +1,39 @@
using Borepin.Base;
using Prism.Navigation;
using System.Threading.Tasks;
namespace Borepin.PageModel
{
class TestPageModel : PageModelBase
{
#region Contructors
public TestPageModel(INavigationService navigationService) : base(navigationService)
{
}
#endregion
#region Data
public override Task LoadData()
{
Task.Delay(3000);
IsBusy = false;
return Task.CompletedTask;
}
#endregion
#region INavigationService
public override void OnNavigatedFrom(INavigationParameters parameters)
{
}
public override void OnNavigatedTo(INavigationParameters parameters)
{
IsBusy = true;
Task.Run(LoadData);
}
#endregion
}
}

View File

@ -79,7 +79,7 @@ namespace Borepin.Resources.Text {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Start working. /// Looks up a localized string similar to Begin working.
/// </summary> /// </summary>
internal static string SetUp_WelcomePage_Button { internal static string SetUp_WelcomePage_Button {
get { get {
@ -88,7 +88,7 @@ namespace Borepin.Resources.Text {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann. /// Looks up a localized string similar to Automate your Space with FabAccess.
/// </summary> /// </summary>
internal static string SetUp_WelcomePage_Text { internal static string SetUp_WelcomePage_Text {
get { get {

View File

@ -124,10 +124,10 @@
<value>Wenn du dieses Logo siehst, dann kannst du es scannen</value> <value>Wenn du dieses Logo siehst, dann kannst du es scannen</value>
</data> </data>
<data name="SetUp_WelcomePage_Button" xml:space="preserve"> <data name="SetUp_WelcomePage_Button" xml:space="preserve">
<value>Start working</value> <value>Begin working</value>
</data> </data>
<data name="SetUp_WelcomePage_Text" xml:space="preserve"> <data name="SetUp_WelcomePage_Text" xml:space="preserve">
<value>Hier muss ein kurzer Text hin was FabAccess ist und was man damit machen kann</value> <value>Automate your Space with FabAccess</value>
</data> </data>
<data name="SetUp_WelcomePage_Title" xml:space="preserve"> <data name="SetUp_WelcomePage_Title" xml:space="preserve">
<value>Welcome</value> <value>Welcome</value>

View File

@ -75,20 +75,21 @@ namespace Borepin.Service.BFFH
{ {
string password = await _CredentialService.GetPasswordAsync(ActiveConnection); string password = await _CredentialService.GetPasswordAsync(ActiveConnection);
await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } }); return await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } });
return await Task.FromResult(true);
} }
public async Task<bool> Authenticate(Connection connection, string password) public async Task<bool> Authenticate(Connection connection, string password)
{ {
await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } }).ConfigureAwait(false); bool result = await _Connection.Auth("PLAIN", new Dictionary<string, object> { { "Username", ActiveConnection.Username }, { "Password", password } });
await _CredentialService.AddCredentialsAsync(connection, password); if(result == true)
{
await _CredentialService.AddCredentialsAsync(connection, password);
ActiveConnection = connection; ActiveConnection = connection;
}
return await Task.FromResult(true); return result;
} }
public Task<IMachineSystem> GetMachineSystemInterface() public Task<IMachineSystem> GetMachineSystemInterface()

View File

@ -0,0 +1,10 @@
<?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.IsBusyView">
<ContentView.Content>
<StackLayout>
<Label Text="IsBusy" />
</StackLayout>
</ContentView.Content>
</ContentView>

View 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 IsBusyView : ContentView
{
public IsBusyView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<?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.ListItemView"
xmlns:pagemodel="clr-namespace:Borepin.PageModel">
<ContentView.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="{Binding Value}" />
<Button Text="X" Command="{Binding Source={RelativeSource AncestorType={x:Type pagemodel:ListPageModel}}, Path=SelectListItemCommand}" CommandParameter="{Binding .}" />
</StackLayout>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,15 @@

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Borepin.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ListItemView : ContentView
{
public ListItemView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,20 @@
using Borepin.Model;
using Prism.Mvvm;
namespace Borepin.ViewModel
{
public class ListItemViewModel : BindableBase
{
public ListItemViewModel(ListItem listItem)
{
Value = listItem.Value1;
}
private string _Value;
public string Value
{
get => _Value;
set => SetProperty(ref _Value, value);
}
}
}

View File

@ -124,7 +124,6 @@ namespace FabAccessAPI
public async Task<bool> Authenticate(string mech, Dictionary<string, object> properties) public async Task<bool> Authenticate(string mech, Dictionary<string, object> properties)
{ {
var m = SaslFactory.Create(mech); var m = SaslFactory.Create(mech);
foreach (KeyValuePair<string, object> entry in properties) foreach (KeyValuePair<string, object> entry in properties)
{ {

View File

@ -40,11 +40,15 @@ namespace FabAccessAPI
/// <param name="mech">The desired authentication mechanism</param> /// <param name="mech">The desired authentication mechanism</param>
/// <param name="kvs">Key-Value data specific to the mechanism</param> /// <param name="kvs">Key-Value data specific to the mechanism</param>
/// <returns></returns> /// <returns></returns>
public async Task Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default) public async Task<bool> Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default)
{ {
// _bootstrapCap = await _bootstrapCap.Unwrap(); // _bootstrapCap = await _bootstrapCap.Unwrap();
var authCap = await _bootstrapCap.AuthenticationSystem(cancellationToken_).ConfigureAwait(false); if(_auth == null)
_auth = new Auth(authCap); {
var authCap = await _bootstrapCap.AuthenticationSystem(cancellationToken_);
_auth = new Auth(authCap);
}
var mechs = await _auth.GetMechanisms(); var mechs = await _auth.GetMechanisms();
//_Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}"); //_Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}");
@ -53,7 +57,7 @@ namespace FabAccessAPI
throw new UnsupportedMechanismException(); throw new UnsupportedMechanismException();
} }
await _auth.Authenticate(mech, kvs); return await _auth.Authenticate(mech, kvs);
} }
/// <summary> /// <summary>