Initial commit
This commit is contained in:
49
Jugenddienst Stunden/ViewModels/StundenViewModel.cs
Normal file
49
Jugenddienst Stunden/ViewModels/StundenViewModel.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
internal class StundenViewModel : ObservableObject {
|
||||
public string Name => AppInfo.Name;
|
||||
public string Surname => AppInfo.VersionString;
|
||||
public string MoreInfoUrl => "https://aka.ms/maui";
|
||||
public string Message => "Hier werden deine geleisteten Arbeitsstunden aufgelistet";
|
||||
public ICommand LoadDataCommand { get; private set; }
|
||||
public object Stunden { get; }
|
||||
|
||||
private Models.Hours _hour;
|
||||
public Models.Hours Hours {
|
||||
get => _hour;
|
||||
}
|
||||
public string Nominal {
|
||||
get => _hour.nominal;
|
||||
}
|
||||
public string Overtime {
|
||||
get => _hour.overtime;
|
||||
}
|
||||
public string OvertimeMonth {
|
||||
get => _hour.overtime_month;
|
||||
}
|
||||
|
||||
public StundenViewModel() {
|
||||
_hour = new Models.Hours();
|
||||
LoadDataCommand = new AsyncRelayCommand(LoadData);
|
||||
}
|
||||
|
||||
//public async Task LoadData() =>
|
||||
// await Models.Stunde.LoadData();
|
||||
|
||||
public async Task LoadData() {
|
||||
_hour = await Models.Stunde.LoadData();
|
||||
RefreshProperties();
|
||||
}
|
||||
|
||||
private void RefreshProperties() {
|
||||
OnPropertyChanged(nameof(Nominal));
|
||||
OnPropertyChanged(nameof(Overtime));
|
||||
OnPropertyChanged(nameof(OvertimeMonth));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user