Révision 4afea73d GES_PAC/ViewModel/ChambersViewModel.cs

Voir les différences:

GES_PAC/ViewModel/ChambersViewModel.cs
21 21
        public Dictionary<int, int> NumberMeasure { get; set; }
22 22

  
23 23
        public ObservableCollection<Color> ChamberColors { get; } = [];
24
        public ObservableCollection<int> ChamberNumbers { get; } = [];
24 25

  
25 26
        #endregion
26 27

  
......
28 29
        public ChambersViewModel()
29 30
        {
30 31
            NumberMeasure = JourneeViewModel.Instance.GetCurrentDay().GetCurrentSet().GetMeasureNumber();
31
            UpdateChamberColors();
32
            UpdateChamberDatas();
32 33

  
33 34
            OnClickChamberCommand = new Command<string>(async (idStr) =>
34 35
            {
......
42 43
        private async Task GoToEnterAnimal(int id)
43 44
        {
44 45
            IsBusy = true;
45
            await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}");
46

  
47
            if (!NumberMeasure.ContainsValue(id))
48
                await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}");
49
            else
50
                await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={id}");
51

  
46 52
            IsBusy = false;
47 53
        }
48 54

  
49
        private void UpdateChamberColors()
55
        private void UpdateChamberDatas()
50 56
        {
51 57
            ChamberColors.Clear();
52 58
            for (int i = 1; i <= 12; i++)
53 59
            {
54 60
                int count = NumberMeasure.TryGetValue(i, out var val) ? val : 0;
55 61
                ChamberColors.Add(count > 0 ? Colors.LightGreen : Colors.White);
62
                ChamberNumbers.Add(count);
56 63
            }
57 64
        }
58 65
        #endregion

Formats disponibles : Unified diff