Révision 3fef487c GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs
GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs | ||
---|---|---|
1 | 1 |
using GES_PAC.Model; |
2 | 2 |
using GES_PAC.View; |
3 |
using System.ComponentModel.Design; |
|
3 | 4 |
using System.Windows.Input; |
4 | 5 |
|
5 | 6 |
namespace GES_PAC.ViewModel.Controls |
... | ... | |
139 | 140 |
ButtonIsEnabled = true; |
140 | 141 |
ButtonLabel = "0"; |
141 | 142 |
TimeIn = ""; |
143 |
TimeColor = Colors.Black; |
|
142 | 144 |
} |
143 | 145 |
public void UpdateProperties() |
144 | 146 |
{ |
... | ... | |
164 | 166 |
_isSubscribed = false; |
165 | 167 |
} |
166 | 168 |
|
169 |
UpdateTimerColor(); |
|
167 | 170 |
ButtonIsEnabled = !AnimalSet.IsOut; |
168 | 171 |
ButtonBackgroundColor = AnimalSet.HasBehaviour() ? Colors.Yellow : Colors.LightGreen; |
169 | 172 |
ButtonLabel = measureCount.ToString(); |
170 | 173 |
TimeIn = AnimalSet.GetFormatedTimeInChamber(); |
171 |
TimeColor = AnimalSet.IsTimeWarning() ? Colors.Red : Colors.Black; |
|
172 | 174 |
} |
173 | 175 |
|
174 | 176 |
|
... | ... | |
186 | 188 |
public void OnTimerTick(object? sender, EventArgs e) |
187 | 189 |
{ |
188 | 190 |
TimeIn = AnimalSet?.GetFormatedTimeInChamber() ?? ""; |
189 |
TimeColor = AnimalSet?.IsTimeWarning() ?? false ? Colors.Red : Colors.Black; |
|
191 |
UpdateTimerColor(); |
|
192 |
} |
|
193 |
public void UpdateTimerColor() |
|
194 |
{ |
|
195 |
var nbMesure = AnimalSet?.GetMeasureCount() ?? 0; |
|
196 |
var min = AnimalSet?.GetMinInChamber() ?? 0; |
|
197 |
|
|
198 |
if (nbMesure == 1 && min >= 25 || |
|
199 |
nbMesure == 2 && (min >= 50 || (AnimalSet.GetLastMeasure().Conc_CO2 > 2 && min >= 40)) || |
|
200 |
AnimalSet?.IsTimeWarning() == true) |
|
201 |
TimeColor = Colors.Red; |
|
190 | 202 |
} |
191 | 203 |
|
192 | 204 |
#endregion |
Formats disponibles : Unified diff