55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
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");
|
|
// }
|
|
//}
|
|
|
|
|
|
|
|
}
|
|
}
|