Révision 957b1f34
GES_PAC/AppShell.xaml.cs | ||
---|---|---|
22 | 22 |
Routing.RegisterRoute(nameof(CreateMeasureView), typeof(CreateMeasureView)); |
23 | 23 |
Routing.RegisterRoute(nameof(CreateBehaviourView), typeof(CreateBehaviourView)); |
24 | 24 |
Routing.RegisterRoute(nameof(EndSetView), typeof(EndSetView)); |
25 |
Routing.RegisterRoute(nameof(EndDayView), typeof(EndDayView)); |
|
25 | 26 |
} |
26 | 27 |
} |
27 | 28 |
} |
GES_PAC/GES_PAC.csproj | ||
---|---|---|
114 | 114 |
<MauiXaml Update="View\CreateSetView.xaml"> |
115 | 115 |
<Generator>MSBuild:Compile</Generator> |
116 | 116 |
</MauiXaml> |
117 |
<MauiXaml Update="View\EndDayView.xaml"> |
|
118 |
<Generator>MSBuild:Compile</Generator> |
|
119 |
</MauiXaml> |
|
117 | 120 |
<MauiXaml Update="View\EndSetView.xaml"> |
118 | 121 |
<Generator>MSBuild:Compile</Generator> |
119 | 122 |
</MauiXaml> |
GES_PAC/Model/Calibration.cs | ||
---|---|---|
1 | 1 |
|
2 |
|
|
2 | 3 |
namespace GES_PAC.Model |
3 | 4 |
{ |
4 | 5 |
public class Calibration |
... | ... | |
34 | 35 |
{ |
35 | 36 |
return Mesures.Select(m => m.Type).Distinct().ToList(); |
36 | 37 |
} |
38 |
|
|
39 |
internal MesureCalibration? getMesureCalibrationByType(TypeCalibration typeCalibration) |
|
40 |
{ |
|
41 |
return Mesures.FirstOrDefault(mc => mc.Type == typeCalibration); |
|
42 |
} |
|
37 | 43 |
} |
38 | 44 |
} |
GES_PAC/Model/Journee.cs | ||
---|---|---|
1 |
|
|
2 |
using System.Diagnostics; |
|
3 |
using System.Linq; |
|
4 |
|
|
5 | 1 |
namespace GES_PAC.Model |
6 | 2 |
{ |
7 | 3 |
public class Journee |
... | ... | |
80 | 76 |
{ |
81 | 77 |
return Series.Count > 0; |
82 | 78 |
} |
79 |
internal int GetSetCount() |
|
80 |
{ |
|
81 |
return Series.Count; |
|
82 |
} |
|
83 |
internal int GetDayAnimalCount() |
|
84 |
{ |
|
85 |
return Series.Sum(s => s.GetAnimalCount()); |
|
86 |
} |
|
87 |
|
|
88 |
internal int GetDayMeasureCount() |
|
89 |
{ |
|
90 |
return Series.Sum(s => s.GetMeasureCount()); |
|
91 |
} |
|
92 |
|
|
93 |
internal int GetDayBehaviourCount() |
|
94 |
{ |
|
95 |
return Series.Sum(s => s.GetBehaviourCount()); |
|
96 |
} |
|
97 |
internal Calibration GetLastCalibration() |
|
98 |
{ |
|
99 |
return Calibrations.Last(); |
|
100 |
} |
|
101 |
internal Calibration GetDebutCalibration() |
|
102 |
{ |
|
103 |
return Calibrations.First(c => c.Phase == PhaseCalibration.Debut); |
|
104 |
} |
|
83 | 105 |
#endregion |
84 | 106 |
} |
85 | 107 |
} |
GES_PAC/View/CreateCalibrationView.xaml | ||
---|---|---|
40 | 40 |
<!-- CH4 --> |
41 | 41 |
<VerticalStackLayout> |
42 | 42 |
<Label Text="CH4 (ppm)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
43 |
<controls:DoubleEntry Text="{Binding ConcCH4, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
43 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
|
44 |
<controls:DoubleEntry Text="{Binding ConcCH4, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
45 |
<Label Grid.Column="1" |
|
46 |
Text="{Binding LastCH4, StringFormat='[{0} ppm]'}" |
|
47 |
FontSize="16" |
|
48 |
TextColor="{Binding LastCH4Color}" |
|
49 |
VerticalOptions="Center" |
|
50 |
HorizontalOptions="End" |
|
51 |
IsVisible="{Binding HasLastMeasure}" /> |
|
52 |
</Grid> |
|
44 | 53 |
<Label Text="Entrez une valeur" |
45 | 54 |
FontSize="12" |
46 | 55 |
TextColor="Red" |
... | ... | |
50 | 59 |
<!-- O2 --> |
51 | 60 |
<VerticalStackLayout> |
52 | 61 |
<Label Text="O2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
53 |
<controls:DoubleEntry Text="{Binding ConcO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
62 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
|
63 |
<controls:DoubleEntry Text="{Binding ConcO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
64 |
<Label Grid.Column="1" |
|
65 |
Text="{Binding LastO2, StringFormat='[{0} %]'}" |
|
66 |
FontSize="16" |
|
67 |
TextColor="{Binding LastO2Color}" |
|
68 |
VerticalOptions="Center" |
|
69 |
HorizontalOptions="End" |
|
70 |
IsVisible="{Binding HasLastMeasure}" /> |
|
71 |
</Grid> |
|
54 | 72 |
<Label Text="Entrez une valeur" |
55 | 73 |
FontSize="12" |
56 | 74 |
TextColor="Red" |
... | ... | |
60 | 78 |
<!-- CO2 --> |
61 | 79 |
<VerticalStackLayout> |
62 | 80 |
<Label Text="CO2 (% vol.)" FontSize="14" TextColor="Gray" FontAttributes="Bold"/> |
63 |
<controls:DoubleEntry Text="{Binding ConcCO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
81 |
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="5"> |
|
82 |
<controls:DoubleEntry Text="{Binding ConcCO2, Mode=OneWayToSource, TargetNullValue=''}" /> |
|
83 |
<Label Grid.Column="1" |
|
84 |
Text="{Binding LastCO2, StringFormat='[{0} %]'}" |
|
85 |
FontSize="16" |
|
86 |
TextColor="{Binding LastCO2Color}" |
|
87 |
VerticalOptions="Center" |
|
88 |
HorizontalOptions="End" |
|
89 |
IsVisible="{Binding HasLastMeasure}" /> |
|
90 |
</Grid> |
|
64 | 91 |
<Label Text="Entrez une valeur" |
65 | 92 |
FontSize="12" |
66 | 93 |
TextColor="Red" |
GES_PAC/View/EndDayView.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.EndDayView" |
|
7 |
x:DataType="vm:EndDayViewModel"> |
|
8 |
|
|
9 |
<Grid> |
|
10 |
<StackLayout BackgroundColor="White" Spacing="50"> |
|
11 |
|
|
12 |
<tools:ConnectionIndicatorView /> |
|
13 |
<ScrollView> |
|
14 |
<StackLayout Spacing="50"> |
|
15 |
|
|
16 |
<Label Text="Terminer la journée ?" |
|
17 |
FontSize="22" |
|
18 |
FontAttributes="Bold" |
|
19 |
HorizontalOptions="Center"/> |
|
20 |
|
|
21 |
<Label |
|
22 |
Text="{Binding NumberSet, StringFormat='Nombre de séries : {0}'}" |
|
23 |
FontSize="16" |
|
24 |
HorizontalOptions="Center" /> |
|
25 |
|
|
26 |
<Label |
|
27 |
Text="{Binding NumberAnimal, StringFormat='Nombre d animaux étudiés : {0}'}" |
|
28 |
FontSize="16" |
|
29 |
HorizontalOptions="Center" /> |
|
30 |
|
|
31 |
<Label |
|
32 |
Text="{Binding NumberMeasure, StringFormat='Nombre de mesures : {0}'}" |
|
33 |
FontSize="16" |
|
34 |
HorizontalOptions="Center" /> |
|
35 |
|
|
36 |
<Label |
|
37 |
Text="{Binding NumberBehaviour, StringFormat='Nombre de comportements : {0}'}" |
|
38 |
FontSize="16" |
|
39 |
HorizontalOptions="Center" /> |
|
40 |
|
|
41 |
</StackLayout> |
|
42 |
</ScrollView> |
|
43 |
<StackLayout |
|
44 |
Margin="10" |
|
45 |
HorizontalOptions="CenterAndExpand" |
|
46 |
Orientation="Horizontal" |
|
47 |
VerticalOptions="FillAndExpand"> |
|
48 |
|
|
49 |
<Button |
|
50 |
Text="Confirmer" |
|
51 |
Command="{Binding GoToCalibrationCommand}" |
|
52 |
Style="{StaticResource btnNormal}" |
|
53 |
VerticalOptions="End"/> |
|
54 |
</StackLayout> |
|
55 |
</StackLayout> |
|
56 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}"> |
|
57 |
<Border StrokeThickness="0" |
|
58 |
Background="Black" |
|
59 |
Opacity="0.5" |
|
60 |
Padding="20" |
|
61 |
WidthRequest="160" |
|
62 |
HeightRequest="160" |
|
63 |
HorizontalOptions="Center" |
|
64 |
VerticalOptions="Center" |
|
65 |
StrokeShape="RoundRectangle 20"> |
|
66 |
|
|
67 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center"> |
|
68 |
<ActivityIndicator IsRunning="True" Color="White" /> |
|
69 |
<Label Text="Chargement..." |
|
70 |
FontSize="14" |
|
71 |
TextColor="white" |
|
72 |
HorizontalOptions="Center"/> |
|
73 |
</VerticalStackLayout> |
|
74 |
</Border> |
|
75 |
</Grid> |
|
76 |
|
|
77 |
</Grid> |
|
78 |
</ContentPage> |
GES_PAC/View/EndDayView.xaml.cs | ||
---|---|---|
1 |
using GES_PAC.ViewModel; |
|
2 |
|
|
3 |
namespace GES_PAC.View |
|
4 |
{ |
|
5 |
public partial class EndDayView |
|
6 |
{ |
|
7 |
public EndDayView() |
|
8 |
{ |
|
9 |
InitializeComponent(); |
|
10 |
BindingContext = new EndDayViewModel(); |
|
11 |
} |
|
12 |
} |
|
13 |
} |
GES_PAC/View/EndSetView.xaml | ||
---|---|---|
43 | 43 |
|
44 | 44 |
<Button |
45 | 45 |
Text="Confirmer" |
46 |
Command="{Binding GoToCreateDayCommand}"
|
|
46 |
Command="{Binding GoToSetListCommand}"
|
|
47 | 47 |
Style="{StaticResource btnNormal}" |
48 | 48 |
VerticalOptions="End"/> |
49 | 49 |
</StackLayout> |
GES_PAC/View/SetListView.xaml | ||
---|---|---|
1 | 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="{Binding LastSetText}"
|
|
17 |
FontSize="18"
|
|
18 |
HorizontalOptions="Center"/>
|
|
19 |
|
|
20 |
|
|
21 |
</StackLayout>
|
|
22 |
</ScrollView>
|
|
23 |
<Grid ColumnDefinitions="*,Auto,*,Auto,*" |
|
24 |
HorizontalOptions="Center"
|
|
25 |
VerticalOptions="FillAndExpand">
|
|
26 |
|
|
27 |
<Button
|
|
28 |
Grid.Column="1"
|
|
29 |
Text="Reprendre la série"
|
|
30 |
Command="{Binding GoToLastSetCommand}" |
|
31 |
Style="{StaticResource btnNormal}"
|
|
32 |
VerticalOptions="End"
|
|
33 |
HorizontalOptions="Start"
|
|
34 |
IsVisible="{Binding HasLastSet}"
|
|
35 |
Margin="0,0,20,20"/>
|
|
36 |
|
|
37 |
<Button
|
|
38 |
Grid.Column="3" |
|
39 |
Text="Créer une série"
|
|
40 |
Command="{Binding GoToCreateSetCommand}"
|
|
41 |
Style="{StaticResource btnNormal}"
|
|
42 |
VerticalOptions="End"
|
|
43 |
HorizontalOptions="End"
|
|
44 |
Margin="20,0,0,20"/>
|
|
45 |
</Grid>
|
|
46 |
|
|
47 |
</StackLayout>
|
|
48 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}">
|
|
49 |
<Border StrokeThickness="0"
|
|
50 |
Background="Black"
|
|
51 |
Opacity="0.5"
|
|
52 |
Padding="20"
|
|
53 |
WidthRequest="160"
|
|
54 |
HeightRequest="160"
|
|
55 |
HorizontalOptions="Center"
|
|
56 |
VerticalOptions="Center"
|
|
57 |
StrokeShape="RoundRectangle 20">
|
|
58 |
|
|
59 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
|
|
60 |
<ActivityIndicator IsRunning="True" Color="White" />
|
|
61 |
<Label Text="Chargement..."
|
|
62 |
FontSize="14"
|
|
63 |
TextColor="white"
|
|
64 |
HorizontalOptions="Center"/>
|
|
65 |
</VerticalStackLayout>
|
|
66 |
</Border>
|
|
67 |
</Grid>
|
|
68 |
|
|
69 |
</Grid>
|
|
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="{Binding LastSetText}"
|
|
17 |
FontSize="18"
|
|
18 |
HorizontalOptions="Center"/>
|
|
19 |
|
|
20 |
</StackLayout> |
|
21 |
</ScrollView>
|
|
22 |
<StackLayout HorizontalOptions="Center" VerticalOptions="EndAndExpand" Spacing="75" Margin="0, 0, 0, 50">
|
|
23 |
|
|
24 |
<Button
|
|
25 |
Text="Créer une série"
|
|
26 |
Command="{Binding GoToCreateSetCommand}" |
|
27 |
Style="{StaticResource btnNormal}"
|
|
28 |
VerticalOptions="End"
|
|
29 |
HorizontalOptions="Center"/>
|
|
30 |
|
|
31 |
<Button
|
|
32 |
Text="Reprendre la série"
|
|
33 |
Command="{Binding GoToLastSetCommand}"
|
|
34 |
Style="{StaticResource btnNormal}"
|
|
35 |
VerticalOptions="End"
|
|
36 |
HorizontalOptions="Center" |
|
37 |
IsVisible="{Binding HasLastSet}"/>
|
|
38 |
|
|
39 |
<Button
|
|
40 |
Text="Terminer la journée"
|
|
41 |
Command="{Binding GoToEndDayCommand}"
|
|
42 |
Style="{StaticResource btnNormal}"
|
|
43 |
VerticalOptions="End"
|
|
44 |
HorizontalOptions="Center"/>
|
|
45 |
</StackLayout>
|
|
46 |
|
|
47 |
</StackLayout>
|
|
48 |
<Grid Grid.RowSpan="1" IsVisible="{Binding IsBusy}">
|
|
49 |
<Border StrokeThickness="0"
|
|
50 |
Background="Black"
|
|
51 |
Opacity="0.5"
|
|
52 |
Padding="20"
|
|
53 |
WidthRequest="160"
|
|
54 |
HeightRequest="160"
|
|
55 |
HorizontalOptions="Center"
|
|
56 |
VerticalOptions="Center"
|
|
57 |
StrokeShape="RoundRectangle 20">
|
|
58 |
|
|
59 |
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
|
|
60 |
<ActivityIndicator IsRunning="True" Color="White" />
|
|
61 |
<Label Text="Chargement..."
|
|
62 |
FontSize="14"
|
|
63 |
TextColor="white"
|
|
64 |
HorizontalOptions="Center"/>
|
|
65 |
</VerticalStackLayout>
|
|
66 |
</Border>
|
|
67 |
</Grid>
|
|
68 |
|
|
69 |
</Grid>
|
|
70 | 70 |
</ContentPage> |
GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs | ||
---|---|---|
8 | 8 |
{ |
9 | 9 |
#region Attributs |
10 | 10 |
private string _buttonText; |
11 |
private int _buttonCommandParameter;
|
|
11 |
private int _chamberId;
|
|
12 | 12 |
private Color _buttonBackgroundColor; |
13 | 13 |
private bool _buttonIsEnabled; |
14 | 14 |
private string _buttonLabel; |
... | ... | |
25 | 25 |
OnPropertyChanged(); |
26 | 26 |
} |
27 | 27 |
} |
28 |
public int ButtonCommandParameter
|
|
28 |
public int ChamberId
|
|
29 | 29 |
{ |
30 |
get => _buttonCommandParameter;
|
|
30 |
get => _chamberId;
|
|
31 | 31 |
set |
32 | 32 |
{ |
33 |
_buttonCommandParameter = value;
|
|
33 |
_chamberId = value;
|
|
34 | 34 |
OnPropertyChanged(); |
35 | 35 |
} |
36 | 36 |
} |
... | ... | |
87 | 87 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
88 | 88 |
|
89 | 89 |
ButtonText = chamberId.ToString(); |
90 |
ButtonCommandParameter = chamberId;
|
|
90 |
ChamberId = chamberId;
|
|
91 | 91 |
|
92 | 92 |
ButtonIsEnabled = JourneeViewModel.Instance.GetCurrentSet().GetIsInByNumeroBoite(chamberId); |
93 | 93 |
bool hasBehaviour = CurrentSet.GetHasBehaviourByNumeroBoite(chamberId); |
... | ... | |
103 | 103 |
if (IsBusy) return; |
104 | 104 |
IsBusy = true; |
105 | 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}"); |
|
106 |
var targetView = (CurrentSet.GetMeasureNumberByNumeroBoite(ChamberId) == 0) ? nameof(EnterAnimalView) : nameof(CreateMeasureView); |
|
107 |
|
|
108 |
await Shell.Current.GoToAsync($"{targetView}?chamberId={ChamberId}"); |
|
110 | 109 |
|
111 | 110 |
IsBusy = false; |
112 | 111 |
} |
GES_PAC/ViewModel/CreateCalibrationViewModel.cs | ||
---|---|---|
1 |
using CommunityToolkit.Maui.Core.Extensions; |
|
2 | 1 |
using GES_PAC.Model; |
3 | 2 |
using GES_PAC.View; |
4 | 3 |
using System.Collections.ObjectModel; |
5 |
using System.Diagnostics; |
|
6 | 4 |
using System.Windows.Input; |
7 | 5 |
|
8 | 6 |
namespace GES_PAC.ViewModel |
... | ... | |
17 | 15 |
private double? _conc_ch4; |
18 | 16 |
private string _refBouteille; |
19 | 17 |
private bool _isRefBouteilleVisible; |
18 |
private Calibration _lastCalibration; |
|
19 |
private bool _hasLastMeasure; |
|
20 |
private double? _lastO2; |
|
21 |
private double? _lastCO2; |
|
22 |
private double? _lastCH4; |
|
20 | 23 |
private bool _isFormValid; |
21 | 24 |
#endregion |
22 | 25 |
|
... | ... | |
34 | 37 |
_selectedType = value; |
35 | 38 |
IsRefBouteilleVisible = _selectedType.Name != "Air"; |
36 | 39 |
OnPropertyChanged(); |
40 |
OnTypeChanged(); |
|
37 | 41 |
ValidateForm(); |
38 | 42 |
} |
39 | 43 |
} |
... | ... | |
89 | 93 |
OnPropertyChanged(); |
90 | 94 |
} |
91 | 95 |
} |
96 |
public Calibration LastCalibration |
|
97 |
{ |
|
98 |
get => _lastCalibration; |
|
99 |
set |
|
100 |
{ |
|
101 |
_lastCalibration = value; |
|
102 |
OnPropertyChanged(); |
|
103 |
} |
|
104 |
} |
|
105 |
public bool HasLastMeasure |
|
106 |
{ |
|
107 |
get => _hasLastMeasure; |
|
108 |
set |
|
109 |
{ |
|
110 |
_hasLastMeasure = value; |
|
111 |
OnPropertyChanged(); |
|
112 |
} |
|
113 |
} |
|
114 |
public double? LastO2 |
|
115 |
{ |
|
116 |
get => _lastO2; |
|
117 |
set |
|
118 |
{ |
|
119 |
_lastO2 = value; |
|
120 |
OnPropertyChanged(); |
|
121 |
} |
|
122 |
} |
|
123 |
public double? LastCO2 |
|
124 |
{ |
|
125 |
get => _lastCO2; |
|
126 |
set |
|
127 |
{ |
|
128 |
_lastCO2 = value; |
|
129 |
OnPropertyChanged(); |
|
130 |
} |
|
131 |
} |
|
132 |
public double? LastCH4 |
|
133 |
{ |
|
134 |
get => _lastCH4; |
|
135 |
set |
|
136 |
{ |
|
137 |
_lastCH4 = value; |
|
138 |
OnPropertyChanged(); |
|
139 |
} |
|
140 |
} |
|
92 | 141 |
|
93 | 142 |
public bool IsFormValid |
94 | 143 |
{ |
... | ... | |
110 | 159 |
#region Constructeurs |
111 | 160 |
public CreateCalibrationViewModel() |
112 | 161 |
{ |
162 |
CreateCalibrationCommand = new Command(async () => await CreateCalibration()); |
|
113 | 163 |
|
114 | 164 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
115 | 165 |
var typesManquants = journeeActuelle.GetCurrentMissingCalibration(); |
116 | 166 |
|
117 | 167 |
TypeCalibrations = new ObservableCollection<TypeCalibration>(typesManquants); |
118 |
|
|
119 | 168 |
SelectedType = TypeCalibrations[0]; |
120 | 169 |
|
121 |
CreateCalibrationCommand = new Command(async () => await CreateCalibration()); |
|
170 |
if (journeeActuelle.GetCurrentPhase() == PhaseCalibration.Fin) |
|
171 |
{ |
|
172 |
LastCalibration = journeeActuelle.GetDebutCalibration(); |
|
173 |
HasLastMeasure = true; |
|
174 |
} |
|
122 | 175 |
} |
123 | 176 |
#endregion |
124 | 177 |
|
... | ... | |
133 | 186 |
var phaseCalibration = JourneeViewModel.Instance.GetCurrentPhase(); |
134 | 187 |
var isComplete = JourneeViewModel.Instance.GetCurrentDay().AddCalibration(newCalib, phaseCalibration); |
135 | 188 |
|
136 |
if (isComplete) |
|
137 |
{ |
|
138 |
await Shell.Current.GoToAsync(nameof(SetListView)); |
|
139 |
} |
|
140 |
else |
|
141 |
{ |
|
142 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView)); |
|
189 |
var targetView = nameof(CreateCalibrationView); |
|
190 |
if (isComplete) { |
|
191 |
targetView = phaseCalibration == PhaseCalibration.Debut ? nameof(SetListView) : nameof(MainView); |
|
143 | 192 |
} |
193 |
await Shell.Current.GoToAsync(targetView); |
|
144 | 194 |
|
145 | 195 |
IsBusy = false; |
146 | 196 |
} |
... | ... | |
163 | 213 |
|
164 | 214 |
(CreateCalibrationCommand as Command)?.ChangeCanExecute(); |
165 | 215 |
} |
216 |
|
|
217 |
private void OnTypeChanged() |
|
218 |
{ |
|
219 |
if (!HasLastMeasure) |
|
220 |
return; |
|
221 |
var mesureCalibration = LastCalibration.getMesureCalibrationByType(SelectedType); |
|
222 |
LastCH4 = mesureCalibration.Conc_CH4; |
|
223 |
LastO2 = mesureCalibration.Conc_O2; |
|
224 |
LastCO2 = mesureCalibration.Conc_CO2; |
|
225 |
} |
|
166 | 226 |
#endregion |
167 | 227 |
} |
168 | 228 |
} |
GES_PAC/ViewModel/EndDayViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.View; |
|
2 |
|
|
3 |
namespace GES_PAC.ViewModel |
|
4 |
{ |
|
5 |
public class EndDayViewModel : BaseViewModel |
|
6 |
{ |
|
7 |
#region Attributs |
|
8 |
private int _numberSet; |
|
9 |
private int _numberAnimal; |
|
10 |
private int _numberMeasure; |
|
11 |
private int _numberBehaviour; |
|
12 |
#endregion |
|
13 |
|
|
14 |
#region Commandes |
|
15 |
public Command GoToCalibrationCommand { get; } |
|
16 |
#endregion |
|
17 |
|
|
18 |
#region Propriétés |
|
19 |
public int NumberSet |
|
20 |
{ |
|
21 |
get => _numberSet; |
|
22 |
set |
|
23 |
{ |
|
24 |
SetProperty(ref _numberSet, value); |
|
25 |
OnPropertyChanged(); |
|
26 |
} |
|
27 |
} |
|
28 |
public int NumberAnimal |
|
29 |
{ |
|
30 |
get => _numberAnimal; |
|
31 |
set |
|
32 |
{ |
|
33 |
SetProperty(ref _numberAnimal, value); |
|
34 |
OnPropertyChanged(); |
|
35 |
} |
|
36 |
} |
|
37 |
public int NumberMeasure |
|
38 |
{ |
|
39 |
get => _numberMeasure; |
|
40 |
set |
|
41 |
{ |
|
42 |
SetProperty(ref _numberMeasure, value); |
|
43 |
OnPropertyChanged(); |
|
44 |
} |
|
45 |
} |
|
46 |
public int NumberBehaviour |
|
47 |
{ |
|
48 |
get => _numberBehaviour; |
|
49 |
set |
|
50 |
{ |
|
51 |
SetProperty(ref _numberBehaviour, value); |
|
52 |
OnPropertyChanged(); |
|
53 |
} |
|
54 |
} |
|
55 |
#endregion |
|
56 |
|
|
57 |
#region Constructeur |
|
58 |
public EndDayViewModel() |
|
59 |
{ |
|
60 |
var journeeActuelle = JourneeViewModel.Instance.GetCurrentDay(); |
|
61 |
NumberSet = journeeActuelle.GetSetCount(); |
|
62 |
NumberAnimal = journeeActuelle.GetDayAnimalCount(); |
|
63 |
NumberMeasure = journeeActuelle.GetDayMeasureCount(); |
|
64 |
NumberBehaviour = journeeActuelle.GetDayBehaviourCount(); |
|
65 |
GoToCalibrationCommand = new Command(async () => await GoToCalibrationPage()); |
|
66 |
} |
|
67 |
#endregion |
|
68 |
|
|
69 |
#region Méthodes |
|
70 |
private async Task GoToCalibrationPage() |
|
71 |
{ |
|
72 |
if (IsBusy) return; |
|
73 |
IsBusy = true; |
|
74 |
await Shell.Current.GoToAsync(nameof(CreateCalibrationView)); |
|
75 |
IsBusy = false; |
|
76 |
} |
|
77 |
#endregion |
|
78 |
} |
|
79 |
} |
GES_PAC/ViewModel/EndSetViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.Services; |
|
3 |
using GES_PAC.View; |
|
1 |
using GES_PAC.View; |
|
4 | 2 |
|
5 | 3 |
namespace GES_PAC.ViewModel |
6 | 4 |
{ |
... | ... | |
13 | 11 |
#endregion |
14 | 12 |
|
15 | 13 |
#region Commandes |
16 |
public Command GoToCreateDayCommand { get; }
|
|
14 |
public Command GoToSetListCommand { get; }
|
|
17 | 15 |
#endregion |
18 | 16 |
|
19 | 17 |
#region Propriétés |
... | ... | |
52 | 50 |
NumberAnimal = serieActuelle.GetAnimalCount(); |
53 | 51 |
NumberMeasure = serieActuelle.GetMeasureCount(); |
54 | 52 |
NumberBehaviour = serieActuelle.GetBehaviourCount(); |
55 |
GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage());
|
|
53 |
GoToSetListCommand = new Command(async () => await GoToSetListPage());
|
|
56 | 54 |
} |
57 | 55 |
#endregion |
58 | 56 |
|
59 | 57 |
#region Méthodes |
60 |
private async Task GoToCreateDayPage()
|
|
58 |
private async Task GoToSetListPage()
|
|
61 | 59 |
{ |
62 | 60 |
if (IsBusy) return; |
63 | 61 |
IsBusy = true; |
GES_PAC/ViewModel/MainViewModel.cs | ||
---|---|---|
18 | 18 |
public MainViewModel(ConnexionService connService) |
19 | 19 |
{ |
20 | 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); |
|
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.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.Debut); |
|
25 |
newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.Debut); |
|
26 |
newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.Debut); |
|
27 |
newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
|
28 |
newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false); |
|
29 |
JourneeViewModel.Instance.Journees.Add(newDay); |
|
27 | 30 |
//ONLY FOR TESTS |
28 | 31 |
|
29 | 32 |
this.connService = connService; |
GES_PAC/ViewModel/SetListViewModel.cs | ||
---|---|---|
27 | 27 |
#region Commandes |
28 | 28 |
public ICommand GoToCreateSetCommand { get; } |
29 | 29 |
public ICommand GoToLastSetCommand { get; } |
30 |
public ICommand GoToEndDayCommand { get; } |
|
30 | 31 |
#endregion |
31 | 32 |
|
32 | 33 |
#region Constructeur |
... | ... | |
34 | 35 |
{ |
35 | 36 |
GoToCreateSetCommand = new Command(async () => await GoToCreateSetPage()); |
36 | 37 |
GoToLastSetCommand = new Command(async () => await GoToLastSetPage()); |
38 |
GoToEndDayCommand = new Command(async () => await GoToEndDayPage()); |
|
37 | 39 |
|
38 | 40 |
HasLastSet = JourneeViewModel.Instance.GetCurrentDay().HasAnySet(); |
39 | 41 |
} |
... | ... | |
55 | 57 |
await Shell.Current.GoToAsync(nameof(ChambersView)); |
56 | 58 |
IsBusy = false; |
57 | 59 |
} |
60 |
private async Task GoToEndDayPage() |
|
61 |
{ |
|
62 |
if (IsBusy) return; |
|
63 |
IsBusy = true; |
|
64 |
await Shell.Current.GoToAsync(nameof(EndDayView)); |
|
65 |
IsBusy = false; |
|
66 |
} |
|
58 | 67 |
#endregion |
59 | 68 |
} |
60 | 69 |
} |
Formats disponibles : Unified diff