mirror of
https://gitlab.com/fabinfra/fabaccess/borepin.git
synced 2025-04-20 18:36:31 +02:00
Added: Login Pages (Select Host, Choose Login Method, Login with Password)
This commit is contained in:
parent
a7a4cb1146
commit
065ed2bfa0
@ -18,7 +18,7 @@ namespace Borepin
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
var result = await NavigationService.NavigateAsync("MainPage/NavigationPage/MachinesPage");
|
var result = await NavigationService.NavigateAsync("//NavigationPage/HostSelectPage");
|
||||||
|
|
||||||
if (!result.Success)
|
if (!result.Success)
|
||||||
{
|
{
|
||||||
@ -33,9 +33,9 @@ namespace Borepin
|
|||||||
containerRegistry.RegisterForNavigation<MachinesPage, MachinesPageModel>();
|
containerRegistry.RegisterForNavigation<MachinesPage, MachinesPageModel>();
|
||||||
containerRegistry.RegisterForNavigation<SettingsPage>();
|
containerRegistry.RegisterForNavigation<SettingsPage>();
|
||||||
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
|
containerRegistry.RegisterForNavigation<MachinePage, MachinePageModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<LoginPasswordPage, LoginPasswordPageModel>();
|
||||||
// Use Admin as Default
|
containerRegistry.RegisterForNavigation<HostSelectPage, HostSelectPageModel>();
|
||||||
containerRegistry.RegisterInstance(typeof(BFFHInterface), BFFHService.Auth(BFFHService.AdminID));
|
containerRegistry.RegisterForNavigation<LoginChoosePage, LoginChoosePageModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,15 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Page\HostSelectPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Page\LoginChoosePage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Page\LoginPasswordPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Page\MachinePage.xaml">
|
<EmbeddedResource Update="Page\MachinePage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
17
Borepin/Borepin/Page/HostSelectPage.xaml
Normal file
17
Borepin/Borepin/Page/HostSelectPage.xaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?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.HostSelectPage">
|
||||||
|
<NavigationPage.TitleView>
|
||||||
|
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
|
||||||
|
</NavigationPage.TitleView>
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout Padding="20">
|
||||||
|
<Label Text="Host" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Entry Text="{Binding Host}"/>
|
||||||
|
|
||||||
|
<Button Text="Detect local host" Command="{Binding DetectHostCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
|
||||||
|
<Button Text="Select Host" Command="{Binding UseHostCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
20
Borepin/Borepin/Page/HostSelectPage.xaml.cs
Normal file
20
Borepin/Borepin/Page/HostSelectPage.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 HostSelectPage : ContentPage
|
||||||
|
{
|
||||||
|
public HostSelectPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
Borepin/Borepin/Page/LoginChoosePage.xaml
Normal file
19
Borepin/Borepin/Page/LoginChoosePage.xaml
Normal 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"
|
||||||
|
x:Class="Borepin.Page.LoginChoosePage">
|
||||||
|
<NavigationPage.TitleView>
|
||||||
|
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
|
||||||
|
</NavigationPage.TitleView>
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout Padding="20">
|
||||||
|
<Label Text="Sign In:" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Button Text="Login with Password" Command="{Binding LoginPasswordCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
|
||||||
|
<Label Text="or" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Button Text="Login with Card" Style="{StaticResource ButtonStyle_Primary}" IsEnabled="False"/>
|
||||||
|
|
||||||
|
<Label Text="Sign Up:" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Button Text="Register" Style="{StaticResource ButtonStyle_Primary}" IsEnabled="False"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
20
Borepin/Borepin/Page/LoginChoosePage.xaml.cs
Normal file
20
Borepin/Borepin/Page/LoginChoosePage.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 LoginChoosePage : ContentPage
|
||||||
|
{
|
||||||
|
public LoginChoosePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
Borepin/Borepin/Page/LoginPasswordPage.xaml
Normal file
19
Borepin/Borepin/Page/LoginPasswordPage.xaml
Normal 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"
|
||||||
|
x:Class="Borepin.Page.LoginPasswordPage">
|
||||||
|
<NavigationPage.TitleView>
|
||||||
|
<Label Text="FabAccess" FontAttributes="Bold" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" VerticalOptions="FillAndExpand" FontSize="Medium" TextColor="{StaticResource FirstColor}"/>
|
||||||
|
</NavigationPage.TitleView>
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout Padding="20">
|
||||||
|
<Label Text="Username" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Entry Text="{Binding Username}"/>
|
||||||
|
|
||||||
|
<Label Text="Password" Style="{StaticResource LabelStyle_PropertyTitle}"></Label>
|
||||||
|
<Entry Text="{Binding Password}" IsPassword="True"/>
|
||||||
|
|
||||||
|
<Button Text="Login" Command="{Binding AuthenticateCommand}" Style="{StaticResource ButtonStyle_Primary}"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ContentPage>
|
20
Borepin/Borepin/Page/LoginPasswordPage.xaml.cs
Normal file
20
Borepin/Borepin/Page/LoginPasswordPage.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 LoginPasswordPage : ContentPage
|
||||||
|
{
|
||||||
|
public LoginPasswordPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
Borepin/Borepin/PageModel/HostSelectPageModel.cs
Normal file
60
Borepin/Borepin/PageModel/HostSelectPageModel.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using Borepin.Service;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Borepin.PageModel
|
||||||
|
{
|
||||||
|
public class HostSelectPageModel : BindableBase
|
||||||
|
{
|
||||||
|
private INavigationService _NavigationService;
|
||||||
|
|
||||||
|
public HostSelectPageModel(INavigationService navigationService)
|
||||||
|
{
|
||||||
|
_NavigationService = navigationService;
|
||||||
|
|
||||||
|
UseHostCommand = new Command(UseHostCommandExecuted);
|
||||||
|
DetectHostCommand = new Command(DetectHostCommandExecuted);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _Host;
|
||||||
|
public string Host
|
||||||
|
{
|
||||||
|
get => _Host;
|
||||||
|
set => SetProperty(ref _Host, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _UseHostCommand;
|
||||||
|
public ICommand UseHostCommand
|
||||||
|
{
|
||||||
|
get => _UseHostCommand;
|
||||||
|
set => SetProperty(ref _UseHostCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void UseHostCommandExecuted()
|
||||||
|
{
|
||||||
|
INavigationResult result = await _NavigationService.NavigateAsync($"LoginChoosePage");
|
||||||
|
if (!result.Success)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _DetectHostCommand;
|
||||||
|
public ICommand DetectHostCommand
|
||||||
|
{
|
||||||
|
get => _DetectHostCommand;
|
||||||
|
set => SetProperty(ref _DetectHostCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DetectHostCommandExecuted()
|
||||||
|
{
|
||||||
|
// Use Demo Host
|
||||||
|
Host = "demo.fab-access.org";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
Borepin/Borepin/PageModel/LoginChoosePageModel.cs
Normal file
38
Borepin/Borepin/PageModel/LoginChoosePageModel.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Borepin.PageModel
|
||||||
|
{
|
||||||
|
public class LoginChoosePageModel : BindableBase
|
||||||
|
{
|
||||||
|
private INavigationService _NavigationService;
|
||||||
|
|
||||||
|
public LoginChoosePageModel(INavigationService navigationService)
|
||||||
|
{
|
||||||
|
_NavigationService = navigationService;
|
||||||
|
|
||||||
|
LoginPasswordCommand = new Command(LoginPasswordCommandExecuted);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _LoginPasswordCommand;
|
||||||
|
public ICommand LoginPasswordCommand
|
||||||
|
{
|
||||||
|
get => _LoginPasswordCommand;
|
||||||
|
set => SetProperty(ref _LoginPasswordCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoginPasswordCommandExecuted()
|
||||||
|
{
|
||||||
|
INavigationResult result = await _NavigationService.NavigateAsync($"LoginPasswordPage");
|
||||||
|
if (!result.Success)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
Borepin/Borepin/PageModel/LoginPasswordPageModel.cs
Normal file
56
Borepin/Borepin/PageModel/LoginPasswordPageModel.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using Borepin.Service;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace Borepin.PageModel
|
||||||
|
{
|
||||||
|
public class LoginPasswordPageModel : BindableBase
|
||||||
|
{
|
||||||
|
private INavigationService _NavigationService;
|
||||||
|
|
||||||
|
public LoginPasswordPageModel(INavigationService navigationService)
|
||||||
|
{
|
||||||
|
_NavigationService = navigationService;
|
||||||
|
|
||||||
|
AuthenticateCommand = new Command(AuthenticateCommandExecuted);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand _AuthenticateCommand;
|
||||||
|
public ICommand AuthenticateCommand
|
||||||
|
{
|
||||||
|
get => _AuthenticateCommand;
|
||||||
|
set => SetProperty(ref _AuthenticateCommand, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void AuthenticateCommandExecuted()
|
||||||
|
{
|
||||||
|
BFFHActiveInterface.Interface = BFFHService.Auth(Username);
|
||||||
|
|
||||||
|
var result = await _NavigationService.NavigateAsync("//MainPage/NavigationPage/MachinesPage");
|
||||||
|
|
||||||
|
if (!result.Success)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,10 +16,10 @@ namespace Borepin.PageModel
|
|||||||
private INavigationService _NavigationService;
|
private INavigationService _NavigationService;
|
||||||
private BFFHInterface _BFFHInterface;
|
private BFFHInterface _BFFHInterface;
|
||||||
|
|
||||||
public MachinePageModel(INavigationService navigationService, BFFHInterface bffhInterface)
|
public MachinePageModel(INavigationService navigationService)
|
||||||
{
|
{
|
||||||
_NavigationService = navigationService;
|
_NavigationService = navigationService;
|
||||||
_BFFHInterface = bffhInterface;
|
_BFFHInterface = BFFHActiveInterface.Interface;
|
||||||
|
|
||||||
ReserveMachineCommand = new Command(ReserveMachineCommandExecuted);
|
ReserveMachineCommand = new Command(ReserveMachineCommandExecuted);
|
||||||
UseMachineCommand = new Command(UseMachineCommandExecuted);
|
UseMachineCommand = new Command(UseMachineCommandExecuted);
|
||||||
|
@ -104,6 +104,11 @@ namespace Borepin.Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class BFFHActiveInterface
|
||||||
|
{
|
||||||
|
public static BFFHInterface Interface;
|
||||||
|
}
|
||||||
|
|
||||||
public class BFFHInterface
|
public class BFFHInterface
|
||||||
{
|
{
|
||||||
public readonly User ActiveUser;
|
public readonly User ActiveUser;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user