From 23ea92baf6cea84414e6cec6bb5305be3578663c Mon Sep 17 00:00:00 2001 From: DaPi Date: Wed, 21 Aug 2024 20:18:04 +0200 Subject: [PATCH] Beautifiing Login Process --- .../ViewModels/AboutViewModel.cs | 4 +++- Jugenddienst Stunden/Views/AboutPage.xaml | 18 +++++++----------- Jugenddienst Stunden/Views/AboutPage.xaml.cs | 10 +++++----- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Jugenddienst Stunden/ViewModels/AboutViewModel.cs b/Jugenddienst Stunden/ViewModels/AboutViewModel.cs index 1e2e190..6cb585d 100644 --- a/Jugenddienst Stunden/ViewModels/AboutViewModel.cs +++ b/Jugenddienst Stunden/ViewModels/AboutViewModel.cs @@ -5,11 +5,13 @@ using Microsoft.Maui.Dispatching; namespace Jugenddienst_Stunden.ViewModels { internal class AboutViewModel { - public string Title => AppInfo.Name; + public string AppTitle => AppInfo.Name; public string Version => AppInfo.VersionString; 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", ""); + diff --git a/Jugenddienst Stunden/Views/AboutPage.xaml b/Jugenddienst Stunden/Views/AboutPage.xaml index 5e43fc1..b76a615 100644 --- a/Jugenddienst Stunden/Views/AboutPage.xaml +++ b/Jugenddienst Stunden/Views/AboutPage.xaml @@ -3,31 +3,27 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:models="clr-namespace:Jugenddienst_Stunden.ViewModels" 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}"> - + - - - diff --git a/Jugenddienst Stunden/Views/AboutPage.xaml.cs b/Jugenddienst Stunden/Views/AboutPage.xaml.cs index 8df3859..98f8ee1 100644 --- a/Jugenddienst Stunden/Views/AboutPage.xaml.cs +++ b/Jugenddienst Stunden/Views/AboutPage.xaml.cs @@ -27,22 +27,22 @@ public partial class AboutPage : ContentPage { _lastDetectionTime = currentTime; foreach (var barcode in e.Results) { if (Preferences.Default.Get("apiKey", "") != barcode.Value) { - MainThread.InvokeOnMainThreadAsync(async() => { + MainThread.InvokeOnMainThreadAsync(async () => { //DisplayAlert("Barcode erkannt", $"Barcode: {barcode.Format} - {barcode.Value}", "OK"); Preferences.Default.Set("apiKey", barcode.Value); - + Models.Stunde.apiKey = barcode.Value; var op = await Models.Operator.LoadData(barcode.Value); Preferences.Default.Set("name", op.name); 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 { MainThread.InvokeOnMainThreadAsync(() => { - DisplayAlert("Barcode bereits vorhanden", + DisplayAlert("Bereits eingeloggt", Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", ""), "OK"); });