root / GES_PAC / ViewModel / SetListViewModel.cs @ 4e39035b
Historique | Voir | Annoter | Télécharger (1,564 ko)
1 | 09d4a0de | lbihannic | using System.Windows.Input; |
---|---|---|---|
2 | using GES_PAC.View; |
||
3 | |||
4 | |||
5 | namespace GES_PAC.ViewModel |
||
6 | { |
||
7 | public class SetListViewModel : BaseViewModel |
||
8 | { |
||
9 | 4e39035b | lbihannic | #region Attributs |
10 | private bool _hasLastSet = false; |
||
11 | #endregion |
||
12 | |||
13 | #region Propriétés |
||
14 | public bool HasLastSet |
||
15 | { |
||
16 | get => _hasLastSet; |
||
17 | set |
||
18 | { |
||
19 | SetProperty(ref _hasLastSet, value); |
||
20 | OnPropertyChanged(); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | public string LastSetText => HasLastSet ? "Série existante. La reprendre ?" : "Aucune série trouvée"; |
||
25 | 09d4a0de | lbihannic | #endregion |
26 | |||
27 | #region Commandes |
||
28 | public ICommand GoToCreateSetCommand { get; } |
||
29 | 4e39035b | lbihannic | public ICommand GoToLastSetCommand { get; } |
30 | 09d4a0de | lbihannic | #endregion |
31 | |||
32 | #region Constructeur |
||
33 | public SetListViewModel() |
||
34 | { |
||
35 | GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage()); |
||
36 | 4e39035b | lbihannic | GoToLastSetCommand = new Command(async () => await GoToLastSetPage()); |
37 | |||
38 | HasLastSet = JourneeViewModel.Instance.GetCurrentDay().HasAnySet(); |
||
39 | 09d4a0de | lbihannic | } |
40 | #endregion |
||
41 | |||
42 | #region Méthodes |
||
43 | private async Task GoToCreateSetPage() |
||
44 | { |
||
45 | 1019554c | lbihannic | if (IsBusy) return; |
46 | 09d4a0de | lbihannic | IsBusy = true; |
47 | await Shell.Current.GoToAsync(nameof(CreateSetView)); |
||
48 | IsBusy = false; |
||
49 | } |
||
50 | 4e39035b | lbihannic | |
51 | private async Task GoToLastSetPage() |
||
52 | { |
||
53 | if (IsBusy) return; |
||
54 | IsBusy = true; |
||
55 | await Shell.Current.GoToAsync(nameof(ChambersView)); |
||
56 | IsBusy = false; |
||
57 | } |
||
58 | 09d4a0de | lbihannic | #endregion |
59 | } |
||
60 | } |