Statistiques
| Branche: | Révision:

root / GES_PAC / ViewModel / MainViewModel.cs @ 957b1f34

Historique | Voir | Annoter | Télécharger (1,753 ko)

1
using GES_PAC.Model;
2
using GES_PAC.Services;
3
using GES_PAC.View;
4

    
5
namespace GES_PAC.ViewModel
6
{
7
    public class MainViewModel : BaseViewModel
8
    {
9
        #region Services
10
        private readonly ConnexionService connService;
11
        #endregion
12

    
13
        #region Commandes
14
        public Command GoToCreateDayCommand { get; }
15
        #endregion
16

    
17
        #region Constructeur
18
        public MainViewModel(ConnexionService connService)
19
        {
20
            //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.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.Debut);
25
            newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.Debut);
26
            newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.Debut);
27
            newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, ""));
28
            newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false);
29
            JourneeViewModel.Instance.Journees.Add(newDay);
30
            //ONLY FOR TESTS
31

    
32
            this.connService = connService;
33
            GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage());
34
        }
35
        #endregion
36

    
37
        #region Méthodes
38
        private async Task GoToCreateDayPage()
39
        {
40
            if (IsBusy) return;
41
            IsBusy = true;
42
            await Shell.Current.GoToAsync(nameof(CreateDayView));
43
            IsBusy = false;
44
        }
45
        #endregion
46
    }
47
}