Refactor About->Login

This commit is contained in:
2024-09-11 14:28:52 +02:00
parent 94c6acbe14
commit 6cf55aa258
6 changed files with 53 additions and 72 deletions

View File

@@ -1,54 +0,0 @@
using CommunityToolkit.Mvvm.Input;
using System.Windows.Input;
using Microsoft.Maui.Dispatching;
//using BarcodeScanning;
namespace Jugenddienst_Stunden.ViewModels {
internal class AboutViewModel {
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", "");
//private void BarcodesDetected(object sender, ZXing.Net.Maui.BarcodeDetectionEventArgs e) {
// var first = e.Results?.FirstOrDefault();
// if (first is null) {
// return;
// }
// System.Windows.Application.Current.Dispatcher.DispatchAsync(async () => {
// await DisplayAlert("Scan-Ergebnis", $"Barcode: {first.Value}", "OK");
// });
//}
//private async void SetupBarcodeScanner() {
// try {
// var scanner = new BarcodeScanner();
// var result = await scanner.ScanAsync();
// if (result != null) {
// await DisplayAlert("Scan-Ergebnis", $"Barcode: {result.Barcode}", "OK");
// } else {
// await DisplayAlert("Scan Abgebrochen", "Der Barcode-Scan wurde abgebrochen.", "OK");
// }
// } catch (Exception ex) {
// await DisplayAlert("Fehler", $"Ein Fehler ist aufgetreten: {ex.Message}", "OK");
// }
//}
//private static void BarcodesDetected(object sender, OnDetectionFinishedEventArg e) {
// if (e.BarcodeResults.Length > 0) {
// // Hier verarbeiten Sie den erkannten Barcode
// //Console.WriteLine($"Detected barcode: {e.BarcodeResults.GetType()} {e.BarcodeResults.ToString()}");
// await DisplayAlert("Scan-Ergebnis", $"Barcode: {e.BarcodeResults.GetType()} {e.BarcodeResults.ToString()}", "OK");
// }
//}
}
}

View File

@@ -0,0 +1,17 @@
using CommunityToolkit.Mvvm.Input;
using System.Windows.Input;
using Microsoft.Maui.Dispatching;
//using BarcodeScanning;
namespace Jugenddienst_Stunden.ViewModels {
internal class LoginViewModel {
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", "");
}
}