Beautifiing Login Process
This commit is contained in:
@@ -5,11 +5,13 @@ using Microsoft.Maui.Dispatching;
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden.ViewModels {
|
namespace Jugenddienst_Stunden.ViewModels {
|
||||||
internal class AboutViewModel {
|
internal class AboutViewModel {
|
||||||
public string Title => AppInfo.Name;
|
public string AppTitle => AppInfo.Name;
|
||||||
public string Version => AppInfo.VersionString;
|
public string Version => AppInfo.VersionString;
|
||||||
|
|
||||||
public string Message => "Scanne den QR-Code von deinem Benutzerprofil auf der Stundenseite.";
|
public string Message => "Scanne den QR-Code von deinem Benutzerprofil auf der Stundenseite.";
|
||||||
|
|
||||||
|
public string Title { get; set; } = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,31 +3,27 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
xmlns:models="clr-namespace:Jugenddienst_Stunden.ViewModels"
|
xmlns:models="clr-namespace:Jugenddienst_Stunden.ViewModels"
|
||||||
xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
|
xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
|
||||||
x:Class="Jugenddienst_Stunden.Views.AboutPage">
|
x:Class="Jugenddienst_Stunden.Views.AboutPage"
|
||||||
|
Title="{Binding Title}">
|
||||||
|
|
||||||
<ContentPage.BindingContext>
|
<ContentPage.BindingContext>
|
||||||
<models:AboutViewModel />
|
<models:AboutViewModel />
|
||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<VerticalStackLayout Spacing="10" Margin="10">
|
<VerticalStackLayout Spacing="10" Margin="15">
|
||||||
<HorizontalStackLayout Spacing="10">
|
<HorizontalStackLayout Spacing="10">
|
||||||
<Image Source="dotnet_bot.png"
|
<Label FontSize="22" FontAttributes="Bold" Text="{Binding AppTitle}" VerticalOptions="End" />
|
||||||
SemanticProperties.Description="The dot net bot waving hello!"
|
|
||||||
HeightRequest="64" />
|
|
||||||
<Label FontSize="22" FontAttributes="Bold" Text="{Binding Title}" VerticalOptions="End" />
|
|
||||||
<Label FontSize="22" Text="{Binding Version}" VerticalOptions="End" />
|
<Label FontSize="22" Text="{Binding Version}" VerticalOptions="End" />
|
||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
|
|
||||||
<Label Text="{Binding Message}" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Label Text="{Binding Message}" HeightRequest="110" />
|
||||||
|
|
||||||
<zxing:CameraBarcodeReaderView x:Name="barcodeScannerView"
|
<zxing:CameraBarcodeReaderView x:Name="barcodeScannerView"
|
||||||
BarcodesDetected="BarcodesDetected"
|
BarcodesDetected="BarcodesDetected"
|
||||||
HorizontalOptions="FillAndExpand"
|
HorizontalOptions="FillAndExpand"
|
||||||
VerticalOptions="FillAndExpand"
|
VerticalOptions="FillAndExpand"/>
|
||||||
Margin="0,60,0,0"/>
|
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public partial class AboutPage : ContentPage {
|
|||||||
_lastDetectionTime = currentTime;
|
_lastDetectionTime = currentTime;
|
||||||
foreach (var barcode in e.Results) {
|
foreach (var barcode in e.Results) {
|
||||||
if (Preferences.Default.Get("apiKey", "") != barcode.Value) {
|
if (Preferences.Default.Get("apiKey", "") != barcode.Value) {
|
||||||
MainThread.InvokeOnMainThreadAsync(async() => {
|
MainThread.InvokeOnMainThreadAsync(async () => {
|
||||||
//DisplayAlert("Barcode erkannt", $"Barcode: {barcode.Format} - {barcode.Value}", "OK");
|
//DisplayAlert("Barcode erkannt", $"Barcode: {barcode.Format} - {barcode.Value}", "OK");
|
||||||
Preferences.Default.Set("apiKey", barcode.Value);
|
Preferences.Default.Set("apiKey", barcode.Value);
|
||||||
|
|
||||||
@@ -36,13 +36,13 @@ public partial class AboutPage : ContentPage {
|
|||||||
var op = await Models.Operator.LoadData(barcode.Value);
|
var op = await Models.Operator.LoadData(barcode.Value);
|
||||||
Preferences.Default.Set("name", op.name);
|
Preferences.Default.Set("name", op.name);
|
||||||
Preferences.Default.Set("surname", op.surname);
|
Preferences.Default.Set("surname", op.surname);
|
||||||
DisplayAlert("Neuer Barcode erkannt", op.name + " " + op.surname, "OK");
|
DisplayAlert("Login erfolgreich", op.name + " " + op.surname, "OK");
|
||||||
|
Title = op.name + " " + op.surname;
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
MainThread.InvokeOnMainThreadAsync(() => {
|
MainThread.InvokeOnMainThreadAsync(() => {
|
||||||
DisplayAlert("Barcode bereits vorhanden",
|
DisplayAlert("Bereits eingeloggt",
|
||||||
Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", ""),
|
Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", ""),
|
||||||
"OK");
|
"OK");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user