root / GES_PAC / ViewModel / SetListViewModel.cs @ 4e39035b
Historique | Voir | Annoter | Télécharger (1,564 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 |
#endregion |
31 |
|
32 |
#region Constructeur |
33 |
public SetListViewModel() |
34 |
{ |
35 |
GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage()); |
36 |
GoToLastSetCommand = new Command(async () => await GoToLastSetPage()); |
37 |
|
38 |
HasLastSet = JourneeViewModel.Instance.GetCurrentDay().HasAnySet(); |
39 |
} |
40 |
#endregion |
41 |
|
42 |
#region Méthodes |
43 |
private async Task GoToCreateSetPage() |
44 |
{ |
45 |
if (IsBusy) return; |
46 |
IsBusy = true; |
47 |
await Shell.Current.GoToAsync(nameof(CreateSetView)); |
48 |
IsBusy = false; |
49 |
} |
50 |
|
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 |
#endregion |
59 |
} |
60 |
} |
61 |
|