Révision 09d4a0de
GES_PAC/AppShell.xaml | ||
---|---|---|
24 | 24 |
Route="CreatePlace" |
25 | 25 |
ContentTemplate="{DataTemplate local:CreatePlaceView}" /> |
26 | 26 |
|
27 |
<ShellContent |
|
28 |
Title="Chambres (test)" |
|
29 |
Route="Chambers" |
|
30 |
ContentTemplate="{DataTemplate local:ChambersView}" /> |
|
31 |
|
|
27 | 32 |
<Shell.FlyoutFooter> |
28 | 33 |
<Grid Padding="10" ColumnDefinitions="auto,auto"> |
29 | 34 |
<Grid.GestureRecognizers> |
GES_PAC/AppShell.xaml.cs | ||
---|---|---|
15 | 15 |
Routing.RegisterRoute(nameof(CreatePersonView), typeof(CreatePersonView)); |
16 | 16 |
Routing.RegisterRoute(nameof(CreatePlaceView), typeof(CreatePlaceView)); |
17 | 17 |
Routing.RegisterRoute(nameof(CreateCalibrationView), typeof(CreateCalibrationView)); |
18 |
Routing.RegisterRoute(nameof(SetListView), typeof(SetListView)); |
|
19 |
Routing.RegisterRoute(nameof(CreateSetView), typeof(CreateSetView)); |
|
20 |
Routing.RegisterRoute(nameof(ChambersView), typeof(ChambersView)); |
|
21 |
Routing.RegisterRoute(nameof(EnterAnimalView), typeof(EnterAnimalView)); |
|
18 | 22 |
} |
19 | 23 |
} |
20 | 24 |
|
GES_PAC/GES_PAC.csproj | ||
---|---|---|
25 | 25 |
<ApplicationTitle>GES_PAC</ApplicationTitle> |
26 | 26 |
|
27 | 27 |
<!-- App Identifier --> |
28 |
<ApplicationId>com.companyname.GES_PAC</ApplicationId>
|
|
28 |
<ApplicationId>fr.inrae.sicpa.GES_PAC</ApplicationId>
|
|
29 | 29 |
|
30 | 30 |
<!-- Versions --> |
31 | 31 |
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> |
... | ... | |
44 | 44 |
|
45 | 45 |
<ItemGroup> |
46 | 46 |
<!-- App Icon --> |
47 |
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
|
|
47 |
<MauiIcon Include="Resources\AppIcon\appicon.svg" Color="#FFFFFF" />
|
|
48 | 48 |
|
49 | 49 |
<!-- Splash Screen --> |
50 |
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
|
|
50 |
<MauiSplashScreen Include="Resources\Images\logo_inrae.svg" Color="White" BaseSize="128,128" />
|
|
51 | 51 |
|
52 | 52 |
<!-- Images --> |
53 | 53 |
<MauiImage Include="Resources\Images\*" /> |
54 |
<MauiImage Include="Resources\Images\AjoutSuppr\*" /> |
|
55 |
<MauiImage Include="Resources\Images\Animaux\*" /> |
|
56 |
<MauiImage Include="Resources\Images\Liste\*" /> |
|
57 |
<MauiImage Include="Resources\Images\PeripheriqueConnexion\*" /> |
|
58 |
<MauiImage Include="Resources\Images\Sanitaire\*" /> |
|
59 |
<MauiImage Include="Resources\Images\Scientifique\*" /> |
|
60 |
<MauiImage Include="Resources\Images\Special\*" /> |
|
61 |
<MauiImage Include="Resources\Images\Utile\*" /> |
|
62 |
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" /> |
|
54 | 63 |
|
55 | 64 |
<!-- Custom Fonts --> |
56 | 65 |
<MauiFont Include="Resources\Fonts\*" /> |
... | ... | |
75 | 84 |
<Compile Update="View\CreatePlaceView.xaml.cs"> |
76 | 85 |
<DependentUpon>CreatePlaceView.xaml</DependentUpon> |
77 | 86 |
</Compile> |
87 |
<Compile Update="View\SetListView.xaml.cs"> |
|
88 |
<DependentUpon>SetListView.xaml</DependentUpon> |
|
89 |
</Compile> |
|
78 | 90 |
</ItemGroup> |
79 | 91 |
|
80 | 92 |
<ItemGroup> |
93 |
<MauiXaml Update="View\ChambersView.xaml"> |
|
94 |
<Generator>MSBuild:Compile</Generator> |
|
95 |
</MauiXaml> |
|
81 | 96 |
<MauiXaml Update="View\CreateCalibrationView.xaml"> |
82 | 97 |
<Generator>MSBuild:Compile</Generator> |
83 | 98 |
</MauiXaml> |
... | ... | |
87 | 102 |
<MauiXaml Update="View\CreatePersonView.xaml"> |
88 | 103 |
<Generator>MSBuild:Compile</Generator> |
89 | 104 |
</MauiXaml> |
105 |
<MauiXaml Update="View\CreateSetView.xaml"> |
|
106 |
<Generator>MSBuild:Compile</Generator> |
|
107 |
</MauiXaml> |
|
108 |
<MauiXaml Update="View\EnterAnimal.xaml"> |
|
109 |
<Generator>MSBuild:Compile</Generator> |
|
110 |
</MauiXaml> |
|
90 | 111 |
<MauiXaml Update="View\MainView.xaml"> |
91 | 112 |
<Generator>MSBuild:Compile</Generator> |
92 | 113 |
</MauiXaml> |
93 | 114 |
<MauiXaml Update="View\CreatePlaceView.xaml"> |
94 | 115 |
<Generator>MSBuild:Compile</Generator> |
95 | 116 |
</MauiXaml> |
117 |
<MauiXaml Update="View\SetListView.xaml"> |
|
118 |
<Generator>MSBuild:Compile</Generator> |
|
119 |
</MauiXaml> |
|
96 | 120 |
<MauiXaml Update="View\Tools\ConnectionIndicatorView.xaml"> |
97 | 121 |
<Generator>MSBuild:Compile</Generator> |
98 | 122 |
</MauiXaml> |
GES_PAC/Model/Calibration.cs | ||
---|---|---|
16 | 16 |
|
17 | 17 |
public void AddMesure(MesureCalibration mesure) |
18 | 18 |
{ |
19 |
var index = Mesures.FindIndex(m => m.Type == mesure.Type); |
|
20 |
if (index != -1) |
|
21 |
{ |
|
22 |
Mesures[index] = mesure; |
|
23 |
return; |
|
24 |
} |
|
19 | 25 |
Mesures.Add(mesure); |
20 | 26 |
} |
21 | 27 |
|
GES_PAC/Model/Journee.cs | ||
---|---|---|
30 | 30 |
|
31 | 31 |
#region Méthodes |
32 | 32 |
|
33 |
public bool AddCalibration(MesureCalibration mesureCalibration) |
|
33 |
public bool AddCalibration(MesureCalibration mesureCalibration, PhaseCalibration phaseCalibration)
|
|
34 | 34 |
{ |
35 |
if (Calibrations.Count == 0 || Calibrations.Last().IsComplete()) |
|
36 |
{ |
|
37 |
Calibrations.Add(new Calibration(Calibrations.Count == 0 ? PhaseCalibration.Debut : PhaseCalibration.Fin, mesureCalibration)); |
|
38 |
} |
|
39 |
else |
|
35 |
var existing = Calibrations.FirstOrDefault(c => c.Phase == phaseCalibration); |
|
36 |
|
|
37 |
if (existing == null) |
|
40 | 38 |
{ |
41 |
Calibrations.Last().Mesures.Add(mesureCalibration);
|
|
42 |
return Calibrations.Last().IsComplete();
|
|
39 |
Calibrations.Add(new Calibration(phaseCalibration, mesureCalibration));
|
|
40 |
return false;
|
|
43 | 41 |
} |
44 |
return false; |
|
42 |
|
|
43 |
existing.AddMesure(mesureCalibration); |
|
44 |
return existing.IsComplete(); |
|
45 |
} |
|
46 |
|
|
47 |
public void AddSerie(Serie set) |
|
48 |
{ |
|
49 |
Series.Add(set); |
|
45 | 50 |
} |
46 | 51 |
|
47 | 52 |
public PhaseCalibration GetCurrentPhase() |
48 | 53 |
{ |
49 |
if (Calibrations.Count == 0 || !Calibrations.Last().IsComplete())
|
|
54 |
if (Series.Count == 0)
|
|
50 | 55 |
{ |
51 | 56 |
return PhaseCalibration.Debut; |
52 | 57 |
} |
GES_PAC/Model/MesureCalibration.cs | ||
---|---|---|
9 | 9 |
public MesureCalibration(DateTime Time, double Conc_O2, double Conc_CO2, double Conc_CH4, TypeCalibration Type, string RefBouteille) : base(Time, Conc_O2, Conc_CO2, Conc_CH4) |
10 | 10 |
{ |
11 | 11 |
this.Type = Type; |
12 |
this.RefBouteille = RefBouteille; |
|
12 |
if (Type.Value != 0) |
|
13 |
{ |
|
14 |
this.RefBouteille = RefBouteille; |
|
15 |
} |
|
13 | 16 |
} |
14 |
|
|
15 | 17 |
} |
16 | 18 |
} |
GES_PAC/Model/Serie.cs | ||
---|---|---|
10 | 10 |
public double Humidite { get; set; } |
11 | 11 |
public double Pression { get; set; } |
12 | 12 |
public List<SerieAnimal> SeriesAnimales { get; set; } |
13 |
|
|
14 |
public Serie(DateTime Time, DateTime MiseAJeun, double Temperature, double Humidite, double Pression) |
|
15 |
{ |
|
16 |
this.Time = Time; |
|
17 |
this.MiseAJeun = MiseAJeun; |
|
18 |
this.Temperature = Temperature; |
|
19 |
this.Humidite = Humidite; |
|
20 |
this.Pression = Pression; |
|
21 |
SeriesAnimales = []; |
|
22 |
} |
|
13 | 23 |
} |
14 | 24 |
} |
GES_PAC/Model/TypeCalibration.cs | ||
---|---|---|
17 | 17 |
Value = value; |
18 | 18 |
} |
19 | 19 |
|
20 |
public static readonly TypeCalibration Air = new("Air", 1);
|
|
21 |
public static readonly TypeCalibration Methane = new("Methane", 2);
|
|
22 |
public static readonly TypeCalibration Melange = new("Mélange", 3);
|
|
20 |
public static readonly TypeCalibration Air = new("Air", 0);
|
|
21 |
public static readonly TypeCalibration Methane = new("Methane", 1);
|
|
22 |
public static readonly TypeCalibration Melange = new("Mélange", 2);
|
|
23 | 23 |
|
24 | 24 |
public static readonly List<TypeCalibration> All = new() { Air, Methane, Melange }; |
25 | 25 |
|
GES_PAC/Resources/Images/Utile/arrow.svg | ||
---|---|---|
1 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
|
2 |
width="100%" viewBox="0 0 560 560" enable-background="new 0 0 560 560" xml:space="preserve"> |
|
3 |
<path fill="#000000" opacity="1.000000" stroke="none" |
|
4 |
d=" |
|
5 |
M73.001549,225.857483 |
|
6 |
C147.825455,225.864105 222.149796,225.872406 296.474121,225.873993 |
|
7 |
C304.807587,225.874176 304.796875,225.856537 304.798828,217.712708 |
|
8 |
C304.805054,191.715881 304.836914,165.719025 304.813293,139.722229 |
|
9 |
C304.809723,135.790375 305.352234,132.050034 307.868347,128.893066 |
|
10 |
C312.138092,123.535797 319.144806,123.230049 325.689331,128.214233 |
|
11 |
C343.847900,142.043427 361.963806,155.928604 380.089050,169.801498 |
|
12 |
C424.541595,203.825043 469.021759,237.812622 513.414551,271.914032 |
|
13 |
C522.926208,279.220673 522.747253,286.996643 513.243286,294.269897 |
|
14 |
C464.964142,331.217499 416.662262,368.135345 368.376587,405.074402 |
|
15 |
C354.353973,415.801849 340.319397,426.514435 326.373108,437.340576 |
|
16 |
C321.846924,440.854126 317.150848,442.821564 311.624023,440.126556 |
|
17 |
C306.051697,437.409393 304.824646,432.326752 304.824219,426.699829 |
|
18 |
C304.822296,400.869629 304.819458,375.039429 304.815826,349.209229 |
|
19 |
C304.814545,340.195190 304.813110,340.201019 295.993561,340.199890 |
|
20 |
C218.336304,340.190186 140.679047,340.181335 63.021797,340.152405 |
|
21 |
C60.697311,340.151520 58.332092,340.168915 56.056168,339.773315 |
|
22 |
C49.421066,338.619995 45.732994,334.472748 45.713638,327.747528 |
|
23 |
C45.627792,297.918060 45.625164,268.088104 45.700039,238.258621 |
|
24 |
C45.718922,230.736664 50.375137,226.311478 58.507198,225.913071 |
|
25 |
C63.161861,225.685013 67.836388,225.862366 73.001549,225.857483 |
|
26 |
z"/> |
|
27 |
</svg> |
GES_PAC/Resources/Styles/Styles.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?>
|
|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 | 2 |
<?xaml-comp compile="true" ?> |
3 | 3 |
<ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> |
4 | 4 |
|
... | ... | |
475 | 475 |
<Setter Property="TextColor" Value="{StaticResource InraeTertiary}" /> |
476 | 476 |
<Setter Property="FontSize" Value="Medium" /> |
477 | 477 |
</Style> |
478 |
|
|
479 |
|
|
478 |
|
|
479 |
|
|
480 |
<!-- STYLE PROPRE A GES_PAC --> |
|
481 |
<Style x:Key="ChambreButtonStyle" TargetType="Button"> |
|
482 |
<Setter Property="BackgroundColor" Value="White"/> |
|
483 |
<Setter Property="TextColor" Value="Black"/> |
|
484 |
<Setter Property="BorderColor" Value="Black"/> |
|
485 |
<Setter Property="BorderWidth" Value="1"/> |
|
486 |
<Setter Property="CornerRadius" Value="5"/> |
|
487 |
<Setter Property="WidthRequest" Value="75"/> |
|
488 |
<Setter Property="HeightRequest" Value="75"/> |
|
489 |
<Setter Property="FontAttributes" Value="Bold"/> |
|
490 |
<Setter Property="VisualStateManager.VisualStateGroups"> |
|
491 |
<VisualStateGroupList> |
|
492 |
<VisualStateGroup x:Name="CommonStates"> |
|
493 |
<VisualState x:Name="Normal"> |
|
494 |
<VisualState.Setters> |
|
495 |
<Setter Property="BackgroundColor" Value="White"/> |
|
496 |
<Setter Property="TextColor" Value="Black"/> |
|
497 |
</VisualState.Setters> |
|
498 |
</VisualState> |
|
499 |
<VisualState x:Name="Pressed"> |
|
500 |
<VisualState.Setters> |
|
501 |
<Setter Property="BackgroundColor" Value="#E0E0E0"/> |
|
502 |
<Setter Property="TextColor" Value="Gray"/> |
|
503 |
</VisualState.Setters> |
|
504 |
</VisualState> |
|
505 |
</VisualStateGroup> |
|
506 |
</VisualStateGroupList> |
|
507 |
</Setter> |
|
508 |
</Style> |
|
509 |
|
|
510 |
|
|
511 |
|
|
480 | 512 |
</ResourceDictionary> |
GES_PAC/View/ChambersView.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<ContentPage 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" |
|
5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
|
6 |
x:Class="GES_PAC.View.ChambersView" |
|
7 |
x:DataType="vm:ChambersViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<StackLayout BackgroundColor="White" Spacing="50"> |
|
11 |
<tools:ConnectionIndicatorView /> |
|
12 |
<ScrollView> |
|
13 |
|
|
14 |
<VerticalStackLayout Grid.Row="1" Spacing="5"> |
|
15 |
|
|
16 |
<Label Text="Série n°1" |
|
17 |
FontSize="16" |
|
18 |
FontAttributes="Bold" |
|
19 |
HorizontalOptions="Center" /> |
|
20 |
|
|
21 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center" Spacing="10"> |
|
22 |
|
|
23 |
<!-- Remorque --> |
|
24 |
<Border Stroke="Black" StrokeThickness="2" BackgroundColor="Transparent" HorizontalOptions="Center" StrokeShape="RoundRectangle 10"> |
|
25 |
|
|
26 |
<Grid |
|
27 |
BackgroundColor="LightGray" |
|
28 |
Padding="5" |
|
29 |
RowSpacing="0" |
|
30 |
ColumnSpacing="5" |
|
31 |
WidthRequest="250" |
|
32 |
HeightRequest="500"> |
|
33 |
|
|
34 |
<Grid.ColumnDefinitions> |
|
35 |
<ColumnDefinition Width="Auto"/> |
|
36 |
<ColumnDefinition Width="80"/> |
|
37 |
<ColumnDefinition Width="Auto"/> |
|
38 |
</Grid.ColumnDefinitions> |
|
39 |
|
|
40 |
<Grid.RowDefinitions> |
|
41 |
<RowDefinition Height="*" /> |
|
42 |
<RowDefinition Height="*" /> |
|
43 |
<RowDefinition Height="*" /> |
|
44 |
<RowDefinition Height="*" /> |
|
45 |
<RowDefinition Height="*" /> |
|
46 |
<RowDefinition Height="*" /> |
|
47 |
</Grid.RowDefinitions> |
|
48 |
|
|
49 |
<!-- Boutons Gauche --> |
|
50 |
<Button Grid.Row="5" Grid.Column="0" Text="1" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="1"/> |
|
51 |
<Button Grid.Row="4" Grid.Column="0" Text="3" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="3"/> |
|
52 |
<Button Grid.Row="3" Grid.Column="0" Text="5" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="5"/> |
|
53 |
<Button Grid.Row="2" Grid.Column="0" Text="7" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="7"/> |
|
54 |
<Button Grid.Row="1" Grid.Column="0" Text="9" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="9"/> |
|
55 |
<Button Grid.Row="0" Grid.Column="0" Text="11" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="11"/> |
|
56 |
|
|
57 |
<!-- Boutons Droite --> |
|
58 |
<Button Grid.Row="5" Grid.Column="2" Text="2" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="2"/> |
|
59 |
<Button Grid.Row="4" Grid.Column="2" Text="4" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="4"/> |
|
60 |
<Button Grid.Row="3" Grid.Column="2" Text="6" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="6"/> |
|
61 |
<Button Grid.Row="2" Grid.Column="2" Text="8" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="8"/> |
|
62 |
<Button Grid.Row="1" Grid.Column="2" Text="10" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="10"/> |
|
63 |
<Button Grid.Row="0" Grid.Column="2" Text="12" Style="{StaticResource ChambreButtonStyle}" Command="{Binding OnClickChamberCommand}" CommandParameter="12"/> |
|
64 |
|
|
65 |
<!-- Couloir central --> |
|
66 |
<BoxView Grid.Column="1" Grid.RowSpan="6" HeightRequest="500" WidthRequest="75" Color="Gray"/> |
|
67 |
</Grid> |
|
68 |
</Border> |
|
69 |
|
|
70 |
<!-- Arrow --> |
|
71 |
<Image Source="arrow" |
|
72 |
HeightRequest="75" |
|
73 |
WidthRequest="75" |
|
74 |
Rotation="-90" |
|
75 |
TranslationY="-60" |
|
76 |
HorizontalOptions="Center" |
|
77 |
BackgroundColor="gray"/> |
|
78 |
</VerticalStackLayout> |
|
79 |
|
|
80 |
|
|
81 |
</VerticalStackLayout> |
|
82 |
</ScrollView> |
|
83 |
<StackLayout |
|
84 |
Margin="-40" |
|
85 |
HorizontalOptions="Center" |
|
86 |
Orientation="Horizontal" |
|
87 |
VerticalOptions="Fill"> |
|
88 |
|
|
89 |
<Button |
|
90 |
Text="Terminer les mesures" |
|
91 |
Command="{Binding CreateSetCommand}" |
|
92 |
Style="{StaticResource btnNormal}" |
|
93 |
IsEnabled="{Binding IsFormValid}" |
|
94 |
VerticalOptions="End"/> |
|
95 |
</StackLayout> |
|
96 |
</StackLayout> |
|
97 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}"> |
|
98 |
<Border StrokeThickness="0" |
|
99 |
Background="Black" |
|
100 |
Opacity="0.5" |
|
101 |
Padding="20" |
|
102 |
WidthRequest="160" |
|
103 |
HeightRequest="160" |
|
104 |
HorizontalOptions="Center" |
|
105 |
VerticalOptions="Center" |
|
106 |
StrokeShape="RoundRectangle 20"> |
|
107 |
|
|
108 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
|
109 |
<ActivityIndicator IsRunning="True" Color="White" /> |
|
110 |
<Label Text="Chargement..." |
|
111 |
FontSize="14" |
|
112 |
TextColor="white" |
|
113 |
HorizontalOptions="Center"/> |
|
114 |
</VerticalStackLayout> |
|
115 |
</Border> |
|
116 |
</Grid> |
|
117 |
</Grid> |
|
118 |
|
|
119 |
</ContentPage> |
GES_PAC/View/ChambersView.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel; |
|
2 |
|
|
3 |
namespace GES_PAC.View |
|
4 |
{ |
|
5 |
public partial class ChambersView |
|
6 |
{ |
|
7 |
public ChambersView() |
|
8 |
{ |
|
9 |
InitializeComponent(); |
|
10 |
BindingContext = new ChambersViewModel(); |
|
11 |
} |
|
12 |
} |
|
13 |
} |
GES_PAC/View/CreateCalibrationView.xaml | ||
---|---|---|
36 | 36 |
IsVisible="{Binding TypeError}"/> |
37 | 37 |
</VerticalStackLayout> |
38 | 38 |
|
39 |
<!-- CH4 --> |
|
40 |
<VerticalStackLayout> |
|
41 |
<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"/> |
|
47 |
<Label Text="Entrez une valeur" |
|
48 |
FontSize="12" |
|
49 |
TextColor="Red" |
|
50 |
IsVisible="{Binding ConcCH4Error}"/> |
|
51 |
</VerticalStackLayout> |
|
52 |
|
|
39 | 53 |
<!-- O2 --> |
40 | 54 |
<VerticalStackLayout> |
41 | 55 |
<Label Text="O2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
... | ... | |
64 | 78 |
IsVisible="{Binding ConcCO2Error}"/> |
65 | 79 |
</VerticalStackLayout> |
66 | 80 |
|
67 |
<!-- CH4 --> |
|
68 |
<VerticalStackLayout> |
|
69 |
<Label Text="CH4 (ppm)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
70 |
<Entry Text="{Binding ConcCH4, Mode=TwoWay, TargetNullValue=''}" |
|
71 |
FontSize="16" |
|
72 |
TextColor="Black" |
|
73 |
Placeholder="0,0" |
|
74 |
Keyboard="Numeric"/> |
|
75 |
<Label Text="Entrez une valeur" |
|
81 |
<!-- Ref Bouteille --> |
|
82 |
<VerticalStackLayout IsVisible="{Binding IsRefBouteilleVisible}"> |
|
83 |
<Label Text="Référence bouteille" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
84 |
<Entry Text="{Binding RefBouteille}" |
|
85 |
FontSize="16" |
|
86 |
TextColor="Black" |
|
87 |
Placeholder="0001-0002"/> |
|
88 |
<Label Text="Min. 5 caractères" |
|
76 | 89 |
FontSize="12" |
77 | 90 |
TextColor="Red" |
78 |
IsVisible="{Binding ConcCH4Error}"/>
|
|
91 |
IsVisible="{Binding RefBouteilleError}"/>
|
|
79 | 92 |
</VerticalStackLayout> |
80 | 93 |
|
81 |
|
|
82 | 94 |
</VerticalStackLayout> |
83 | 95 |
</VerticalStackLayout> |
84 | 96 |
</ScrollView> |
... | ... | |
89 | 101 |
VerticalOptions="FillAndExpand"> |
90 | 102 |
|
91 | 103 |
<Button |
92 |
Text="Créer une journée"
|
|
104 |
Text="Enregistrer les mesures"
|
|
93 | 105 |
Command="{Binding CreateCalibrationCommand}" |
94 | 106 |
Style="{StaticResource btnNormal}" |
95 | 107 |
IsEnabled="{Binding IsFormValid}" |
GES_PAC/View/CreateSetView.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<ContentPage 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" |
|
5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
|
6 |
x:Class="GES_PAC.View.CreateSetView" |
|
7 |
x:DataType="vm:CreateSetViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<StackLayout BackgroundColor="White" Spacing="50"> |
|
11 |
<tools:ConnectionIndicatorView /> |
|
12 |
<ScrollView> |
|
13 |
|
|
14 |
<VerticalStackLayout Grid.Row="1" Spacing="30"> |
|
15 |
|
|
16 |
<Label Text="Informations de la série" |
|
17 |
FontSize="20" |
|
18 |
FontAttributes="Bold" |
|
19 |
HorizontalOptions="Center" /> |
|
20 |
<VerticalStackLayout Spacing="15" WidthRequest="300"> |
|
21 |
|
|
22 |
<!-- Mise à jeun --> |
|
23 |
<VerticalStackLayout> |
|
24 |
|
|
25 |
<Label Text="Heure de mise à jeun" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
26 |
|
|
27 |
<HorizontalStackLayout HorizontalOptions="Center"> |
|
28 |
<TimePicker Time="{Binding TimeMAJ, Mode=TwoWay}" |
|
29 |
Format="HH:mm" FontSize="20"/> |
|
30 |
</HorizontalStackLayout> |
|
31 |
|
|
32 |
|
|
33 |
<Label Text="Sélectionnez une heure valide" |
|
34 |
FontSize="12" |
|
35 |
TextColor="Red" |
|
36 |
IsVisible="{Binding DateMAJError}"/> |
|
37 |
</VerticalStackLayout> |
|
38 |
|
|
39 |
<!-- Température --> |
|
40 |
<VerticalStackLayout> |
|
41 |
<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 |
<Label Text="Entrez une valeur" |
|
44 |
FontSize="12" |
|
45 |
TextColor="Red" |
|
46 |
IsVisible="{Binding TemperatureError}"/> |
|
47 |
</VerticalStackLayout> |
|
48 |
|
|
49 |
<!-- Humidité --> |
|
50 |
<VerticalStackLayout> |
|
51 |
<Label Text="Humidité (%)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
52 |
<Entry Text="{Binding Humidite}" FontSize="16" TextColor="Black" Placeholder="50" Keyboard="Numeric"/> |
|
53 |
<Label Text="Entrez une valeur" |
|
54 |
FontSize="12" |
|
55 |
TextColor="Red" |
|
56 |
IsVisible="{Binding HumiditeError}"/> |
|
57 |
</VerticalStackLayout> |
|
58 |
|
|
59 |
<!-- Pression --> |
|
60 |
<VerticalStackLayout> |
|
61 |
<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 |
<Label Text="Entrez une valeur" |
|
64 |
FontSize="12" |
|
65 |
TextColor="Red" |
|
66 |
IsVisible="{Binding PressionError}"/> |
|
67 |
</VerticalStackLayout> |
|
68 |
|
|
69 |
</VerticalStackLayout> |
|
70 |
</VerticalStackLayout> |
|
71 |
</ScrollView> |
|
72 |
<StackLayout |
|
73 |
Margin="10" |
|
74 |
HorizontalOptions="CenterAndExpand" |
|
75 |
Orientation="Horizontal" |
|
76 |
VerticalOptions="FillAndExpand"> |
|
77 |
|
|
78 |
<Button |
|
79 |
Text="Enregistrer" |
|
80 |
Command="{Binding CreateSetCommand}" |
|
81 |
Style="{StaticResource btnNormal}" |
|
82 |
IsEnabled="{Binding IsFormValid}" |
|
83 |
VerticalOptions="End"/> |
|
84 |
</StackLayout> |
|
85 |
</StackLayout> |
|
86 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}"> |
|
87 |
<Border StrokeThickness="0" |
|
88 |
Background="Black" |
|
89 |
Opacity="0.5" |
|
90 |
Padding="20" |
|
91 |
WidthRequest="160" |
|
92 |
HeightRequest="160" |
|
93 |
HorizontalOptions="Center" |
|
94 |
VerticalOptions="Center" |
|
95 |
StrokeShape="RoundRectangle 20"> |
|
96 |
|
|
97 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
|
98 |
<ActivityIndicator IsRunning="True" Color="White" /> |
|
99 |
<Label Text="Chargement..." |
|
100 |
FontSize="14" |
|
101 |
TextColor="white" |
|
102 |
HorizontalOptions="Center"/> |
|
103 |
</VerticalStackLayout> |
|
104 |
</Border> |
|
105 |
</Grid> |
|
106 |
</Grid> |
|
107 |
|
|
108 |
</ContentPage> |
GES_PAC/View/CreateSetView.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel; |
|
2 |
|
|
3 |
namespace GES_PAC.View; |
|
4 |
|
|
5 |
public partial class CreateSetView |
|
6 |
{ |
|
7 |
public CreateSetView() |
|
8 |
{ |
|
9 |
InitializeComponent(); |
|
10 |
BindingContext = new CreateSetViewModel(); |
|
11 |
} |
|
12 |
} |
GES_PAC/View/EnterAnimal.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<ContentPage 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" |
|
5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
|
6 |
x:Class="GES_PAC.View.EnterAnimalView" |
|
7 |
x:DataType="vm:EnterAnimalViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<StackLayout BackgroundColor="White" Spacing="50"> |
|
11 |
<tools:ConnectionIndicatorView /> |
|
12 |
<ScrollView> |
|
13 |
|
|
14 |
<VerticalStackLayout Grid.Row="1" Spacing="30"> |
|
15 |
|
|
16 |
<Label Text="Informations de la série" |
|
17 |
FontSize="20" |
|
18 |
FontAttributes="Bold" |
|
19 |
HorizontalOptions="Center" /> |
|
20 |
<VerticalStackLayout Spacing="15" WidthRequest="300"> |
|
21 |
|
|
22 |
<!-- Num RFID --> |
|
23 |
<VerticalStackLayout> |
|
24 |
|
|
25 |
<Label Text="Numéro RFID" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
26 |
<Entry Text="{Binding NumRFID}" FontSize="16" TextColor="Black" Placeholder="25"/> |
|
27 |
<Label Text="Entrez une valeur" |
|
28 |
FontSize="12" |
|
29 |
TextColor="Red" |
|
30 |
IsVisible="{Binding NumRFIDError}"/> |
|
31 |
|
|
32 |
</VerticalStackLayout> |
|
33 |
|
|
34 |
<!-- Poids --> |
|
35 |
<VerticalStackLayout> |
|
36 |
<Label Text="Température (°C)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
|
37 |
<Entry Text="{Binding Temperature}" FontSize="16" TextColor="Black" Placeholder="25" Keyboard="Numeric"/> |
|
38 |
<Label Text="Entrez une valeur" |
|
39 |
FontSize="12" |
|
40 |
TextColor="Red" |
|
41 |
IsVisible="{Binding TemperatureError}"/> |
|
42 |
</VerticalStackLayout> |
|
43 |
|
|
44 |
</VerticalStackLayout> |
|
45 |
</VerticalStackLayout> |
|
46 |
</ScrollView> |
|
47 |
<StackLayout |
|
48 |
Margin="10" |
|
49 |
HorizontalOptions="CenterAndExpand" |
|
50 |
Orientation="Horizontal" |
|
51 |
VerticalOptions="FillAndExpand"> |
|
52 |
|
|
53 |
<Button |
|
54 |
Text="Enregistrer" |
|
55 |
Command="{Binding CreateSetCommand}" |
|
56 |
Style="{StaticResource btnNormal}" |
|
57 |
IsEnabled="{Binding IsFormValid}" |
|
58 |
VerticalOptions="End"/> |
|
59 |
</StackLayout> |
|
60 |
</StackLayout> |
|
61 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}"> |
|
62 |
<Border StrokeThickness="0" |
|
63 |
Background="Black" |
|
64 |
Opacity="0.5" |
|
65 |
Padding="20" |
|
66 |
WidthRequest="160" |
|
67 |
HeightRequest="160" |
|
68 |
HorizontalOptions="Center" |
|
69 |
VerticalOptions="Center" |
|
70 |
StrokeShape="RoundRectangle 20"> |
|
71 |
|
|
72 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
|
73 |
<ActivityIndicator IsRunning="True" Color="White" /> |
|
74 |
<Label Text="Chargement..." |
|
75 |
FontSize="14" |
|
76 |
TextColor="white" |
|
77 |
HorizontalOptions="Center"/> |
|
78 |
</VerticalStackLayout> |
|
79 |
</Border> |
|
80 |
</Grid> |
|
81 |
</Grid> |
|
82 |
|
|
83 |
</ContentPage> |
GES_PAC/View/EnterAnimal.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel; |
|
2 |
|
|
3 |
namespace GES_PAC.View; |
|
4 |
|
|
5 |
public partial class EnterAnimalView |
|
6 |
{ |
|
7 |
public EnterAnimalView() |
|
8 |
{ |
|
9 |
InitializeComponent(); |
|
10 |
BindingContext = new EnterAnimalViewModel(); |
|
11 |
} |
|
12 |
} |
GES_PAC/View/SetListView.xaml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<ContentPage 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" |
|
5 |
xmlns:tools="clr-namespace:GES_PAC.View.Tools" |
|
6 |
x:Class="GES_PAC.View.SetListView" |
|
7 |
x:DataType="vm:SetListViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<StackLayout BackgroundColor="White" Spacing="50"> |
|
11 |
|
|
12 |
<tools:ConnectionIndicatorView /> |
|
13 |
<ScrollView> |
|
14 |
<StackLayout Spacing="100"> |
|
15 |
|
|
16 |
<Label Text="Pas de série disponible" |
|
17 |
FontSize="18" |
|
18 |
HorizontalOptions="Center"/> |
|
19 |
|
|
20 |
|
|
21 |
</StackLayout> |
|
22 |
</ScrollView> |
|
23 |
<StackLayout |
|
24 |
Margin="10" |
|
25 |
HorizontalOptions="CenterAndExpand" |
|
26 |
Orientation="Horizontal" |
|
27 |
VerticalOptions="FillAndExpand"> |
|
28 |
|
|
29 |
<Button |
|
30 |
Text="Créer une série" |
|
31 |
Command="{Binding GoToCreateSetCommand}" |
|
32 |
Style="{StaticResource btnNormal}" |
|
33 |
VerticalOptions="End"/> |
|
34 |
</StackLayout> |
|
35 |
</StackLayout> |
|
36 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}"> |
|
37 |
<Border StrokeThickness="0" |
|
38 |
Background="Black" |
|
39 |
Opacity="0.5" |
|
40 |
Padding="20" |
|
41 |
WidthRequest="160" |
|
42 |
HeightRequest="160" |
|
43 |
HorizontalOptions="Center" |
|
44 |
VerticalOptions="Center" |
|
45 |
StrokeShape="RoundRectangle 20"> |
|
46 |
|
|
47 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
|
48 |
<ActivityIndicator IsRunning="True" Color="White" /> |
|
49 |
<Label Text="Chargement..." |
|
50 |
FontSize="14" |
|
51 |
TextColor="white" |
|
52 |
HorizontalOptions="Center"/> |
|
53 |
</VerticalStackLayout> |
|
54 |
</Border> |
|
55 |
</Grid> |
|
56 |
|
|
57 |
</Grid> |
|
58 |
</ContentPage> |
GES_PAC/View/SetListView.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel; |
|
2 |
|
|
3 |
namespace GES_PAC.View; |
|
4 |
|
|
5 |
public partial class SetListView |
|
6 |
{ |
|
7 |
public SetListView() |
|
8 |
{ |
|
9 |
InitializeComponent(); |
|
10 |
BindingContext = new SetListViewModel(); |
|
11 |
} |
|
12 |
} |
GES_PAC/ViewModel/ChambersViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.View; |
|
3 |
using System.Windows.Input; |
|
4 |
|
|
5 |
namespace GES_PAC.ViewModel |
|
6 |
{ |
|
7 |
public class ChambersViewModel : BaseViewModel |
|
8 |
{ |
|
9 |
|
|
10 |
#region Attributs |
|
11 |
#endregion |
|
12 |
|
|
13 |
#region Commandes |
|
14 |
public ICommand OnClickChamberCommand { get; } |
|
15 |
#endregion |
|
16 |
|
|
17 |
#region Propriétés |
|
18 |
|
|
19 |
#endregion |
|
20 |
|
|
21 |
#region Constructeurs |
|
22 |
public ChambersViewModel() |
|
23 |
{ |
|
24 |
OnClickChamberCommand = new Command<int>(async (id) => await GoToEnterAnimal(id)); |
|
25 |
|
|
26 |
} |
|
27 |
#endregion |
|
28 |
|
|
29 |
#region Méthodes |
|
30 |
private async Task GoToEnterAnimal(int id) |
|
31 |
{ |
|
32 |
IsBusy = true; |
|
33 |
await Shell.Current.GoToAsync($"{nameof(EnterAnimalView)}?chamberId={id}"); |
|
34 |
IsBusy = false; |
|
35 |
} |
|
36 |
#endregion |
|
37 |
} |
|
38 |
} |
GES_PAC/ViewModel/CreateCalibrationViewModel.cs | ||
---|---|---|
15 | 15 |
private double? _conc_o2; |
16 | 16 |
private double? _conc_co2; |
17 | 17 |
private double? _conc_ch4; |
18 |
private string _ref_bouteille; |
|
18 |
private string _refBouteille; |
|
19 |
private bool _isRefBouteilleVisible; |
|
19 | 20 |
private bool _isFormValid; |
20 | 21 |
#endregion |
21 | 22 |
|
... | ... | |
31 | 32 |
set |
32 | 33 |
{ |
33 | 34 |
_selectedType = value; |
35 |
IsRefBouteilleVisible = _selectedType.Name != "Air"; |
|
34 | 36 |
OnPropertyChanged(); |
35 | 37 |
ValidateForm(); |
36 | 38 |
} |
... | ... | |
70 | 72 |
} |
71 | 73 |
public string RefBouteille |
72 | 74 |
{ |
73 |
get => _ref_bouteille;
|
|
75 |
get => _refBouteille;
|
|
74 | 76 |
set |
75 | 77 |
{ |
76 |
_ref_bouteille = value;
|
|
78 |
_refBouteille = value;
|
|
77 | 79 |
OnPropertyChanged(); |
78 | 80 |
ValidateForm(); |
79 | 81 |
} |
80 | 82 |
} |
83 |
public bool IsRefBouteilleVisible |
|
84 |
{ |
|
85 |
get => _isRefBouteilleVisible; |
|
86 |
set |
|
87 |
{ |
|
88 |
_isRefBouteilleVisible = value; |
|
89 |
OnPropertyChanged(); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
81 | 93 |
public bool IsFormValid |
82 | 94 |
{ |
83 | 95 |
get => _isFormValid; |
... | ... | |
92 | 104 |
public bool ConcO2Error { get; private set; } = true; |
93 | 105 |
public bool ConcCO2Error { get; private set; } = true; |
94 | 106 |
public bool ConcCH4Error { get; private set; } = true; |
107 |
public bool RefBouteilleError { get; private set; } = true; |
|
95 | 108 |
#endregion |
96 | 109 |
|
97 | 110 |
#region Constructeurs |
... | ... | |
116 | 129 |
|
117 | 130 |
var date = DateTime.Now; |
118 | 131 |
var newCalib = new MesureCalibration(date, ConcO2 ?? 0, ConcCO2 ?? 0, ConcCH4 ?? 0, SelectedType, RefBouteille); |
119 |
var isComplete = JourneeViewModel.Instance.GetCurrentDay().AddCalibration(newCalib); |
|
132 |
var phaseCalibration = JourneeViewModel.Instance.GetCurrentPhase(); |
|
133 |
var isComplete = JourneeViewModel.Instance.GetCurrentDay().AddCalibration(newCalib, phaseCalibration); |
|
120 | 134 |
|
121 | 135 |
if (isComplete) |
122 | 136 |
{ |
123 |
await Shell.Current.GoToAsync(nameof(MainView));
|
|
137 |
await Shell.Current.GoToAsync(nameof(SetListView));
|
|
124 | 138 |
} |
125 | 139 |
else |
126 | 140 |
{ |
... | ... | |
136 | 150 |
ConcO2Error = ConcO2 == null; |
137 | 151 |
ConcCO2Error = ConcCO2 == null; |
138 | 152 |
ConcCH4Error = ConcCH4 == null; |
153 |
RefBouteilleError = IsRefBouteilleVisible && (RefBouteille == null || RefBouteille.Length < 5); |
|
139 | 154 |
|
140 | 155 |
OnPropertyChanged(nameof(TypeError)); |
141 | 156 |
OnPropertyChanged(nameof(ConcO2Error)); |
142 | 157 |
OnPropertyChanged(nameof(ConcCO2Error)); |
143 | 158 |
OnPropertyChanged(nameof(ConcCH4Error)); |
159 |
OnPropertyChanged(nameof(RefBouteilleError)); |
|
144 | 160 |
|
145 |
IsFormValid = !TypeError && !ConcO2Error && !ConcCO2Error && !ConcCH4Error; |
|
161 |
IsFormValid = !TypeError && !ConcO2Error && !ConcCO2Error && !ConcCH4Error && !RefBouteilleError;
|
|
146 | 162 |
|
147 | 163 |
(CreateCalibrationCommand as Command)?.ChangeCanExecute(); |
148 | 164 |
} |
GES_PAC/ViewModel/CreateSetViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.View; |
|
3 |
using System.Windows.Input; |
|
4 |
|
|
5 |
namespace GES_PAC.ViewModel |
|
6 |
{ |
|
7 |
public class CreateSetViewModel : BaseViewModel |
|
8 |
{ |
|
9 |
|
|
10 |
#region Attributs |
|
11 |
private DateTime _dateTimeMAJ = DateTime.Now; |
|
12 |
private double? _temperature; |
|
13 |
private double? _humidite; |
|
14 |
private double? _pression; |
|
15 |
private bool _isFormValid; |
|
16 |
#endregion |
|
17 |
|
|
18 |
#region Commandes |
|
19 |
public ICommand CreateSetCommand { get; } |
|
20 |
#endregion |
|
21 |
|
|
22 |
#region Propriétés |
|
23 |
|
|
24 |
public DateTime DateTimeMAJ |
|
25 |
{ |
|
26 |
get => _dateTimeMAJ; |
|
27 |
} |
|
28 |
|
|
29 |
public TimeSpan TimeMAJ |
|
30 |
{ |
|
31 |
get => _dateTimeMAJ.TimeOfDay; |
|
32 |
set |
|
33 |
{ |
|
34 |
_dateTimeMAJ = _dateTimeMAJ.Date + value; |
|
35 |
OnPropertyChanged(); |
|
36 |
ValidateForm(); |
|
37 |
} |
|
38 |
} |
|
39 |
|
|
40 |
public double? Temperature |
|
41 |
{ |
|
42 |
get => _temperature; |
|
43 |
set |
|
44 |
{ |
|
45 |
_temperature = value; |
|
46 |
OnPropertyChanged(); |
|
47 |
ValidateForm(); |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 |
public double? Pression |
|
52 |
{ |
|
53 |
get => _pression; |
|
54 |
set |
|
55 |
{ |
|
56 |
_pression = value; |
|
57 |
OnPropertyChanged(); |
|
58 |
ValidateForm(); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
public double? Humidite |
|
63 |
{ |
|
64 |
get => _humidite; |
|
65 |
set |
|
66 |
{ |
|
67 |
_humidite = value; |
|
68 |
OnPropertyChanged(); |
|
69 |
ValidateForm(); |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
public bool IsFormValid |
|
74 |
{ |
|
75 |
get => _isFormValid; |
|
76 |
set |
|
77 |
{ |
|
78 |
_isFormValid = value; |
|
79 |
OnPropertyChanged(); |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
public bool DateMAJError { get; private set; } = true; |
|
84 |
public bool TemperatureError { get; private set; } = true; |
|
85 |
public bool HumiditeError { get; private set; } = true; |
|
86 |
public bool PressionError { get; private set; } = true; |
|
87 |
#endregion |
|
88 |
|
|
89 |
#region Constructeurs |
|
90 |
public CreateSetViewModel() |
|
91 |
{ |
|
92 |
CreateSetCommand = new Command(async () => await CreateSet()); |
|
93 |
} |
|
94 |
#endregion |
|
95 |
|
|
96 |
#region Méthodes |
|
97 |
|
|
98 |
private async Task CreateSet() |
|
99 |
{ |
|
100 |
IsBusy = true; |
|
101 |
var date = DateTime.Now; |
|
102 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
|
103 |
var newSet = new Serie(date, DateTimeMAJ, Temperature ?? 0, Humidite ?? 0, Pression ?? 0); |
|
104 |
journeeActuelle.AddSerie(newSet); |
|
105 |
|
|
106 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView)); |
|
107 |
IsBusy = false; |
|
108 |
} |
|
109 |
|
|
110 |
private void ValidateForm() |
|
111 |
{ |
|
112 |
DateMAJError = DateTimeMAJ > DateTime.Now; |
|
113 |
TemperatureError = Temperature == null; |
|
114 |
HumiditeError = Humidite == null; |
|
115 |
PressionError = Pression == null; |
|
116 |
|
|
117 |
OnPropertyChanged(nameof(DateMAJError)); |
|
118 |
OnPropertyChanged(nameof(TemperatureError)); |
|
119 |
OnPropertyChanged(nameof(HumiditeError)); |
|
120 |
OnPropertyChanged(nameof(PressionError)); |
|
121 |
|
|
122 |
IsFormValid = !DateMAJError && !TemperatureError && !HumiditeError && !PressionError; |
|
123 |
|
|
124 |
(CreateSetCommand as Command)?.ChangeCanExecute(); |
|
125 |
} |
|
126 |
#endregion |
|
127 |
} |
|
128 |
} |
GES_PAC/ViewModel/EnterAnimalViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.View; |
|
3 |
using System.Windows.Input; |
|
4 |
|
|
5 |
namespace GES_PAC.ViewModel |
|
6 |
{ |
|
7 |
public class EnterAnimalViewModel : BaseViewModel |
|
8 |
{ |
|
9 |
|
|
10 |
#region Attributs |
|
11 |
private int _chamberId; |
|
12 |
|
|
13 |
private string _numrfid; |
|
14 |
private double? _poids; |
|
15 |
private bool _isFormValid; |
|
16 |
#endregion |
|
17 |
|
|
18 |
#region Commandes |
|
19 |
public ICommand EnterAnimalCommand { get; } |
|
20 |
#endregion |
|
21 |
|
|
22 |
#region Propriétés |
|
23 |
|
|
24 |
|
|
25 |
public int ChamberId |
|
26 |
{ |
|
27 |
get => _chamberId; |
|
28 |
set |
|
29 |
{ |
|
30 |
_chamberId = value; |
|
31 |
OnPropertyChanged(); |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 |
public string NumRFID |
|
36 |
{ |
|
37 |
get => _numrfid; |
|
38 |
set |
|
39 |
{ |
|
40 |
_numrfid = value; |
|
41 |
OnPropertyChanged(); |
|
42 |
ValidateForm(); |
|
43 |
} |
|
44 |
} |
|
45 |
|
|
46 |
public double? Poids |
|
47 |
{ |
|
48 |
get => _poids; |
|
49 |
set |
|
50 |
{ |
|
51 |
_poids = value; |
|
52 |
OnPropertyChanged(); |
|
53 |
ValidateForm(); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
public bool IsFormValid |
|
58 |
{ |
|
59 |
get => _isFormValid; |
|
60 |
set |
|
61 |
{ |
|
62 |
_isFormValid = value; |
|
63 |
OnPropertyChanged(); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
public bool NumRFIDError { get; private set; } = true; |
|
68 |
public bool PoidsError { get; private set; } = true; |
|
69 |
#endregion |
|
70 |
|
|
71 |
#region Constructeurs |
|
72 |
public EnterAnimalViewModel() |
|
73 |
{ |
|
74 |
EnterAnimalCommand = new Command(async () => await EnterAnimal()); |
|
75 |
} |
|
76 |
#endregion |
|
77 |
|
|
78 |
#region Méthodes |
|
79 |
|
|
80 |
private async Task EnterAnimal() |
|
81 |
{ |
|
82 |
IsBusy = true; |
|
83 |
var date = DateTime.Now; |
|
84 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
|
85 |
var newSet = new SerieAnimal(); |
|
86 |
journeeActuelle.AddSerie(newSet); //getcurrentset a créer |
|
87 |
|
|
88 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView)); |
|
89 |
IsBusy = false; |
|
90 |
} |
|
91 |
|
|
92 |
private void ValidateForm() |
|
93 |
{ |
|
94 |
NumRFIDError = NumRFID == null; |
|
95 |
PoidsError = Poids == null; |
|
96 |
|
|
97 |
OnPropertyChanged(nameof(NumRFIDError)); |
|
98 |
OnPropertyChanged(nameof(PoidsError)); |
|
99 |
|
|
100 |
IsFormValid = !NumRFIDError && !PoidsError; |
|
101 |
|
|
102 |
(EnterAnimalCommand as Command)?.ChangeCanExecute(); |
|
103 |
} |
|
104 |
#endregion |
|
105 |
} |
|
106 |
} |
GES_PAC/ViewModel/JourneeViewModel.cs | ||
---|---|---|
29 | 29 |
DateTime today = DateTime.Today; |
30 | 30 |
return Journees.FirstOrDefault(j => j.Date.Date == today); |
31 | 31 |
} |
32 |
public PhaseCalibration GetCurrentPhase() |
|
33 |
{ |
|
34 |
var journeeActuelle = GetCurrentDay(); |
|
35 |
return journeeActuelle.GetCurrentPhase(); |
|
36 |
} |
|
32 | 37 |
#endregion |
33 | 38 |
} |
34 | 39 |
} |
GES_PAC/ViewModel/SetListViewModel.cs | ||
---|---|---|
1 |
using System.Windows.Input; |
|
2 |
using GES_PAC.Services; |
|
3 |
using GES_PAC.View; |
|
4 |
|
|
5 |
|
|
6 |
namespace GES_PAC.ViewModel |
|
7 |
{ |
|
8 |
public class SetListViewModel : BaseViewModel |
|
9 |
{ |
|
10 |
#region Services |
|
11 |
private readonly ConnexionService connService; |
|
12 |
#endregion |
|
13 |
|
|
14 |
#region Commandes |
|
15 |
public ICommand GoToCreateSetCommand { get; } |
|
16 |
#endregion |
|
17 |
|
|
18 |
#region Constructeur |
|
19 |
public SetListViewModel() |
|
20 |
{ |
|
21 |
GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage()); |
|
22 |
} |
|
23 |
#endregion |
|
24 |
|
|
25 |
#region Méthodes |
|
26 |
private async Task GoToCreateSetPage() |
|
27 |
{ |
|
28 |
IsBusy = true; |
|
29 |
await Shell.Current.GoToAsync(nameof(CreateSetView)); |
|
30 |
IsBusy = false; |
|
31 |
} |
|
32 |
#endregion |
|
33 |
} |
|
34 |
} |
|
35 |
|
Formats disponibles : Unified diff