BarcodeScanner
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Input;
|
||||
using BarcodeScanning;
|
||||
using Microsoft.Maui.Dispatching;
|
||||
//using BarcodeScanning;
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
internal class AboutViewModel {
|
||||
@@ -19,14 +20,31 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
async Task ShowMoreInfo() =>
|
||||
await Launcher.Default.OpenAsync(MoreInfoUrl);
|
||||
|
||||
|
||||
|
||||
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()}");
|
||||
}
|
||||
}
|
||||
//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");
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Networking;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
@@ -16,6 +18,12 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
public Models.Hours Hours {
|
||||
get => _hour;
|
||||
}
|
||||
public string ZeitDone {
|
||||
get => _hour.zeit;
|
||||
}
|
||||
public string ZeitCalculated {
|
||||
get => _hour.zeit_total;
|
||||
}
|
||||
public string Nominal {
|
||||
get => _hour.nominal;
|
||||
}
|
||||
@@ -35,14 +43,18 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
// await Models.Stunde.LoadData();
|
||||
|
||||
public async Task LoadData() {
|
||||
_hour = await Models.Stunde.LoadData();
|
||||
RefreshProperties();
|
||||
_hour = await Models.Stunde.LoadData();
|
||||
Models.Hours Hours = new Models.Hours();
|
||||
RefreshProperties();
|
||||
}
|
||||
|
||||
private void RefreshProperties() {
|
||||
OnPropertyChanged(nameof(Nominal));
|
||||
OnPropertyChanged(nameof(Overtime));
|
||||
OnPropertyChanged(nameof(OvertimeMonth));
|
||||
OnPropertyChanged(nameof(ZeitCalculated));
|
||||
OnPropertyChanged(nameof(ZeitDone));
|
||||
OnPropertyChanged(nameof(Hours));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user