Barcodes speichern

This commit is contained in:
2024-08-21 00:11:59 +02:00
parent a61aa38d24
commit 423e5f3cd2
12 changed files with 142 additions and 49 deletions

View File

@@ -7,19 +7,21 @@ namespace Jugenddienst_Stunden.ViewModels {
internal class AboutViewModel {
public string Title => AppInfo.Name;
public string Version => AppInfo.VersionString;
public string MoreInfoUrl => "https://aka.ms/maui";
public string Message => "This app is written in XAML and C# with .NET MAUI.";
public ICommand ShowMoreInfoCommand { get; }
public string Message => "Scanne den QR-Code von deinem Benutzerprofil auf der Stundenseite.";
public AboutViewModel() {
ShowMoreInfoCommand = new AsyncRelayCommand(ShowMoreInfo);
}
async Task ShowMoreInfo() =>
await Launcher.Default.OpenAsync(MoreInfoUrl);
//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 {
@@ -44,7 +46,7 @@ namespace Jugenddienst_Stunden.ViewModels {
// }
//}
}
}

View File

@@ -3,6 +3,7 @@ using CommunityToolkit.Mvvm.Input;
using System.Windows.Input;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Networking;
using ZXing.Net.Maui;
namespace Jugenddienst_Stunden.ViewModels {
@@ -33,6 +34,7 @@ namespace Jugenddienst_Stunden.ViewModels {
public string OvertimeMonth {
get => _hour.overtime_month;
}
public string Title { get; set; } = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
public StundenViewModel() {
_hour = new Models.Hours();
@@ -43,9 +45,10 @@ namespace Jugenddienst_Stunden.ViewModels {
// await Models.Stunde.LoadData();
public async Task LoadData() {
_hour = await Models.Stunde.LoadData();
Models.Hours Hours = new Models.Hours();
RefreshProperties();
_hour = await Models.Stunde.LoadData();
Models.Hours Hours = new Models.Hours();
//Title = _hour.operator_api.name + " " + _hour.operator_api.surname;
RefreshProperties();
}
private void RefreshProperties() {
@@ -55,8 +58,9 @@ namespace Jugenddienst_Stunden.ViewModels {
OnPropertyChanged(nameof(ZeitCalculated));
OnPropertyChanged(nameof(ZeitDone));
OnPropertyChanged(nameof(Hours));
OnPropertyChanged(nameof(Title));
}
}
}