Swipe down to refresh
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Jugenddienst_Stunden.Types;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -20,13 +21,25 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
public ICommand NewEntryCommand { get; }
|
||||
public ICommand SelectEntryCommand { get; }
|
||||
public ICommand LoadDataCommand { get; private set; }
|
||||
public ICommand LoadDayCommand { get; private set; }
|
||||
public ICommand RefreshListCommand { get; }
|
||||
public ICommand RefreshCommand { get; }
|
||||
|
||||
public event EventHandler<string> AlertEvent;
|
||||
public event EventHandler<string> AlertEvent;
|
||||
public event EventHandler<string> InfoEvent;
|
||||
|
||||
private bool isRefreshing;
|
||||
public bool IsRefreshing {
|
||||
get => isRefreshing;
|
||||
set {
|
||||
if (isRefreshing != value) {
|
||||
isRefreshing = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _title = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
||||
private string _title = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
||||
public string Title {
|
||||
get => _title;
|
||||
set => SetProperty(ref _title, value);
|
||||
@@ -76,11 +89,12 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
dateToday = value;
|
||||
//GetDay = value;
|
||||
//OnPropertyChanged();
|
||||
_ = LoadDay(value);
|
||||
}
|
||||
Task.Run(() => LoadDay(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Monatsübersicht: Geleistete Stunden
|
||||
/// </summary>
|
||||
@@ -137,7 +151,9 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
|
||||
Task task = LoadDay(DateTime.Today);
|
||||
|
||||
}
|
||||
RefreshCommand = new Command(async () => await RefreshItemsAsync());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -219,10 +235,21 @@ internal class StundenViewModel : ObservableObject, IQueryAttributable, INotifyP
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes all properties
|
||||
/// </summary>
|
||||
private void RefreshProperties() {
|
||||
|
||||
private async Task RefreshItemsAsync() {
|
||||
IsRefreshing = true;
|
||||
|
||||
// Fügen Sie hier die Logik zum Aktualisieren der Daten hinzu
|
||||
//await Task.Delay(2000); // Simuliert eine Datenaktualisierung
|
||||
await LoadDay(DateToday);
|
||||
|
||||
IsRefreshing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes all properties
|
||||
/// </summary>
|
||||
private void RefreshProperties() {
|
||||
OnPropertyChanged(nameof(Nominal));
|
||||
OnPropertyChanged(nameof(Overtime));
|
||||
OnPropertyChanged(nameof(OvertimeMonth));
|
||||
|
||||
Reference in New Issue
Block a user