Statistiques
| Branche: | Révision:

root / GES_PAC / ViewModel / MainViewModel.cs @ 4e39035b

Historique | Voir | Annoter | Télécharger (1,37 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.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
            this.connService = connService;
30
            GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage());
31
        }
32
        #endregion
33

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