GotoAsync Variante

This commit is contained in:
2024-10-12 17:19:38 +02:00
parent a7a940a70b
commit e2f029893e

View File

@@ -11,7 +11,7 @@ using System.Globalization;
using System;
namespace Jugenddienst_Stunden.ViewModels;
namespace Jugenddienst_Stunden.ViewModels;
internal class StundenViewModel : ObservableObject, IQueryAttributable {
public string Name => AppInfo.Name;
public string Surname => AppInfo.VersionString;
@@ -119,7 +119,7 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable {
public static string apiKey = Preferences.Default.Get("apiKey", "");
public StundenViewModel() {
_hour = new Types.Hours();
LoadDataCommand = new AsyncRelayCommand(LoadData);
@@ -139,9 +139,11 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable {
}
private async Task SelectEntryAsync(DayTime entry) {
if (entry != null && entry.id != null)
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
if (entry != null && entry.id != null) {
var navigationParameters = new Dictionary<string, object> {{ "load", entry.id }};
//await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}", navigationParameters);
} else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
}