Révision 4e39035b GES_PAC/ViewModel/SetListViewModel.cs

Voir les différences:

GES_PAC/ViewModel/SetListViewModel.cs
1 1
using System.Windows.Input;
2
using GES_PAC.Services;
3 2
using GES_PAC.View;
4 3

  
5 4

  
......
7 6
{
8 7
    public class SetListViewModel : BaseViewModel
9 8
    {
10
        #region Services
11
        private readonly ConnexionService connService;
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";
12 25
        #endregion
13 26

  
14 27
        #region Commandes
15 28
        public ICommand GoToCreateSetCommand { get; }
29
        public ICommand GoToLastSetCommand { get; }
16 30
        #endregion
17 31

  
18 32
        #region Constructeur
19 33
        public SetListViewModel()
20 34
        {
21 35
            GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage());
36
            GoToLastSetCommand = new Command(async () => await GoToLastSetPage());
37

  
38
            HasLastSet = JourneeViewModel.Instance.GetCurrentDay().HasAnySet();
22 39
        }
23 40
        #endregion
24 41

  
......
30 47
            await Shell.Current.GoToAsync(nameof(CreateSetView));
31 48
            IsBusy = false;
32 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
        }
33 58
        #endregion
34 59
    }
35 60
}

Formats disponibles : Unified diff