Versionshinweis hinzugefügt

This commit is contained in:
2025-02-17 10:16:53 +01:00
parent c277cfa02d
commit 67d662a0a7
3 changed files with 15 additions and 4 deletions

View File

@@ -30,4 +30,9 @@ public class Settings {
public List<Freistellung>? Freistellungen { get; set; } public List<Freistellung>? Freistellungen { get; set; }
public List<Sollstunden> Nominal { get; set; } public List<Sollstunden> Nominal { get; set; }
/// <summary>
/// Version der API
/// </summary>
public string Version { get; set; }
} }

View File

@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
using System.Windows.Input; using System.Windows.Input;
using CommunityToolkit.Maui.Alerts; using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Jugenddienst_Stunden.ViewModels; namespace Jugenddienst_Stunden.ViewModels;
@@ -195,6 +196,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable,
try { try {
BaseResponse dat = await HoursBase.LoadBase("hours&month=" + DateToday.ToString("MM")); BaseResponse dat = await HoursBase.LoadBase("hours&month=" + DateToday.ToString("MM"));
_hour = dat.hour; _hour = dat.hour;
if (dat.settings.Version != AppInfo.Current.VersionString) {
InfoEvent?.Invoke(this, "Du solltest deine Programmversion: " + AppInfo.Current.VersionString + " auf Version: " + dat.settings.Version + " updaten");
}
//_hour = await HoursBase.LoadData(); //_hour = await HoursBase.LoadData();
RefreshProperties(); RefreshProperties();
} catch (Exception e) { } catch (Exception e) {
@@ -217,12 +222,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable,
Settings = dat.settings; Settings = dat.settings;
GemeindeAktivSet = Settings.GemeindeAktivSet; GemeindeAktivSet = Settings.GemeindeAktivSet;
ProjektAktivSet = Settings.ProjektAktivSet; ProjektAktivSet = Settings.ProjektAktivSet;
OnPropertyChanged(nameof(GemeindeAktivSet)); OnPropertyChanged(nameof(GemeindeAktivSet));
OnPropertyChanged(nameof(ProjektAktivSet)); OnPropertyChanged(nameof(ProjektAktivSet));
List<Sollstunden> _soll; List<Sollstunden> _soll;
TimeSpan span = TimeSpan.Zero; TimeSpan span = TimeSpan.Zero;
bool merker = false; bool merker = false;
@@ -249,7 +252,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable,
} catch (Exception e) { } catch (Exception e) {
DayTimes = new List<DayTime>(); DayTimes = new List<DayTime>();
//TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch. //TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch.
InfoEvent?.Invoke(this, e.Message);
if (Settings.Version != AppInfo.Current.VersionString) {
InfoEvent?.Invoke(this, "Du solltest deine Programmversion: " + AppInfo.Current.VersionString + " auf Version: " + Settings.Version + " updaten");
} else { InfoEvent?.Invoke(this, e.Message); }
} finally { } finally {
OnPropertyChanged(nameof(DayTotal)); OnPropertyChanged(nameof(DayTotal));
OnPropertyChanged(nameof(Sollstunden)); OnPropertyChanged(nameof(Sollstunden));

View File

@@ -55,7 +55,7 @@ public partial class StundenPage : ContentPage {
MainThread.BeginInvokeOnMainThread(async () => { MainThread.BeginInvokeOnMainThread(async () => {
CancellationTokenSource cts = new CancellationTokenSource(); CancellationTokenSource cts = new CancellationTokenSource();
ToastDuration duration = ToastDuration.Short; ToastDuration duration = ToastDuration.Short;
double fontSize = 20; double fontSize = 16;
var toast = Toast.Make(e, duration, fontSize); var toast = Toast.Make(e, duration, fontSize);
await toast.Show(cts.Token); await toast.Show(cts.Token);
}); });