Révision 9601eaf0
GES_PAC/Model/Comportement.cs | ||
---|---|---|
11 | 11 |
public Comportement(DateTime Time, TypeComportement Type, string Commentaire) |
12 | 12 |
{ |
13 | 13 |
this.Time = Time; |
14 |
this.Type = Type ?? TypeComportement.AUTRE;
|
|
14 |
this.Type = Type; |
|
15 | 15 |
this.Commentaire = Commentaire; |
16 | 16 |
} |
17 | 17 |
} |
GES_PAC/Model/Journee.cs | ||
---|---|---|
48 | 48 |
{ |
49 | 49 |
if (Series.Count == 0) |
50 | 50 |
{ |
51 |
return PhaseCalibration.Debut;
|
|
51 |
return PhaseCalibration.DEBUT;
|
|
52 | 52 |
} |
53 |
return PhaseCalibration.Fin;
|
|
53 |
return PhaseCalibration.FIN;
|
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
public Calibration GetCurrentCalibration() |
... | ... | |
99 | 99 |
} |
100 | 100 |
internal Calibration GetDebutCalibration() |
101 | 101 |
{ |
102 |
return Calibrations.FirstOrDefault(c => c.Phase == PhaseCalibration.Debut);
|
|
102 |
return Calibrations.FirstOrDefault(c => c.Phase == PhaseCalibration.DEBUT);
|
|
103 | 103 |
} |
104 | 104 |
internal bool IsCalibrationComplete(PhaseCalibration pc) |
105 | 105 |
{ |
... | ... | |
107 | 107 |
} |
108 | 108 |
internal bool IsComplete() |
109 | 109 |
{ |
110 |
return Calibrations.FirstOrDefault(c => c.Phase == PhaseCalibration.Fin)?.IsComplete() ?? false;
|
|
110 |
return Calibrations.FirstOrDefault(c => c.Phase == PhaseCalibration.FIN)?.IsComplete() ?? false;
|
|
111 | 111 |
} |
112 | 112 |
#endregion |
113 | 113 |
} |
GES_PAC/Model/PhaseCalibration.cs | ||
---|---|---|
11 | 11 |
Value = value; |
12 | 12 |
} |
13 | 13 |
|
14 |
public static readonly PhaseCalibration Debut = new("DEBUT", 1);
|
|
15 |
public static readonly PhaseCalibration Fin = new("FIN", 2);
|
|
14 |
public static readonly PhaseCalibration DEBUT = new("d?but", 1);
|
|
15 |
public static readonly PhaseCalibration FIN = new("fin", 2);
|
|
16 | 16 |
|
17 |
public static readonly List<PhaseCalibration> All = new() { Debut, Fin };
|
|
17 |
public static readonly List<PhaseCalibration> All = new() { DEBUT, FIN };
|
|
18 | 18 |
|
19 | 19 |
public override string ToString() => Name; |
20 | 20 |
|
GES_PAC/Model/SerieAnimal.cs | ||
---|---|---|
1 |
|
|
1 |
|
|
2 | 2 |
using Microsoft.Maui.Layouts; |
3 | 3 |
|
4 | 4 |
namespace GES_PAC.Model |
... | ... | |
52 | 52 |
{ |
53 | 53 |
return Comportements.Count != 0; |
54 | 54 |
} |
55 |
public string GetTimeInChamber() |
|
55 |
public bool IsTimeWarning() |
|
56 |
{ |
|
57 |
if (Mesures.Count == 0 || IsOut) |
|
58 |
return false; |
|
59 |
return (DateTime.Now - GetFirstMeasure().Time) > TimeSpan.FromHours(1); |
|
60 |
} |
|
61 |
public string GetFormatedTimeInChamber() |
|
56 | 62 |
{ |
57 | 63 |
if (Mesures.Count == 0) |
58 | 64 |
return ""; |
... | ... | |
63 | 69 |
else |
64 | 70 |
timeInChamber = DateTime.Now - GetFirstMeasure().Time; |
65 | 71 |
|
66 |
return $"{timeInChamber.Hours:00}:{timeInChamber.Minutes:00}"; |
|
72 |
return $"{timeInChamber.Hours:00}:{timeInChamber.Minutes:00}" + (IsTimeWarning() ? "⚠" : "");
|
|
67 | 73 |
} |
74 |
|
|
68 | 75 |
} |
69 | 76 |
} |
GES_PAC/View/Controls/ChamberButtonView.xaml | ||
---|---|---|
21 | 21 |
VerticalOptions="Start" /> |
22 | 22 |
|
23 | 23 |
<Label Text="{Binding TimeIn}" |
24 |
TextColor="{Binding TimeColor}" |
|
24 | 25 |
FontSize="12" |
25 | 26 |
Margin="3" |
26 | 27 |
HorizontalOptions="End" |
GES_PAC/View/CreateCalibrationView.xaml | ||
---|---|---|
14 | 14 |
|
15 | 15 |
<VerticalStackLayout Grid.Row="1" Spacing="30"> |
16 | 16 |
|
17 |
<Label Text="Mesure de calibration"
|
|
17 |
<Label Text="{Binding PhaseName, StringFormat='Calibration de {0}'}"
|
|
18 | 18 |
FontSize="20" |
19 | 19 |
FontAttributes="Bold" |
20 | 20 |
HorizontalOptions="Center" /> |
GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs | ||
---|---|---|
14 | 14 |
private bool _buttonIsEnabled; |
15 | 15 |
private string _buttonLabel; |
16 | 16 |
private string _timeIn; |
17 |
private Color _timeColor; |
|
17 | 18 |
private ICommand _onClickChamberCommand; |
18 | 19 |
private readonly TimerPublisher _timer; |
19 | 20 |
|
... | ... | |
80 | 81 |
{ |
81 | 82 |
_timeIn = value; |
82 | 83 |
OnPropertyChanged(); |
84 |
|
|
85 |
} |
|
86 |
} |
|
87 |
public Color TimeColor |
|
88 |
{ |
|
89 |
get => _timeColor; |
|
90 |
set |
|
91 |
{ |
|
92 |
_timeColor = value; |
|
93 |
OnPropertyChanged(); |
|
83 | 94 |
} |
84 | 95 |
} |
85 | 96 |
public SerieAnimal? AnimalSet; |
... | ... | |
156 | 167 |
ButtonIsEnabled = !AnimalSet.IsOut; |
157 | 168 |
ButtonBackgroundColor = AnimalSet.HasBehaviour() ? Colors.Yellow : Colors.LightGreen; |
158 | 169 |
ButtonLabel = measureCount.ToString(); |
159 |
TimeIn = AnimalSet.GetTimeInChamber(); |
|
170 |
TimeIn = AnimalSet.GetFormatedTimeInChamber(); |
|
171 |
TimeColor = AnimalSet.IsTimeWarning() ? Colors.Red : Colors.Black; |
|
160 | 172 |
} |
161 | 173 |
|
174 |
|
|
162 | 175 |
private async Task GoToChamber() |
163 | 176 |
{ |
164 | 177 |
if (IsBusy) return; |
... | ... | |
172 | 185 |
} |
173 | 186 |
public void OnTimerTick(object? sender, EventArgs e) |
174 | 187 |
{ |
175 |
TimeIn = AnimalSet?.GetTimeInChamber() ?? ""; |
|
188 |
TimeIn = AnimalSet?.GetFormatedTimeInChamber() ?? ""; |
|
189 |
TimeColor = AnimalSet?.IsTimeWarning() ?? false ? Colors.Red : Colors.Black; |
|
176 | 190 |
} |
177 | 191 |
|
178 | 192 |
#endregion |
GES_PAC/ViewModel/CreateCalibrationViewModel.cs | ||
---|---|---|
5 | 5 |
|
6 | 6 |
namespace GES_PAC.ViewModel |
7 | 7 |
{ |
8 |
[QueryProperty(nameof(PhaseName), "phase")] |
|
8 | 9 |
public class CreateCalibrationViewModel : BaseViewModel |
9 | 10 |
{ |
10 | 11 |
|
11 | 12 |
#region Attributs |
13 |
public string _phaseName; |
|
12 | 14 |
private TypeCalibration _selectedType; |
13 | 15 |
private double? _conc_o2; |
14 | 16 |
private double? _conc_co2; |
... | ... | |
28 | 30 |
#endregion |
29 | 31 |
|
30 | 32 |
#region Propriétés |
33 |
public PhaseCalibration Phase { get; private set; } |
|
34 |
public string PhaseName |
|
35 |
{ |
|
36 |
get => _phaseName; |
|
37 |
set |
|
38 |
{ |
|
39 |
_phaseName = value; |
|
40 |
Phase = PhaseCalibration.All.FirstOrDefault(p => p.Name == value) ?? PhaseCalibration.DEBUT; |
|
41 |
OnPropertyChanged(); |
|
42 |
} |
|
43 |
} |
|
31 | 44 |
public ObservableCollection<TypeCalibration> TypeCalibrations { get; } |
32 | 45 |
public TypeCalibration SelectedType |
33 | 46 |
{ |
... | ... | |
163 | 176 |
|
164 | 177 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
165 | 178 |
var typesManquants = journeeActuelle.GetCurrentMissingCalibration(); |
179 |
var phaseCalibration = journeeActuelle.GetCurrentPhase(); |
|
166 | 180 |
|
167 | 181 |
TypeCalibrations = new ObservableCollection<TypeCalibration>(typesManquants); |
168 | 182 |
SelectedType = TypeCalibrations[0]; |
169 | 183 |
|
170 |
if (journeeActuelle.GetCurrentPhase() == PhaseCalibration.Fin)
|
|
184 |
if (journeeActuelle.GetCurrentPhase() == PhaseCalibration.FIN)
|
|
171 | 185 |
{ |
172 | 186 |
LastCalibration = journeeActuelle.GetDebutCalibration(); |
173 | 187 |
HasLastMeasure = true; |
... | ... | |
183 | 197 |
|
184 | 198 |
var date = DateTime.Now; |
185 | 199 |
var newCalib = new MesureCalibration(date, ConcO2 ?? 0, ConcCO2 ?? 0, ConcCH4 ?? 0, SelectedType, RefBouteille); |
186 |
var phaseCalibration = JourneeViewModel.Instance.GetCurrentPhase(); |
|
187 |
var isComplete = JourneeViewModel.Instance.GetCurrentDay().AddCalibration(newCalib, phaseCalibration); |
|
200 |
var isComplete = JourneeViewModel.Instance.GetCurrentDay().AddCalibration(newCalib, Phase); |
|
188 | 201 |
|
189 |
var targetView = nameof(CreateCalibrationView);
|
|
202 |
var targetView = $"{nameof(CreateCalibrationView)}?phase={PhaseName}";
|
|
190 | 203 |
if (isComplete) { |
191 |
targetView = phaseCalibration == PhaseCalibration.Debut ? nameof(SetListView) : nameof(MainView);
|
|
204 |
targetView = Phase == PhaseCalibration.DEBUT ? nameof(SetListView) : nameof(MainView);
|
|
192 | 205 |
} |
193 | 206 |
await Shell.Current.GoToAsync(targetView); |
194 | 207 |
|
GES_PAC/ViewModel/CreateDayViewModel.cs | ||
---|---|---|
91 | 91 |
var date = DateTime.Now; |
92 | 92 |
var newDay = new Journee(date, SelectedPerson, SelectedPlace, Regime); |
93 | 93 |
JourneeViewModel.Instance.Journees.Add(newDay); |
94 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView));
|
|
94 |
await Shell.Current.GoToAsync($"{nameof(CreateCalibrationView)}?phase={PhaseCalibration.DEBUT.Name}");
|
|
95 | 95 |
IsBusy = false; |
96 | 96 |
} |
97 | 97 |
|
GES_PAC/ViewModel/EndDayViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.View; |
|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.View; |
|
2 | 3 |
|
3 | 4 |
namespace GES_PAC.ViewModel |
4 | 5 |
{ |
... | ... | |
71 | 72 |
{ |
72 | 73 |
if (IsBusy) return; |
73 | 74 |
IsBusy = true; |
74 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView));
|
|
75 |
await Shell.Current.GoToAsync($"{nameof(CreateCalibrationView)}?phase={PhaseCalibration.FIN.Name}");
|
|
75 | 76 |
IsBusy = false; |
76 | 77 |
} |
77 | 78 |
#endregion |
GES_PAC/ViewModel/MainViewModel.cs | ||
---|---|---|
52 | 52 |
public MainViewModel() |
53 | 53 |
{ |
54 | 54 |
//ONLY FOR TESTS |
55 |
var date = DateTime.Now; |
|
55 |
var date = DateTime.Now.AddHours(-2);
|
|
56 | 56 |
var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], ""); |
57 | 57 |
newDay.AddSet(new Serie(date, date, 25, 25, 25)); |
58 |
newDay.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.Debut);
|
|
59 |
newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.Debut);
|
|
60 |
newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.Debut);
|
|
58 |
newDay.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.DEBUT);
|
|
59 |
newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.DEBUT);
|
|
60 |
newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.DEBUT);
|
|
61 | 61 |
newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
62 | 62 |
newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false); |
63 | 63 |
JourneeViewModel.Instance.Journees.Add(newDay); |
... | ... | |
94 | 94 |
IsBusy = true; |
95 | 95 |
|
96 | 96 |
CurrentDay = JourneeViewModel.Instance.GetCurrentDay(); |
97 |
var targetView = nameof(CreateCalibrationView);
|
|
98 |
if (CurrentDay.IsCalibrationComplete(PhaseCalibration.Debut))
|
|
97 |
var targetView = $"{nameof(CreateCalibrationView)}?phase={PhaseCalibration.DEBUT.Name}";
|
|
98 |
if (CurrentDay.IsCalibrationComplete(PhaseCalibration.DEBUT))
|
|
99 | 99 |
targetView = nameof(SetListView); |
100 | 100 |
|
101 | 101 |
await Shell.Current.GoToAsync(targetView); |
Formats disponibles : Unified diff