root / GES_PAC / ViewModel / SetListViewModel.cs @ 957b1f34
Historique | Voir | Annoter | Télécharger (1,902 ko)
1 |
using System.Windows.Input; |
---|---|
2 |
using GES_PAC.View; |
3 |
|
4 |
|
5 |
namespace GES_PAC.ViewModel |
6 |
{ |
7 |
public class SetListViewModel : BaseViewModel |
8 |
{ |
9 |
#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 |
#endregion |
26 |
|
27 |
#region Commandes |
28 |
public ICommand GoToCreateSetCommand { get; } |
29 |
public ICommand GoToLastSetCommand { get; } |
30 |
public ICommand GoToEndDayCommand { get; } |
31 |
#endregion |
32 |
|
33 |
#region Constructeur |
34 |
public SetListViewModel() |
35 |
{ |
36 |
GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage()); |
37 |
GoToLastSetCommand = new Command(async () => await GoToLastSetPage()); |
38 |
GoToEndDayCommand = new Command(async () => await GoToEndDayPage()); |
39 |
|
40 |
HasLastSet = JourneeViewModel.Instance.GetCurrentDay().HasAnySet(); |
41 |
} |
42 |
#endregion |
43 |
|
44 |
#region Méthodes |
45 |
private async Task GoToCreateSetPage() |
46 |
{ |
47 |
if (IsBusy) return; |
48 |
IsBusy = true; |
49 |
await Shell.Current.GoToAsync(nameof(CreateSetView)); |
50 |
IsBusy = false; |
51 |
} |
52 |
|
53 |
private async Task GoToLastSetPage() |
54 |
{ |
55 |
if (IsBusy) return; |
56 |
IsBusy = true; |
57 |
await Shell.Current.GoToAsync(nameof(ChambersView)); |
58 |
IsBusy = false; |
59 |
} |
60 |
private async Task GoToEndDayPage() |
61 |
{ |
62 |
if (IsBusy) return; |
63 |
IsBusy = true; |
64 |
await Shell.Current.GoToAsync(nameof(EndDayView)); |
65 |
IsBusy = false; |
66 |
} |
67 |
#endregion |
68 |
} |
69 |
} |
70 |
|