Révision 12ddf7ef
GES_PAC/Controls/DoubleEntry.cs | ||
---|---|---|
1 |
using System.Globalization; |
|
2 |
|
|
3 |
namespace GES_PAC.Controls |
|
4 |
{ |
|
5 |
public class DoubleEntry : Entry |
|
6 |
{ |
|
7 |
public DoubleEntry() |
|
8 |
{ |
|
9 |
Keyboard = Keyboard.Numeric; |
|
10 |
PlaceholderColor = Colors.LightGray; |
|
11 |
TextColor = Colors.Black; |
|
12 |
Placeholder = "0,0"; |
|
13 |
FontSize = 16; |
|
14 |
} |
|
15 |
} |
|
16 |
} |
GES_PAC/GES_PAC.csproj | ||
---|---|---|
96 | 96 |
<MauiXaml Update="View\ChambersView.xaml"> |
97 | 97 |
<Generator>MSBuild:Compile</Generator> |
98 | 98 |
</MauiXaml> |
99 |
<MauiXaml Update="View\Controls\ChamberButtonView.xaml"> |
|
100 |
<Generator>MSBuild:Compile</Generator> |
|
101 |
</MauiXaml> |
|
99 | 102 |
<MauiXaml Update="View\CreateCalibrationView.xaml"> |
100 | 103 |
<Generator>MSBuild:Compile</Generator> |
101 | 104 |
</MauiXaml> |
GES_PAC/Model/Journee.cs | ||
---|---|---|
44 | 44 |
return existing.IsComplete(); |
45 | 45 |
} |
46 | 46 |
|
47 |
public void AddSerie(Serie set)
|
|
47 |
public void AddSet(Serie set)
|
|
48 | 48 |
{ |
49 | 49 |
Series.Add(set); |
50 | 50 |
} |
GES_PAC/Model/Serie.cs | ||
---|---|---|
51 | 51 |
return false; |
52 | 52 |
return sa.HasBehaviour(); |
53 | 53 |
} |
54 |
|
|
55 |
public ObservableCollection<bool> GetIsOutDatas() |
|
54 |
public bool GetIsInByNumeroBoite(int numeroBoite) |
|
56 | 55 |
{ |
57 |
var isOutDatas = new ObservableCollection<bool>(); |
|
58 |
for (int i = 1; i <= 12; i++) |
|
59 |
{ |
|
60 |
var serieAnimal = SeriesAnimales.FirstOrDefault(sa => sa.NumeroBoite == i); |
|
61 |
isOutDatas.Add(!serieAnimal?.IsOut ?? true); |
|
62 |
} |
|
63 |
return isOutDatas; |
|
56 |
var serieAnimal = SeriesAnimales.FirstOrDefault(sa => sa.NumeroBoite == numeroBoite); |
|
57 |
if (serieAnimal == null || !serieAnimal.Mesures.Any()) |
|
58 |
return true; |
|
59 |
return !serieAnimal?.IsOut ?? true; |
|
64 | 60 |
} |
65 | 61 |
|
66 | 62 |
public Mesure? GetLastMeasureByNumeroBoite(int numeroBoite) |
... | ... | |
71 | 67 |
return serieAnimal.GetLastMeasure(); |
72 | 68 |
} |
73 | 69 |
|
74 |
internal void AddMeasure(Mesure newMeasure, int numBoite) |
|
70 |
internal void AddMeasure(Mesure newMeasure, int numBoite, bool isAnimalOut)
|
|
75 | 71 |
{ |
76 |
SeriesAnimales.Select(sa => sa).Where(sa => sa.NumeroBoite == numBoite).First().AddMeasure(newMeasure); |
|
72 |
var sa = SeriesAnimales.Select(sa => sa).Where(sa => sa.NumeroBoite == numBoite).First(); |
|
73 |
sa.AddMeasure(newMeasure); |
|
74 |
if (isAnimalOut) |
|
75 |
sa.IsOut = true; |
|
77 | 76 |
} |
78 | 77 |
|
79 | 78 |
internal void AddBehaviour(Comportement newBehaviour, int numBoite, bool isAnimalOut) |
GES_PAC/Model/TypeComportement.cs | ||
---|---|---|
12 | 12 |
Value = value; |
13 | 13 |
} |
14 | 14 |
|
15 |
public static readonly TypeComportement SUFFOCATION = new("SUFFOCATION", 1); |
|
16 |
public static readonly TypeComportement AGITATION = new("AGITATION", 2); |
|
17 |
public static readonly TypeComportement PERTE_DE_CONNAISSANCE = new("PERTE DE CONNAISSANCE", 3); |
|
18 |
public static readonly TypeComportement HYPOTHERMIE = new("HYPOTHERMIE", 4); |
|
19 |
public static readonly TypeComportement HYPERTHERMIE = new("HYPERTHERMIE", 5); |
|
20 |
public static readonly TypeComportement AUTRE = new("AUTRE", 6); |
|
15 |
public static readonly TypeComportement IMMOBILITE = new("Immobilit?", 1); |
|
16 |
public static readonly TypeComportement DEPLACEMENT_AVANT_ARRIERE = new("D?placement avant/arri?re", 2); |
|
17 |
public static readonly TypeComportement DEPLACEMENT_EN_ROND = new("D?placement en rond", 3); |
|
18 |
public static readonly TypeComportement BELEMENT = new("B?lement", 4); |
|
19 |
public static readonly TypeComportement FLAIRAGE = new("Flairage", 5); |
|
20 |
public static readonly TypeComportement COUDE_AU_SOL = new("Coudes au sol", 6); |
|
21 |
public static readonly TypeComportement COUP_DE_PATTE = new("Coup de patte", 7); |
|
22 |
public static readonly TypeComportement ELIMINATION = new("?limination", 8); |
|
23 |
public static readonly TypeComportement AUTRE = new("Autre", 9); |
|
21 | 24 |
|
22 | 25 |
public static readonly List<TypeComportement> All = new() |
23 | 26 |
{ |
24 |
SUFFOCATION, |
|
25 |
AGITATION, |
|
26 |
PERTE_DE_CONNAISSANCE, |
|
27 |
HYPOTHERMIE, |
|
28 |
HYPERTHERMIE, |
|
27 |
IMMOBILITE, |
|
28 |
DEPLACEMENT_AVANT_ARRIERE, |
|
29 |
DEPLACEMENT_EN_ROND, |
|
30 |
BELEMENT, |
|
31 |
FLAIRAGE, |
|
32 |
COUDE_AU_SOL, |
|
33 |
COUP_DE_PATTE, |
|
34 |
ELIMINATION, |
|
29 | 35 |
AUTRE |
30 | 36 |
}; |
31 | 37 |
|
GES_PAC/Resources/Images/Animaux/sad_sheep.svg | ||
---|---|---|
1 |
<?xml version="1.0" standalone="no"?> |
|
2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" |
|
3 |
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
|
4 |
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" |
|
5 |
width="512.000000pt" height="512.000000pt" viewBox="0 0 512.000000 512.000000" |
|
6 |
preserveAspectRatio="xMidYMid meet"> |
|
7 |
|
|
8 |
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)" |
|
9 |
fill="#000000" stroke="none"> |
|
10 |
<path d="M2138 4597 c-86 -30 -167 -86 -214 -147 l-37 -49 -31 17 c-24 13 -57 |
|
11 |
17 -141 17 -101 0 -114 -2 -162 -27 -29 -16 -68 -42 -87 -58 -79 -70 -133 |
|
12 |
-203 -123 -304 4 -44 1 -54 -27 -90 -45 -59 -84 -152 -98 -234 -15 -90 0 -209 |
|
13 |
37 -290 14 -30 22 -59 18 -63 -5 -4 -91 -44 -193 -89 -472 -208 -723 -378 |
|
14 |
-820 -560 -33 -62 -35 -70 -35 -165 0 -98 1 -102 40 -175 46 -86 139 -186 205 |
|
15 |
-221 36 -19 60 -24 125 -24 70 0 88 4 145 32 118 58 253 190 386 378 l49 70 6 |
|
16 |
-200 c9 -284 45 -490 129 -730 41 -116 136 -314 195 -407 50 -77 166 -227 176 |
|
17 |
-228 3 0 9 287 13 639 6 506 5 643 -5 659 -10 16 -10 26 1 51 16 40 56 71 143 |
|
18 |
111 107 50 236 42 292 -20 15 -17 16 -90 15 -893 l-1 -875 29 -10 c16 -5 45 |
|
19 |
-32 65 -60 77 -104 194 -157 330 -150 123 6 217 53 284 141 22 30 45 46 80 58 |
|
20 |
l48 16 2 877 c1 802 3 880 18 896 31 34 84 52 156 52 57 0 81 -6 136 -32 123 |
|
21 |
-57 171 -113 143 -165 -10 -18 -11 -155 -4 -669 l9 -646 70 85 c90 109 152 |
|
22 |
210 225 360 140 287 207 574 219 933 l6 194 44 -64 c124 -177 264 -314 381 |
|
23 |
-371 56 -28 75 -32 145 -32 70 0 87 4 134 30 68 38 149 127 198 218 37 70 38 |
|
24 |
75 38 172 0 95 -2 103 -35 165 -46 87 -161 200 -285 282 -157 105 -332 192 |
|
25 |
-743 369 l-44 19 31 35 c114 131 117 344 7 476 l-24 28 19 51 c28 74 26 170 |
|
26 |
-7 240 -34 73 -76 116 -149 151 -75 36 -175 40 -244 9 -24 -11 -44 -20 -46 |
|
27 |
-20 -2 0 -17 23 -35 50 -18 28 -54 70 -82 95 -168 151 -432 154 -609 5 l-33 |
|
28 |
-27 -52 42 c-76 62 -149 87 -264 92 -80 3 -105 0 -162 -20z m314 -81 c32 -15 |
|
29 |
82 -49 112 -76 l53 -49 43 39 c96 88 196 125 325 118 64 -3 95 -11 141 -33 76 |
|
30 |
-37 153 -114 189 -190 16 -33 30 -62 32 -64 2 -3 13 5 26 16 44 41 90 57 157 |
|
31 |
57 78 0 129 -23 183 -83 70 -77 82 -182 32 -280 l-22 -45 38 -48 c85 -108 104 |
|
32 |
-245 48 -356 -33 -67 -79 -109 -156 -144 -40 -19 -64 -22 -144 -21 l-97 2 -63 |
|
33 |
-45 c-80 -56 -155 -84 -244 -91 -126 -10 -264 42 -369 137 l-56 52 -52 -48 |
|
34 |
c-29 -26 -82 -61 -118 -78 -59 -28 -74 -31 -165 -31 -93 0 -105 3 -173 34 |
|
35 |
l-72 34 -44 -31 c-62 -45 -160 -89 -225 -103 -31 -6 -95 -9 -143 -7 -113 7 |
|
36 |
-195 44 -277 125 -167 167 -184 432 -40 619 39 51 39 51 37 136 -1 75 2 92 26 |
|
37 |
141 77 159 256 219 421 143 32 -14 59 -25 60 -24 76 118 138 172 238 209 79 |
|
38 |
30 222 22 299 -15z m-1226 -1582 c-4 -9 -13 -60 -22 -112 -12 -76 -21 -103 |
|
39 |
-43 -131 -59 -74 -279 -278 -354 -328 -116 -78 -174 -81 -217 -11 -28 46 -25 |
|
40 |
95 10 165 76 151 275 302 534 404 84 33 101 35 92 13z m2784 -21 c234 -92 451 |
|
41 |
-258 515 -394 60 -129 4 -243 -104 -211 -86 26 -249 156 -392 313 l-87 94 -15 |
|
42 |
101 c-9 55 -19 109 -23 118 -8 21 1 19 106 -21z m-2026 -119 c34 -33 15 -58 |
|
43 |
-52 -68 -65 -10 -118 -41 -184 -107 -32 -32 -61 -59 -64 -59 -18 0 -44 24 -44 |
|
44 |
41 0 26 79 110 141 150 84 54 174 73 203 43z m1314 -20 c64 -32 170 -127 179 |
|
45 |
-162 6 -24 -15 -52 -39 -52 -4 0 -34 27 -66 59 -66 66 -119 97 -184 107 -68 |
|
46 |
10 -86 35 -51 69 22 23 90 14 161 -21z m-841 -848 c70 -13 93 -13 169 -1 164 |
|
47 |
27 234 -19 236 -153 1 -66 -15 -102 -64 -149 -62 -60 -201 -101 -296 -87 -97 |
|
48 |
13 -241 104 -277 175 -29 54 -16 140 28 188 42 44 76 49 204 27z m177 -634 |
|
49 |
c91 -63 136 -160 136 -290 0 -147 -51 -244 -147 -276 -215 -73 -379 127 -305 |
|
50 |
371 60 195 195 279 316 195z"/> |
|
51 |
<path d="M2484 1261 c-51 -31 -121 -137 -110 -166 6 -16 91 -35 160 -35 70 0 |
|
52 |
167 20 173 36 6 16 -33 92 -66 127 -53 58 -104 70 -157 38z"/> |
|
53 |
<path d="M1900 2401 c-14 -5 -47 -22 -74 -40 -28 -17 -60 -31 -71 -31 -22 0 |
|
54 |
-22 0 -28 -392 -4 -215 -7 -514 -7 -663 l0 -272 48 -45 c87 -81 254 -192 320 |
|
55 |
-212 l22 -7 0 815 0 816 -23 0 c-12 0 -54 9 -92 20 -38 11 -70 20 -70 19 0 0 |
|
56 |
-11 -4 -25 -8z"/> |
|
57 |
<path d="M3120 2389 c-36 -10 -75 -19 -87 -19 l-23 0 0 -816 0 -815 23 6 c65 |
|
58 |
20 239 136 325 218 l42 41 0 226 c0 125 -3 423 -7 663 -6 433 -6 437 -27 437 |
|
59 |
-11 0 -45 15 -76 34 -73 44 -93 47 -170 25z"/> |
|
60 |
</g> |
|
61 |
</svg> |
GES_PAC/Services/ConnexionService.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 | 1 |
using System.ComponentModel; |
4 |
using System.Linq; |
|
5 | 2 |
using System.Net.NetworkInformation; |
6 | 3 |
using System.Runtime.CompilerServices; |
7 |
using System.Text; |
|
8 |
using System.Threading.Tasks; |
|
9 | 4 |
|
10 | 5 |
namespace GES_PAC.Services |
11 | 6 |
{ |
... | ... | |
40 | 35 |
public ConnexionService() |
41 | 36 |
{ |
42 | 37 |
Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged; |
43 |
Task.Run(() => this.SetIsConnected()).Wait();
|
|
38 |
Task.Run(() => SetIsConnected()).Wait(); |
|
44 | 39 |
// ou : new Action(async () => await SetIsConnected())(); |
45 | 40 |
} |
46 | 41 |
|
... | ... | |
51 | 46 |
|
52 | 47 |
public void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e) |
53 | 48 |
{ |
54 |
Task.Run(() => this.SetIsConnected(e)).Wait();
|
|
49 |
Task.Run(() => SetIsConnected(e)).Wait(); |
|
55 | 50 |
} |
56 | 51 |
|
57 | 52 |
#region INPC |
GES_PAC/View/ChambersView.xaml | ||
---|---|---|
2 | 2 |
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
4 | 4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel" |
5 |
xmlns:controls="clr-namespace:GES_PAC.View.Controls" |
|
5 | 6 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
6 |
|
|
7 | 7 |
x:Class="GES_PAC.View.ChambersView" |
8 | 8 |
x:DataType="vm:ChambersViewModel"> |
9 | 9 |
|
... | ... | |
48 | 48 |
</Grid.RowDefinitions> |
49 | 49 |
|
50 | 50 |
<!-- Boutons Gauche --> |
51 |
<Grid Grid.Row="5" Grid.Column="0"> |
|
52 |
<Button Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1" BackgroundColor="{Binding ChamberColors[0]}" IsEnabled="{Binding ChamberIsIn[0]}"/> |
|
53 |
<Label Text="{Binding ChamberNumbers[0]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
54 |
<Label Text="{Binding ChamberIsOut[0]}" FontSize="10" Margin="10" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
55 |
</Grid> |
|
56 |
<Grid Grid.Row="4" Grid.Column="0"> |
|
57 |
<Button Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3" BackgroundColor="{Binding ChamberColors[2]}" IsEnabled="{Binding ChamberIsIn[2]}"/> |
|
58 |
<Label Text="{Binding ChamberNumbers[2]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
59 |
</Grid> |
|
60 |
<Grid Grid.Row="3" Grid.Column="0"> |
|
61 |
<Button Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5" BackgroundColor="{Binding ChamberColors[4]}" IsEnabled="{Binding ChamberIsIn[4]}"/> |
|
62 |
<Label Text="{Binding ChamberNumbers[4]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
63 |
</Grid> |
|
64 |
<Grid Grid.Row="2" Grid.Column="0"> |
|
65 |
|
|
66 |
<Button Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7" BackgroundColor="{Binding ChamberColors[6]}" IsEnabled="{Binding ChamberIsIn[6]}"/> |
|
67 |
<Label Text="{Binding ChamberNumbers[6]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
68 |
</Grid> |
|
69 |
<Grid Grid.Row="1" Grid.Column="0"> |
|
70 |
<Button Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9" BackgroundColor="{Binding ChamberColors[8]}" IsEnabled="{Binding ChamberIsIn[8]}"/> |
|
71 |
<Label Text="{Binding ChamberNumbers[8]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
72 |
</Grid> |
|
73 |
<Grid Grid.Row="0" Grid.Column="0"> |
|
74 |
<Button Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11" BackgroundColor="{Binding ChamberColors[10]}" IsEnabled="{Binding ChamberIsIn[10]}"/> |
|
75 |
<Label Text="{Binding ChamberNumbers[10]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
76 |
</Grid> |
|
51 |
<controls:ChamberButtonView Grid.Row="5" Grid.Column="0" ChamberId="1" /> |
|
52 |
<controls:ChamberButtonView Grid.Row="4" Grid.Column="0" ChamberId="3" /> |
|
53 |
<controls:ChamberButtonView Grid.Row="3" Grid.Column="0" ChamberId="5" /> |
|
54 |
<controls:ChamberButtonView Grid.Row="2" Grid.Column="0" ChamberId="7" /> |
|
55 |
<controls:ChamberButtonView Grid.Row="1" Grid.Column="0" ChamberId="9" /> |
|
56 |
<controls:ChamberButtonView Grid.Row="0" Grid.Column="0" ChamberId="11" /> |
|
77 | 57 |
|
78 | 58 |
<!-- Boutons Droite --> |
79 |
<Grid Grid.Row="5" Grid.Column="2"> |
|
80 |
<Button Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2" BackgroundColor="{Binding ChamberColors[1]}" IsEnabled="{Binding ChamberIsIn[1]}"/> |
|
81 |
<Label Text="{Binding ChamberNumbers[1]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
82 |
</Grid> |
|
83 |
<Grid Grid.Row="4" Grid.Column="2"> |
|
84 |
<Button Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4" BackgroundColor="{Binding ChamberColors[3]}" IsEnabled="{Binding ChamberIsIn[3]}"/> |
|
85 |
<Label Text="{Binding ChamberNumbers[3]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
86 |
</Grid> |
|
87 |
<Grid Grid.Row="3" Grid.Column="2"> |
|
88 |
<Button Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6" BackgroundColor="{Binding ChamberColors[5]}" IsEnabled="{Binding ChamberIsIn[5]}"/> |
|
89 |
<Label Text="{Binding ChamberNumbers[5]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
90 |
</Grid> |
|
91 |
<Grid Grid.Row="2" Grid.Column="2"> |
|
92 |
<Button Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8" BackgroundColor="{Binding ChamberColors[7]}" IsEnabled="{Binding ChamberIsIn[7]}"/> |
|
93 |
<Label Text="{Binding ChamberNumbers[7]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
94 |
</Grid> |
|
95 |
<Grid Grid.Row="1" Grid.Column="2"> |
|
96 |
<Button Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10" BackgroundColor="{Binding ChamberColors[9]}" IsEnabled="{Binding ChamberIsIn[9]}"/> |
|
97 |
<Label Text="{Binding ChamberNumbers[9]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
98 |
</Grid> |
|
99 |
<Grid Grid.Row="0" Grid.Column="2"> |
|
100 |
<Button Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12" BackgroundColor="{Binding ChamberColors[11]}" IsEnabled="{Binding ChamberIsIn[11]}"/> |
|
101 |
<Label Text="{Binding ChamberNumbers[11]}" FontSize="10" Margin="3" HorizontalOptions="Start" VerticalOptions="Start" /> |
|
102 |
</Grid> |
|
59 |
<controls:ChamberButtonView Grid.Row="5" Grid.Column="2" ChamberId="2" /> |
|
60 |
<controls:ChamberButtonView Grid.Row="4" Grid.Column="2" ChamberId="4" /> |
|
61 |
<controls:ChamberButtonView Grid.Row="3" Grid.Column="2" ChamberId="6" /> |
|
62 |
<controls:ChamberButtonView Grid.Row="2" Grid.Column="2" ChamberId="8" /> |
|
63 |
<controls:ChamberButtonView Grid.Row="1" Grid.Column="2" ChamberId="10" /> |
|
64 |
<controls:ChamberButtonView Grid.Row="0" Grid.Column="2" ChamberId="12" /> |
|
103 | 65 |
|
104 | 66 |
<!-- Couloir central --> |
105 | 67 |
<BoxView Grid.Column="1" Grid.RowSpan="6" HeightRequest="500" WidthRequest="75" Color="Gray"/> |
... | ... | |
130 | 92 |
Text="Terminer les mesures" |
131 | 93 |
Command="{Binding TerminateSetCommand}" |
132 | 94 |
Style="{StaticResource btnNormal}" |
133 |
IsEnabled="{Binding IsFormValid}" |
|
134 | 95 |
VerticalOptions="End"/> |
135 | 96 |
</StackLayout> |
136 | 97 |
</StackLayout> |
GES_PAC/View/Controls/ChamberButtonView.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
|
3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
|
4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel.Controls" |
|
5 |
x:Class="GES_PAC.View.Controls.ChamberButtonView" |
|
6 |
x:Name="ChamberButtonControl" |
|
7 |
x:DataType="vm:ChamberButtonViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<Button Text="{Binding ButtonText}" |
|
11 |
Style="{StaticResource ChambreButtonStyle}" |
|
12 |
Command="{Binding OnClickChamberCommand}" |
|
13 |
CommandParameter="{Binding ButtonCommandParameter}" |
|
14 |
BackgroundColor="{Binding ButtonBackgroundColor}" |
|
15 |
IsEnabled="{Binding ButtonIsEnabled}" /> |
|
16 |
<Label Text="{Binding ButtonLabel}" |
|
17 |
FontSize="10" |
|
18 |
Margin="3" |
|
19 |
HorizontalOptions="Start" |
|
20 |
VerticalOptions="Start" /> |
|
21 |
</Grid> |
|
22 |
</ContentView> |
GES_PAC/View/Controls/ChamberButtonView.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel.Controls; |
|
2 |
|
|
3 |
namespace GES_PAC.View.Controls |
|
4 |
{ |
|
5 |
public partial class ChamberButtonView : ContentView |
|
6 |
{ |
|
7 |
public static readonly BindableProperty ChamberIdProperty = |
|
8 |
BindableProperty.Create(nameof(ChamberId), typeof(int), typeof(ChamberButtonView), default(int), propertyChanged: OnChamberIdChanged); |
|
9 |
|
|
10 |
public int ChamberId |
|
11 |
{ |
|
12 |
get => (int)GetValue(ChamberIdProperty); |
|
13 |
set => SetValue(ChamberIdProperty, value); |
|
14 |
} |
|
15 |
|
|
16 |
public ChamberButtonView() |
|
17 |
{ |
|
18 |
BindingContext = new ChamberButtonViewModel(); |
|
19 |
InitializeComponent(); |
|
20 |
} |
|
21 |
|
|
22 |
private static void OnChamberIdChanged(BindableObject bindable, object oldValue, object newValue) |
|
23 |
{ |
|
24 |
var control = (ChamberButtonView)bindable; |
|
25 |
|
|
26 |
if (control.BindingContext is ChamberButtonViewModel viewModel) |
|
27 |
{ |
|
28 |
viewModel.UpdateProperties((int)newValue); |
|
29 |
} |
|
30 |
} |
|
31 |
} |
|
32 |
} |
GES_PAC/View/CreateBehaviourView.xaml | ||
---|---|---|
26 | 26 |
|
27 | 27 |
<Picker Title="Sélectionnez un type de comportement" |
28 | 28 |
ItemsSource="{Binding TypeComp}" |
29 |
ItemDisplayBinding="{Binding Name}" |
|
30 | 29 |
SelectedItem="{Binding SelectedType}" /> |
31 | 30 |
|
32 | 31 |
|
... | ... | |
45 | 44 |
Placeholder="(facultatif)"/> |
46 | 45 |
</VerticalStackLayout> |
47 | 46 |
|
48 |
<!-- sortie de l'animal -->
|
|
47 |
<!-- Sortie de l'animal -->
|
|
49 | 48 |
<HorizontalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
50 | 49 |
<CheckBox IsChecked="{Binding IsAnimalOut}" HorizontalOptions="Center" /> |
51 | 50 |
<Label Text="Sortie de l'animal" FontSize="14" TextColor="Gray" HorizontalOptions="Center" VerticalOptions="Center" /> |
GES_PAC/View/CreateCalibrationView.xaml | ||
---|---|---|
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
4 | 4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel" |
5 | 5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
6 |
xmlns:controls="clr-namespace:GES_PAC.Controls" |
|
6 | 7 |
x:Class="GES_PAC.View.CreateCalibrationView" |
7 | 8 |
x:DataType="vm:CreateCalibrationViewModel"> |
8 | 9 |
|
... | ... | |
39 | 40 |
<!-- CH4 --> |
40 | 41 |
<VerticalStackLayout> |
41 | 42 |
<Label Text="CH4 (ppm)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
42 |
<Entry Text="{Binding ConcCH4, Mode=TwoWay, TargetNullValue=''}" |
|
43 |
FontSize="16" |
|
44 |
TextColor="Black" |
|
45 |
Placeholder="0,0" |
|
46 |
Keyboard="Numeric"/> |
|
43 |
<controls:DoubleEntry Text="{Binding ConcCH4, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
47 | 44 |
<Label Text="Entrez une valeur" |
48 | 45 |
FontSize="12" |
49 | 46 |
TextColor="Red" |
... | ... | |
53 | 50 |
<!-- O2 --> |
54 | 51 |
<VerticalStackLayout> |
55 | 52 |
<Label Text="O2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
56 |
<Entry Text="{Binding ConcO2 , Mode=TwoWay, TargetNullValue=''}" |
|
57 |
FontSize="16" |
|
58 |
TextColor="Black" |
|
59 |
Placeholder="0,0" |
|
60 |
Keyboard="Numeric"/> |
|
53 |
<controls:DoubleEntry Text="{Binding ConcO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
61 | 54 |
<Label Text="Entrez une valeur" |
62 | 55 |
FontSize="12" |
63 | 56 |
TextColor="Red" |
... | ... | |
67 | 60 |
<!-- CO2 --> |
68 | 61 |
<VerticalStackLayout> |
69 | 62 |
<Label Text="CO2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
70 |
<Entry Text="{Binding ConcCO2, Mode=TwoWay, TargetNullValue=''}" |
|
71 |
FontSize="16" |
|
72 |
TextColor="Black" |
|
73 |
Placeholder="0,0" |
|
74 |
Keyboard="Numeric"/> |
|
63 |
<controls:DoubleEntry Text="{Binding ConcCO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
75 | 64 |
<Label Text="Entrez une valeur" |
76 | 65 |
FontSize="12" |
77 | 66 |
TextColor="Red" |
GES_PAC/View/CreateMeasureView.xaml | ||
---|---|---|
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
4 | 4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel" |
5 | 5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
6 |
xmlns:controls="clr-namespace:GES_PAC.Controls" |
|
6 | 7 |
x:Class="GES_PAC.View.CreateMeasureView" |
7 | 8 |
x:DataType="vm:CreateMeasureViewModel"> |
8 | 9 |
|
... | ... | |
10 | 11 |
<StackLayout BackgroundColor="White" Spacing="50"> |
11 | 12 |
<tools:ConnectionIndicatorView /> |
12 | 13 |
<ScrollView> |
13 |
|
|
14 | 14 |
<VerticalStackLayout Grid.Row="1" Spacing="30"> |
15 | 15 |
|
16 |
<Label Text="{Binding Titre}" |
|
17 |
FontSize="20" |
|
18 |
FontAttributes="Bold" |
|
19 |
HorizontalOptions="Center" /> |
|
16 |
<Grid ColumnDefinitions="*,Auto,*" Padding="10" VerticalOptions="Start"> |
|
17 |
<Label Text="{Binding Titre}" |
|
18 |
FontSize="20" |
|
19 |
FontAttributes="Bold" |
|
20 |
VerticalOptions="Center" |
|
21 |
HorizontalOptions="Center" |
|
22 |
Grid.Column="1" /> |
|
23 |
|
|
24 |
<Button |
|
25 |
ImageSource="sad_sheep.png" |
|
26 |
MaximumHeightRequest="50" |
|
27 |
MaximumWidthRequest="75" |
|
28 |
BackgroundColor="Orange" |
|
29 |
TextColor="White" |
|
30 |
Command="{Binding BehaviourCommand}" |
|
31 |
Style="{StaticResource btnNormal}" |
|
32 |
IsVisible="{Binding HasLastMeasure}" |
|
33 |
VerticalOptions="Center" |
|
34 |
Padding="0" |
|
35 |
Grid.Column="2"> |
|
36 |
<Button.Shadow> |
|
37 |
<Shadow |
|
38 |
Brush="Black" |
|
39 |
Offset="2,2" |
|
40 |
Radius="4" |
|
41 |
Opacity="0.5" /> |
|
42 |
</Button.Shadow> |
|
43 |
</Button> |
|
44 |
</Grid> |
|
20 | 45 |
|
21 | 46 |
<Label Text="{Binding LastTime}" |
22 | 47 |
FontSize="14" |
... | ... | |
30 | 55 |
<VerticalStackLayout> |
31 | 56 |
<Label Text="CH4 (ppm)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
32 | 57 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
33 |
<Entry Grid.Column="0" |
|
34 |
Text="{Binding ConcCH4, Mode=TwoWay, TargetNullValue=''}" |
|
35 |
FontSize="16" |
|
36 |
TextColor="Black" |
|
37 |
Placeholder="0,0" |
|
38 |
Keyboard="Numeric"> |
|
39 |
</Entry> |
|
58 |
<controls:DoubleEntry Grid.Column="0" Text="{Binding ConcCH4, Mode=OneWayToSource, TargetNullValue=''}"/> |
|
40 | 59 |
<Label Grid.Column="1" |
41 | 60 |
Text="{Binding LastCH4, StringFormat='[{0} ppm]'}" |
42 | 61 |
FontSize="16" |
... | ... | |
57 | 76 |
<VerticalStackLayout> |
58 | 77 |
<Label Text="O2 (%)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
59 | 78 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
60 |
<Entry Grid.Column="0" |
|
61 |
Text="{Binding ConcO2, Mode=TwoWay, TargetNullValue=''}" |
|
62 |
FontSize="16" |
|
63 |
TextColor="Black" |
|
64 |
Placeholder="0,0" |
|
65 |
Keyboard="Numeric"> |
|
66 |
</Entry> |
|
79 |
<controls:DoubleEntry Grid.Column="0" Text="{Binding ConcO2, Mode=OneWayToSource, TargetNullValue=''}"/> |
|
67 | 80 |
<Label Grid.Column="1" |
68 | 81 |
Text="{Binding LastO2, StringFormat='[{0} %]'}" |
69 | 82 |
FontSize="16" |
... | ... | |
84 | 97 |
<VerticalStackLayout> |
85 | 98 |
<Label Text="CO2 (%)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
86 | 99 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
87 |
<Entry Grid.Column="0" |
|
88 |
Text="{Binding ConcCO2, Mode=TwoWay, TargetNullValue=''}" |
|
89 |
FontSize="16" |
|
90 |
TextColor="Black" |
|
91 |
Placeholder="0,0" |
|
92 |
Keyboard="Numeric"> |
|
93 |
</Entry> |
|
100 |
<controls:DoubleEntry Grid.Column="0" Text="{Binding ConcCO2, Mode=OneWayToSource, TargetNullValue=''}"/> |
|
94 | 101 |
<Label Grid.Column="1" |
95 | 102 |
Text="{Binding LastCO2, StringFormat='[{0} %]'}" |
96 | 103 |
FontSize="16" |
... | ... | |
106 | 113 |
IsVisible="{Binding ConcCO2Error}"/> |
107 | 114 |
</VerticalStackLayout> |
108 | 115 |
|
116 |
<!-- Sortie de l'animal --> |
|
117 |
<HorizontalStackLayout HorizontalOptions="Center" VerticalOptions="Center" IsVisible="{Binding HasLastMeasure}"> |
|
118 |
<CheckBox IsChecked="{Binding IsAnimalOut}" HorizontalOptions="Center" /> |
|
119 |
<Label Text="Sortie de l'animal" FontSize="14" TextColor="Gray" HorizontalOptions="Center" VerticalOptions="Center" /> |
|
120 |
</HorizontalStackLayout> |
|
121 |
|
|
109 | 122 |
|
110 | 123 |
</VerticalStackLayout> |
111 | 124 |
</VerticalStackLayout> |
... | ... | |
117 | 130 |
VerticalOptions="FillAndExpand"> |
118 | 131 |
|
119 | 132 |
<Button |
120 |
Text="Comportements" |
|
121 |
BackgroundColor="Orange" |
|
122 |
TextColor="White" |
|
123 |
Command="{Binding BehaviourCommand}" |
|
124 |
Style="{StaticResource btnNormal}" |
|
125 |
VerticalOptions="End" |
|
126 |
Margin="0,0,10,0"/> |
|
127 |
|
|
128 |
<Button |
|
129 | 133 |
Text="Enregistrer" |
130 | 134 |
Command="{Binding CreateMeasureCommand}" |
131 | 135 |
Style="{StaticResource btnNormal}" |
GES_PAC/View/CreateSetView.xaml | ||
---|---|---|
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
4 | 4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel" |
5 | 5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
6 |
xmlns:controls="clr-namespace:GES_PAC.Controls" |
|
6 | 7 |
x:Class="GES_PAC.View.CreateSetView" |
7 | 8 |
x:DataType="vm:CreateSetViewModel"> |
8 | 9 |
|
... | ... | |
39 | 40 |
<!-- Température --> |
40 | 41 |
<VerticalStackLayout> |
41 | 42 |
<Label Text="Température (°C)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
42 |
<Entry Text="{Binding Temperature}" FontSize="16" TextColor="Black" Placeholder="25" Keyboard="Numeric"/>
|
|
43 |
<controls:DoubleEntry Text="{Binding Temperature, Mode=OneWayToSource}" Placeholder="25,0"/>
|
|
43 | 44 |
<Label Text="Entrez une valeur" |
44 | 45 |
FontSize="12" |
45 | 46 |
TextColor="Red" |
... | ... | |
49 | 50 |
<!-- Humidité --> |
50 | 51 |
<VerticalStackLayout> |
51 | 52 |
<Label Text="Humidité (%)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
52 |
<Entry Text="{Binding Humidite}" FontSize="16" TextColor="Black" Placeholder="50" Keyboard="Numeric"/>
|
|
53 |
<controls:DoubleEntry Text="{Binding Humidite, Mode=OneWayToSource}" Placeholder="50,0"/>
|
|
53 | 54 |
<Label Text="Entrez une valeur" |
54 | 55 |
FontSize="12" |
55 | 56 |
TextColor="Red" |
... | ... | |
59 | 60 |
<!-- Pression --> |
60 | 61 |
<VerticalStackLayout> |
61 | 62 |
<Label Text="Pression (hPa)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
62 |
<Entry Text="{Binding Pression}" FontSize="16" TextColor="Black" Placeholder="1,5" Keyboard="Numeric"/>
|
|
63 |
<controls:DoubleEntry Text="{Binding Pression, Mode=OneWayToSource}" Placeholder="1,5"/>
|
|
63 | 64 |
<Label Text="Entrez une valeur" |
64 | 65 |
FontSize="12" |
65 | 66 |
TextColor="Red" |
GES_PAC/View/EnterAnimalView.xaml | ||
---|---|---|
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
4 | 4 |
xmlns:vm="clr-namespace:GES_PAC.ViewModel" |
5 | 5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
6 |
xmlns:controls="clr-namespace:GES_PAC.Controls" |
|
6 | 7 |
x:Class="GES_PAC.View.EnterAnimalView" |
7 | 8 |
x:DataType="vm:EnterAnimalViewModel"> |
8 | 9 |
|
... | ... | |
34 | 35 |
<!-- Poids --> |
35 | 36 |
<VerticalStackLayout> |
36 | 37 |
<Label Text="Poids (kg)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
37 |
<Entry Text="{Binding Poids}" FontSize="16" TextColor="Black" Placeholder="75" Keyboard="Numeric"/>
|
|
38 |
<controls:DoubleEntry Text="{Binding Poids, Mode=OneWayToSource}" Placeholder="75,0"/>
|
|
38 | 39 |
<Label Text="Entrez une valeur" |
39 | 40 |
FontSize="12" |
40 | 41 |
TextColor="Red" |
GES_PAC/ViewModel/ChambersViewModel.cs | ||
---|---|---|
1 | 1 |
using GES_PAC.Model; |
2 |
using GES_PAC.View; |
|
3 |
using System.Collections.ObjectModel; |
|
4 | 2 |
using System.Windows.Input; |
5 | 3 |
|
6 | 4 |
namespace GES_PAC.ViewModel |
... | ... | |
13 | 11 |
#endregion |
14 | 12 |
|
15 | 13 |
#region Commandes |
16 |
public ICommand OnClickChamberCommand { get; }
|
|
14 |
public ICommand TerminateSetCommand { get; }
|
|
17 | 15 |
#endregion |
18 | 16 |
|
19 | 17 |
#region Propriétés |
20 |
public ObservableCollection<Color> ChamberColors { get; set; } = []; |
|
21 |
public ObservableCollection<int> ChamberNumbers { get; set; } = []; |
|
22 |
public ObservableCollection<bool> ChamberIsIn { get; set; } = []; |
|
23 | 18 |
public Serie CurrentSet { get; set; } |
24 | 19 |
|
25 | 20 |
#endregion |
... | ... | |
27 | 22 |
#region Constructeurs |
28 | 23 |
public ChambersViewModel() |
29 | 24 |
{ |
30 |
//ONLY FOR TESTS |
|
31 |
var date = DateTime.Now; |
|
32 |
var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], ""); |
|
33 |
newDay.AddSerie(new Serie(date, date, 25, 25, 25)); |
|
34 |
newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
|
35 |
newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1); |
|
36 |
JourneeViewModel.Instance.Journees.Add(newDay); |
|
37 |
//ONLY FOR TESTS |
|
38 |
|
|
39 | 25 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
40 |
UpdateChamberDatas(); |
|
41 |
|
|
42 |
OnClickChamberCommand = new Command<string>(async (idStr) => |
|
43 |
{ |
|
44 |
int id = int.Parse(idStr); |
|
45 |
await GoToEnterAnimal(id); |
|
46 |
}); |
|
47 | 26 |
} |
48 | 27 |
#endregion |
49 | 28 |
|
50 | 29 |
#region Méthodes |
51 |
private async Task GoToEnterAnimal(int id) |
|
52 |
{ |
|
53 |
if (IsBusy) return; |
|
54 |
IsBusy = true; |
|
55 |
|
|
56 |
if (CurrentSet.GetMeasureNumberByNumeroBoite(id) == 0) |
|
57 |
await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}"); |
|
58 |
else |
|
59 |
await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={id}"); |
|
60 |
|
|
61 |
IsBusy = false; |
|
62 |
} |
|
63 |
|
|
64 |
private void UpdateChamberDatas() |
|
65 |
{ |
|
66 |
ChamberIsIn = JourneeViewModel.Instance.GetCurrentSet().GetIsOutDatas(); |
|
67 |
for (int i = 1; i <= 12; i++) |
|
68 |
{ |
|
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); |
|
75 |
ChamberNumbers.Add(count); |
|
76 |
} |
|
77 |
} |
|
30 |
|
|
78 | 31 |
#endregion |
79 | 32 |
} |
80 | 33 |
} |
GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.View; |
|
3 |
using System.Windows.Input; |
|
4 |
|
|
5 |
namespace GES_PAC.ViewModel.Controls |
|
6 |
{ |
|
7 |
public class ChamberButtonViewModel : BaseViewModel |
|
8 |
{ |
|
9 |
#region Attributs |
|
10 |
private string _buttonText; |
|
11 |
private int _buttonCommandParameter; |
|
12 |
private Color _buttonBackgroundColor; |
|
13 |
private bool _buttonIsEnabled; |
|
14 |
private string _buttonLabel; |
|
15 |
private ICommand _onClickChamberCommand; |
|
16 |
#endregion |
|
17 |
|
|
18 |
#region Propriétés |
|
19 |
|
|
20 |
public string ButtonText { |
|
21 |
get => _buttonText; |
|
22 |
set |
|
23 |
{ |
|
24 |
_buttonText = value; |
|
25 |
OnPropertyChanged(); |
|
26 |
} |
|
27 |
} |
|
28 |
public int ButtonCommandParameter |
|
29 |
{ |
|
30 |
get => _buttonCommandParameter; |
|
31 |
set |
|
32 |
{ |
|
33 |
_buttonCommandParameter = value; |
|
34 |
OnPropertyChanged(); |
|
35 |
} |
|
36 |
} |
|
37 |
public Color ButtonBackgroundColor |
|
38 |
{ |
|
39 |
get => _buttonBackgroundColor; |
|
40 |
set |
|
41 |
{ |
|
42 |
_buttonBackgroundColor = value; |
|
43 |
OnPropertyChanged(); |
|
44 |
} |
|
45 |
} |
|
46 |
public bool ButtonIsEnabled |
|
47 |
{ |
|
48 |
get => _buttonIsEnabled; |
|
49 |
set |
|
50 |
{ |
|
51 |
_buttonIsEnabled = value; |
|
52 |
OnPropertyChanged(); |
|
53 |
} |
|
54 |
} |
|
55 |
public string ButtonLabel |
|
56 |
{ |
|
57 |
get => _buttonLabel; |
|
58 |
set |
|
59 |
{ |
|
60 |
_buttonLabel = value; |
|
61 |
OnPropertyChanged(); |
|
62 |
} |
|
63 |
} |
|
64 |
public Serie CurrentSet { get; set; } |
|
65 |
#endregion |
|
66 |
|
|
67 |
#region Commandes |
|
68 |
public ICommand OnClickChamberCommand |
|
69 |
{ |
|
70 |
get => _onClickChamberCommand; |
|
71 |
set |
|
72 |
{ |
|
73 |
_onClickChamberCommand = value; |
|
74 |
OnPropertyChanged(); |
|
75 |
} |
|
76 |
} |
|
77 |
#endregion |
|
78 |
|
|
79 |
#region Constructeurs |
|
80 |
#endregion |
|
81 |
|
|
82 |
#region Méthodes |
|
83 |
public void UpdateProperties(int chamberId) |
|
84 |
{ |
|
85 |
OnClickChamberCommand = new Command(async () => await GoToEnterAnimal()); |
|
86 |
|
|
87 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
|
88 |
|
|
89 |
ButtonText = chamberId.ToString(); |
|
90 |
ButtonCommandParameter = chamberId; |
|
91 |
|
|
92 |
ButtonIsEnabled = JourneeViewModel.Instance.GetCurrentSet().GetIsInByNumeroBoite(chamberId); |
|
93 |
bool hasBehaviour = CurrentSet.GetHasBehaviourByNumeroBoite(chamberId); |
|
94 |
int count = CurrentSet.GetMeasureNumberByNumeroBoite(chamberId); |
|
95 |
if (hasBehaviour) |
|
96 |
ButtonBackgroundColor = Colors.Yellow; |
|
97 |
else |
|
98 |
ButtonBackgroundColor = count > 0 ? Colors.LightGreen : Colors.White; |
|
99 |
ButtonLabel = count.ToString(); |
|
100 |
} |
|
101 |
private async Task GoToEnterAnimal() |
|
102 |
{ |
|
103 |
if (IsBusy) return; |
|
104 |
IsBusy = true; |
|
105 |
|
|
106 |
if (CurrentSet.GetMeasureNumberByNumeroBoite(ButtonCommandParameter) == 0) |
|
107 |
await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={ButtonCommandParameter}"); |
|
108 |
else |
|
109 |
await Shell.Current.GoToAsync($"{nameof(CreateMeasureView)}?chamberId={ButtonCommandParameter}"); |
|
110 |
|
|
111 |
IsBusy = false; |
|
112 |
} |
|
113 |
#endregion |
|
114 |
} |
|
115 |
} |
GES_PAC/ViewModel/CreateMeasureViewModel.cs | ||
---|---|---|
13 | 13 |
private double? _conc_o2; |
14 | 14 |
private double? _conc_co2; |
15 | 15 |
private double? _conc_ch4; |
16 |
private bool _isAnimalOut; |
|
16 | 17 |
private bool _isFormValid; |
17 | 18 |
private bool _hasLastMeasure; |
18 | 19 |
private double? _lastO2; |
... | ... | |
78 | 79 |
UpdateColors(); |
79 | 80 |
} |
80 | 81 |
} |
82 |
public bool IsAnimalOut |
|
83 |
{ |
|
84 |
get => _isAnimalOut; |
|
85 |
set |
|
86 |
{ |
|
87 |
_isAnimalOut = value; |
|
88 |
OnPropertyChanged(); |
|
89 |
} |
|
90 |
} |
|
81 | 91 |
public bool HasLastMeasure |
82 | 92 |
{ |
83 | 93 |
get => _hasLastMeasure; |
... | ... | |
185 | 195 |
|
186 | 196 |
var date = DateTime.Now; |
187 | 197 |
var newMeasure = new Mesure(date, ConcO2 ?? 0, ConcCO2 ?? 0, ConcCH4 ?? 0); |
198 |
var currentSet = JourneeViewModel.Instance.GetCurrentDay().GetCurrentSet(); |
|
188 | 199 |
|
189 |
JourneeViewModel.Instance.AddMeasureToCurrentSet(newMeasure, ChamberId);
|
|
200 |
currentSet.AddMeasure(newMeasure, ChamberId, IsAnimalOut);
|
|
190 | 201 |
|
191 | 202 |
await Shell.Current.GoToAsync(nameof(ChambersView)); |
192 | 203 |
|
GES_PAC/ViewModel/CreateSetViewModel.cs | ||
---|---|---|
102 | 102 |
var date = DateTime.Now; |
103 | 103 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
104 | 104 |
var newSet = new Serie(date, DateTimeMAJ, Temperature ?? 0, Humidite ?? 0, Pression ?? 0); |
105 |
journeeActuelle.AddSerie(newSet);
|
|
105 |
journeeActuelle.AddSet(newSet);
|
|
106 | 106 |
|
107 | 107 |
await Shell.Current.GoToAsync(nameof(ChambersView)); |
108 | 108 |
IsBusy = false; |
GES_PAC/ViewModel/EnterAnimalViewModel.cs | ||
---|---|---|
95 | 95 |
|
96 | 96 |
private void ValidateForm() |
97 | 97 |
{ |
98 |
NumRFIDError = NumRFID.Length < 5 ;
|
|
98 |
NumRFIDError = NumRFID == null || NumRFID.Length < 5;
|
|
99 | 99 |
PoidsError = Poids == null; |
100 | 100 |
|
101 | 101 |
OnPropertyChanged(nameof(NumRFIDError)); |
GES_PAC/ViewModel/JourneeViewModel.cs | ||
---|---|---|
32 | 32 |
{ |
33 | 33 |
return GetCurrentDay().GetCurrentSet(); |
34 | 34 |
} |
35 |
|
|
36 |
public void AddMeasureToCurrentSet(Mesure newMeasure, int numBoite) |
|
37 |
{ |
|
38 |
GetCurrentDay().GetCurrentSet().AddMeasure(newMeasure, numBoite); |
|
39 |
} |
|
40 | 35 |
#endregion |
41 | 36 |
} |
42 | 37 |
} |
GES_PAC/ViewModel/MainViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
1 | 2 |
using GES_PAC.Services; |
2 | 3 |
using GES_PAC.View; |
3 | 4 |
|
... | ... | |
16 | 17 |
#region Constructeur |
17 | 18 |
public MainViewModel(ConnexionService connService) |
18 | 19 |
{ |
20 |
//ONLY FOR TESTS |
|
21 |
var date = DateTime.Now; |
|
22 |
var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], ""); |
|
23 |
newDay.AddSet(new Serie(date, date, 25, 25, 25)); |
|
24 |
newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
|
25 |
newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false); |
|
26 |
JourneeViewModel.Instance.Journees.Add(newDay); |
|
27 |
//ONLY FOR TESTS |
|
28 |
|
|
19 | 29 |
this.connService = connService; |
20 | 30 |
GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage()); |
21 | 31 |
} |
GES_PAC/ViewModel/PlaceViewModel.cs | ||
---|---|---|
17 | 17 |
|
18 | 18 |
#region Constructeur |
19 | 19 |
private PlaceViewModel() { |
20 |
Places.Add(new Lieu("Ferme du soleil", "Dupont", "Chèvres")); // Ajout d'un lieu par défaut pour les tests
|
|
20 |
Places.Add(new Lieu("Elevage Langlade", "INRAE", "Mouton")); // Ajout d'un lieu par défaut pour les tests
|
|
21 | 21 |
} |
22 | 22 |
#endregion |
23 | 23 |
} |
Formats disponibles : Unified diff