root / GES_PAC / ViewModel / MainViewModel.cs @ 12ddf7ef
Historique | Voir | Annoter | Télécharger (1,358 ko)
1 | 12ddf7ef | lbihannic | using GES_PAC.Model; |
---|---|---|---|
2 | 18f910c6 | Lucas Bihannic | using GES_PAC.Services; |
3 | 65ad7e66 | Lucas Bihannic | using GES_PAC.View; |
4 | |||
5 | namespace GES_PAC.ViewModel |
||
6 | { |
||
7 | public class MainViewModel : BaseViewModel |
||
8 | { |
||
9 | 18f910c6 | Lucas Bihannic | #region Services |
10 | private readonly ConnexionService connService; |
||
11 | #endregion |
||
12 | |||
13 | #region Commandes |
||
14 | 65ad7e66 | Lucas Bihannic | public Command GoToCreateDayCommand { get; } |
15 | 18f910c6 | Lucas Bihannic | #endregion |
16 | |||
17 | #region Constructeur |
||
18 | public MainViewModel(ConnexionService connService) |
||
19 | 65ad7e66 | Lucas Bihannic | { |
20 | 12ddf7ef | lbihannic | //ONLY FOR TESTS |
21 | var date = DateTime.Now; |
||
22 | var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], ""); |
||
23 | newDay.AddSet(new Serie(date, date, 25, 25, 25)); |
||
24 | newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
||
25 | newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false); |
||
26 | JourneeViewModel.Instance.Journees.Add(newDay); |
||
27 | //ONLY FOR TESTS |
||
28 | |||
29 | 18f910c6 | Lucas Bihannic | this.connService = connService; |
30 | 65ad7e66 | Lucas Bihannic | GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage()); |
31 | } |
||
32 | 18f910c6 | Lucas Bihannic | #endregion |
33 | 65ad7e66 | Lucas Bihannic | |
34 | 18f910c6 | Lucas Bihannic | #region Méthodes |
35 | 65ad7e66 | Lucas Bihannic | private async Task GoToCreateDayPage() |
36 | { |
||
37 | 1019554c | lbihannic | if (IsBusy) return; |
38 | 18f910c6 | Lucas Bihannic | IsBusy = true; |
39 | 65ad7e66 | Lucas Bihannic | await Shell.Current.GoToAsync(nameof(CreateDayView)); |
40 | 18f910c6 | Lucas Bihannic | IsBusy = false; |
41 | 65ad7e66 | Lucas Bihannic | } |
42 | 18f910c6 | Lucas Bihannic | #endregion |
43 | 65ad7e66 | Lucas Bihannic | } |
44 | } |