Révision 612877b5
GES_PAC/View/CreateMeasureView.xaml | ||
---|---|---|
17 | 17 |
FontSize="20" |
18 | 18 |
FontAttributes="Bold" |
19 | 19 |
HorizontalOptions="Center" /> |
20 |
|
|
21 |
<Label Text="{Binding LastTime}" |
|
22 |
FontSize="14" |
|
23 |
FontAttributes="Bold" |
|
24 |
HorizontalOptions="Center" |
|
25 |
IsVisible="{Binding HasLastMeasure}"/> |
|
26 |
|
|
20 | 27 |
<VerticalStackLayout Spacing="15" WidthRequest="300"> |
21 | 28 |
|
22 | 29 |
<!-- CH4 --> |
... | ... | |
29 | 36 |
TextColor="Black" |
30 | 37 |
Placeholder="0,0" |
31 | 38 |
Keyboard="Numeric"> |
32 |
<Entry.Triggers> |
|
33 |
<DataTrigger TargetType="Entry" Binding="{Binding HasLastMeasure}" Value="False"> |
|
34 |
<Setter Property="Grid.ColumnSpan" Value="2" /> |
|
35 |
</DataTrigger> |
|
36 |
</Entry.Triggers> |
|
37 | 39 |
</Entry> |
38 | 40 |
<Label Grid.Column="1" |
39 | 41 |
Text="{Binding LastCH4, StringFormat='[{0} ppm]'}" |
40 | 42 |
FontSize="16" |
41 |
TextColor="Gray"
|
|
43 |
TextColor="{Binding LastCH4Color}"
|
|
42 | 44 |
VerticalOptions="Center" |
43 | 45 |
HorizontalOptions="End" |
44 | 46 |
IsVisible="{Binding HasLastMeasure}" /> |
... | ... | |
61 | 63 |
TextColor="Black" |
62 | 64 |
Placeholder="0,0" |
63 | 65 |
Keyboard="Numeric"> |
64 |
<Entry.Triggers> |
|
65 |
<DataTrigger TargetType="Entry" Binding="{Binding HasLastMeasure}" Value="False"> |
|
66 |
<Setter Property="Grid.ColumnSpan" Value="2" /> |
|
67 |
</DataTrigger> |
|
68 |
</Entry.Triggers> |
|
69 | 66 |
</Entry> |
70 | 67 |
<Label Grid.Column="1" |
71 | 68 |
Text="{Binding LastO2, StringFormat='[{0} %]'}" |
72 | 69 |
FontSize="16" |
73 |
TextColor="Gray"
|
|
70 |
TextColor="{Binding LastO2Color}"
|
|
74 | 71 |
VerticalOptions="Center" |
75 | 72 |
HorizontalOptions="End" |
76 | 73 |
IsVisible="{Binding HasLastMeasure}" /> |
... | ... | |
93 | 90 |
TextColor="Black" |
94 | 91 |
Placeholder="0,0" |
95 | 92 |
Keyboard="Numeric"> |
96 |
<Entry.Triggers> |
|
97 |
<DataTrigger TargetType="Entry" Binding="{Binding HasLastMeasure}" Value="False"> |
|
98 |
<Setter Property="Grid.ColumnSpan" Value="2" /> |
|
99 |
</DataTrigger> |
|
100 |
</Entry.Triggers> |
|
101 | 93 |
</Entry> |
102 | 94 |
<Label Grid.Column="1" |
103 | 95 |
Text="{Binding LastCO2, StringFormat='[{0} %]'}" |
104 | 96 |
FontSize="16" |
105 |
TextColor="Gray"
|
|
97 |
TextColor="{Binding LastCO2Color}"
|
|
106 | 98 |
VerticalOptions="Center" |
107 | 99 |
HorizontalOptions="End" |
108 | 100 |
IsVisible="{Binding HasLastMeasure}" /> |
... | ... | |
120 | 112 |
</ScrollView> |
121 | 113 |
<StackLayout |
122 | 114 |
Margin="10" |
123 |
HorizontalOptions="CenterAndExpand"
|
|
115 |
HorizontalOptions="Center" |
|
124 | 116 |
Orientation="Horizontal" |
125 | 117 |
VerticalOptions="FillAndExpand"> |
126 | 118 |
|
127 | 119 |
<Button |
128 |
Text="Enregistrer les mesures" |
|
120 |
Text="Comportements" |
|
121 |
BackgroundColor="Orange" |
|
122 |
TextColor="White" |
|
123 |
Command="{Binding ComportementsCommand}" |
|
124 |
Style="{StaticResource btnNormal}" |
|
125 |
VerticalOptions="End" |
|
126 |
Margin="0,0,10,0"/> |
|
127 |
|
|
128 |
<Button |
|
129 |
Text="Enregistrer" |
|
129 | 130 |
Command="{Binding CreateMeasureCommand}" |
130 | 131 |
Style="{StaticResource btnNormal}" |
131 | 132 |
IsEnabled="{Binding IsFormValid}" |
GES_PAC/ViewModel/ChambersViewModel.cs | ||
---|---|---|
53 | 53 |
if (IsBusy) return; |
54 | 54 |
IsBusy = true; |
55 | 55 |
|
56 |
if (!NumberMeasure.ContainsValue(id))
|
|
56 |
if (!NumberMeasure.ContainsKey(id))
|
|
57 | 57 |
await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}"); |
58 | 58 |
else |
59 | 59 |
await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={id}"); |
GES_PAC/ViewModel/CreateMeasureViewModel.cs | ||
---|---|---|
18 | 18 |
private double? _lastO2; |
19 | 19 |
private double? _lastCO2; |
20 | 20 |
private double? _lastCH4; |
21 |
private string _lastTime; |
|
22 |
private Color _lastCH4Color; |
|
23 |
private Color _lastO2Color; |
|
24 |
private Color _lastCO2Color; |
|
25 |
|
|
21 | 26 |
#endregion |
22 | 27 |
|
23 | 28 |
#region Commandes |
... | ... | |
45 | 50 |
_conc_o2 = value; |
46 | 51 |
OnPropertyChanged(); |
47 | 52 |
ValidateForm(); |
53 |
UpdateColors(); |
|
48 | 54 |
} |
49 | 55 |
} |
50 | 56 |
|
... | ... | |
56 | 62 |
_conc_co2 = value; |
57 | 63 |
OnPropertyChanged(); |
58 | 64 |
ValidateForm(); |
65 |
UpdateColors(); |
|
59 | 66 |
} |
60 | 67 |
} |
61 | 68 |
|
... | ... | |
67 | 74 |
_conc_ch4 = value; |
68 | 75 |
OnPropertyChanged(); |
69 | 76 |
ValidateForm(); |
77 |
UpdateColors(); |
|
70 | 78 |
} |
71 | 79 |
} |
72 | 80 |
public bool HasLastMeasure |
... | ... | |
105 | 113 |
OnPropertyChanged(); |
106 | 114 |
} |
107 | 115 |
} |
116 |
public string LastTime |
|
117 |
{ |
|
118 |
get => _lastTime; |
|
119 |
set |
|
120 |
{ |
|
121 |
_lastTime = value; |
|
122 |
OnPropertyChanged(); |
|
123 |
} |
|
124 |
} |
|
125 |
public Color LastCH4Color |
|
126 |
{ |
|
127 |
get => _lastCH4Color; |
|
128 |
set |
|
129 |
{ |
|
130 |
_lastCH4Color = value; |
|
131 |
OnPropertyChanged(); |
|
132 |
} |
|
133 |
} |
|
134 |
public Color LastO2Color |
|
135 |
{ |
|
136 |
get => _lastO2Color; |
|
137 |
set |
|
138 |
{ |
|
139 |
_lastO2Color = value; |
|
140 |
OnPropertyChanged(); |
|
141 |
} |
|
142 |
} |
|
143 |
public Color LastCO2Color |
|
144 |
{ |
|
145 |
get => _lastCO2Color; |
|
146 |
set |
|
147 |
{ |
|
148 |
_lastCO2Color = value; |
|
149 |
OnPropertyChanged(); |
|
150 |
} |
|
151 |
} |
|
108 | 152 |
public bool IsFormValid |
109 | 153 |
{ |
110 | 154 |
get => _isFormValid; |
... | ... | |
171 | 215 |
LastO2 = LastMeasure.Conc_O2; |
172 | 216 |
LastCO2 = LastMeasure.Conc_CO2; |
173 | 217 |
LastCH4 = LastMeasure.Conc_CH4; |
218 |
LastTime = "Dernière mesure : " + (int)(DateTime.Now - LastMeasure.Time).TotalMinutes + " min"; |
|
219 |
UpdateColors(); |
|
174 | 220 |
} |
175 | 221 |
} |
222 |
private void UpdateColors() |
|
223 |
{ |
|
224 |
LastCH4Color = (ConcCH4 < LastCH4) ? Colors.Orange : Colors.Gray; |
|
225 |
LastO2Color = (ConcO2 > LastO2) ? Colors.Orange : Colors.Gray; |
|
226 |
LastCO2Color = (ConcCO2 < LastCO2) ? Colors.Orange : Colors.Gray; |
|
227 |
} |
|
176 | 228 |
#endregion |
177 | 229 |
} |
178 | 230 |
} |
Formats disponibles : Unified diff