Anpassungen Detailseite

Auswahlliste Gemeinden und Projekte
This commit is contained in:
2024-09-24 18:30:39 +02:00
parent 16bdacc663
commit a066b9caba
14 changed files with 200 additions and 143 deletions

View File

@@ -1,4 +1,5 @@
using Jugenddienst_Stunden.Models;
using Jugenddienst_Stunden.ViewModels;
using Microsoft.Maui.Controls;
using System.Collections.Generic;
using ZXing.Net.Maui;
@@ -9,6 +10,7 @@ public partial class LoginPage : ContentPage {
private DateTime _lastDetectionTime;
private readonly TimeSpan _detectionInterval = TimeSpan.FromSeconds(5);
private readonly LoginViewModel _loginViewModel = new LoginViewModel();
public LoginPage() {
InitializeComponent();
@@ -42,6 +44,9 @@ public partial class LoginPage : ContentPage {
Preferences.Default.Set("apiKey", barcode.Value);
Preferences.Default.Set("name", op.name);
Preferences.Default.Set("surname", op.surname);
//Preferences.Default.Set("apiUrl", Pre);
_loginViewModel.Server = Preferences.Default.Get("apiUrl", "");
await DisplayAlert("Login erfolgreich", op.name + " " + op.surname, "OK");
} catch (Exception e) {
@@ -51,8 +56,6 @@ public partial class LoginPage : ContentPage {
"OK");
}
});
} else {
MainThread.InvokeOnMainThreadAsync(() => {
@@ -64,17 +67,6 @@ public partial class LoginPage : ContentPage {
}
}
//if (first is null) {
// return;
//}
//Dispatcher.DispatchAsync(async () => {
// await DisplayAlert("Scan-Ergebnis", $"Barcode: {first.Value}", "OK");
//});
//MainThread.InvokeOnMainThreadAsync(() => {
// DisplayAlert("Barcode erkannt", $"Barcode: {first.Format} - {first.Value}", "OK");
// Models.Stunde.apiKey = first.Value;
//});
}
protected override void OnDisappearing() {
@@ -90,6 +82,4 @@ public partial class LoginPage : ContentPage {
barcodeScannerView.IsDetecting = true;
barcodeScannerView.CameraLocation = CameraLocation.Rear;
}
}
}