Révision 9fd69a0e GES_PAC/ViewModel/ChambersViewModel.cs
GES_PAC/ViewModel/ChambersViewModel.cs | ||
---|---|---|
17 | 17 |
#endregion |
18 | 18 |
|
19 | 19 |
#region Propriétés |
20 |
|
|
21 |
public Dictionary<int, int> NumberMeasure { get; set; }
|
|
22 |
public ObservableCollection<Color> ChamberColors { get; } = [];
|
|
23 |
public ObservableCollection<int> ChamberNumbers { get; } = [];
|
|
20 |
public ObservableCollection<Color> ChamberColors { get; set; } = []; |
|
21 |
public ObservableCollection<int> ChamberNumbers { get; set; } = [];
|
|
22 |
public ObservableCollection<bool> ChamberIsIn { get; set; } = [];
|
|
23 |
public Serie CurrentSet { get; set; }
|
|
24 | 24 |
|
25 | 25 |
#endregion |
26 | 26 |
|
... | ... | |
36 | 36 |
JourneeViewModel.Instance.Journees.Add(newDay); |
37 | 37 |
//ONLY FOR TESTS |
38 | 38 |
|
39 |
NumberMeasure = JourneeViewModel.Instance.GetCurrentDay().GetCurrentSet().GetMeasureNumber();
|
|
39 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet();
|
|
40 | 40 |
UpdateChamberDatas(); |
41 | 41 |
|
42 | 42 |
OnClickChamberCommand = new Command<string>(async (idStr) => |
... | ... | |
53 | 53 |
if (IsBusy) return; |
54 | 54 |
IsBusy = true; |
55 | 55 |
|
56 |
if (!NumberMeasure.ContainsKey(id))
|
|
56 |
if (CurrentSet.GetMeasureNumberByNumeroBoite(id) == 0)
|
|
57 | 57 |
await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}"); |
58 | 58 |
else |
59 | 59 |
await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={id}"); |
... | ... | |
63 | 63 |
|
64 | 64 |
private void UpdateChamberDatas() |
65 | 65 |
{ |
66 |
ChamberColors.Clear();
|
|
66 |
ChamberIsIn = JourneeViewModel.Instance.GetCurrentSet().GetIsOutDatas();
|
|
67 | 67 |
for (int i = 1; i <= 12; i++) |
68 | 68 |
{ |
69 |
int count = NumberMeasure.TryGetValue(i, out var val) ? val : 0; |
|
70 |
ChamberColors.Add(count > 0 ? Colors.LightGreen : Colors.White); |
|
69 |
bool hasBehaviour = CurrentSet.GetHasBehaviourByNumeroBoite(i); |
|
70 |
int count = CurrentSet.GetMeasureNumberByNumeroBoite(i); |
|
71 |
if (hasBehaviour) |
|
72 |
ChamberColors.Add(Colors.Yellow); |
|
73 |
else |
|
74 |
ChamberColors.Add(count > 0 ? Colors.LightGreen : Colors.White); |
|
71 | 75 |
ChamberNumbers.Add(count); |
72 | 76 |
} |
73 | 77 |
} |
Formats disponibles : Unified diff