Révision 42456640
GES_PAC/AppShell.xaml | ||
---|---|---|
8 | 8 |
Shell.FlyoutBehavior="Flyout" |
9 | 9 |
x:DataType="vm:AppShellViewModel" |
10 | 10 |
Title="GES_PAC"> |
11 |
|
|
11 |
|
|
12 |
|
|
13 |
<ShellContent |
|
14 |
Title="Accueil" |
|
15 |
Route="Main" |
|
16 |
ContentTemplate="{DataTemplate local:MainView}" /> |
|
17 |
|
|
12 | 18 |
<ShellContent |
13 |
Title="Accueil"
|
|
14 |
Route="Main"
|
|
15 |
ContentTemplate="{DataTemplate local:MainView}" />
|
|
19 |
Title="Remorque"
|
|
20 |
Route="Chambers"
|
|
21 |
ContentTemplate="{DataTemplate local:ChambersView}" />
|
|
16 | 22 |
|
17 | 23 |
<ShellContent |
18 | 24 |
Title="Créer technicien" |
GES_PAC/GES_PAC.csproj.user | ||
---|---|---|
3 | 3 |
<PropertyGroup> |
4 | 4 |
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen> |
5 | 5 |
<ActiveDebugFramework>net9.0-android</ActiveDebugFramework> |
6 |
<ActiveDebugProfile>Samsung SM-G556B (Android 14.0 - API 34)</ActiveDebugProfile>
|
|
7 |
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
|
|
6 |
<ActiveDebugProfile>Android Emulator</ActiveDebugProfile>
|
|
7 |
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
|
|
8 | 8 |
<DefaultDevice>pixel_7_-_api_35</DefaultDevice> |
9 | 9 |
<SelectedDevice>Xiaomi 23090RA98G</SelectedDevice> |
10 | 10 |
</PropertyGroup> |
GES_PAC/Model/Journee.cs | ||
---|---|---|
25 | 25 |
#endregion |
26 | 26 |
|
27 | 27 |
#region Méthodes |
28 |
|
|
29 | 28 |
public bool AddCalibration(MesureCalibration mesureCalibration, PhaseCalibration phaseCalibration) |
30 | 29 |
{ |
31 | 30 |
var existing = Calibrations.FirstOrDefault(c => c.Phase == phaseCalibration); |
GES_PAC/View/ChambersView.xaml.cs | ||
---|---|---|
9 | 9 |
InitializeComponent(); |
10 | 10 |
BindingContext = new ChambersViewModel(); |
11 | 11 |
} |
12 |
protected override void OnAppearing() |
|
13 |
{ |
|
14 |
base.OnAppearing(); |
|
15 |
if (BindingContext is ChambersViewModel viewModel) |
|
16 |
{ |
|
17 |
viewModel.OnAppearing(); |
|
18 |
} |
|
19 |
} |
|
12 | 20 |
} |
13 | 21 |
} |
GES_PAC/View/Controls/ChamberButtonView.xaml.cs | ||
---|---|---|
35 | 35 |
{ |
36 | 36 |
var vm = new ChamberButtonViewModel(ChamberId, Timer); |
37 | 37 |
BindingContext = vm; |
38 |
vm.UpdateProperties(); |
|
38 | 39 |
} |
39 | 40 |
} |
40 | 41 |
private static void OnChamberIdChanged(BindableObject bindable, object oldValue, object newValue) |
GES_PAC/ViewModel/ChambersViewModel.cs | ||
---|---|---|
1 |
using GES_PAC.Model; |
|
2 |
using GES_PAC.Services; |
|
1 | 3 |
using GES_PAC.View; |
2 | 4 |
using GES_PAC.ViewModel.Controls; |
3 | 5 |
using System.Collections.ObjectModel; |
... | ... | |
11 | 13 |
#endregion |
12 | 14 |
|
13 | 15 |
#region Commandes |
16 |
public Serie? CurrentSet { get; set; } |
|
14 | 17 |
public ICommand TerminateSetCommand { get; } |
15 | 18 |
#endregion |
16 | 19 |
|
17 | 20 |
#region Propriétés |
18 |
public ObservableCollection<ChamberButtonViewModel> Chambers { get; } = new(); |
|
19 | 21 |
public TimerPublisher Timer { get; } |
20 | 22 |
#endregion |
21 | 23 |
|
... | ... | |
24 | 26 |
{ |
25 | 27 |
TerminateSetCommand = new Command(async () => await TerminateSet()); |
26 | 28 |
|
29 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
|
30 |
|
|
27 | 31 |
Timer = new TimerPublisher(); |
28 | 32 |
Timer.Start(); |
29 | 33 |
} |
... | ... | |
37 | 41 |
await Shell.Current.GoToAsync(nameof(EndSetView)); |
38 | 42 |
IsBusy = false; |
39 | 43 |
} |
44 |
|
|
45 |
internal async void OnAppearing() |
|
46 |
{ |
|
47 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
|
48 |
if (CurrentSet == null) |
|
49 |
{ |
|
50 |
IsBusy = true; |
|
51 |
await Shell.Current.GoToAsync(nameof(MainView)); |
|
52 |
IsBusy = false; |
|
53 |
} |
|
54 |
} |
|
40 | 55 |
#endregion |
41 | 56 |
} |
42 | 57 |
} |
GES_PAC/ViewModel/Controls/ChamberButtonViewModel.cs | ||
---|---|---|
20 | 20 |
#endregion |
21 | 21 |
|
22 | 22 |
#region Propriétés |
23 |
public Serie CurrentSet |
|
23 |
public Serie? CurrentSet
|
|
24 | 24 |
{ |
25 | 25 |
get => _currentSet; |
26 | 26 |
set |
... | ... | |
82 | 82 |
OnPropertyChanged(); |
83 | 83 |
} |
84 | 84 |
} |
85 |
public SerieAnimal AnimalSet; |
|
85 |
public SerieAnimal? AnimalSet;
|
|
86 | 86 |
private bool _isSubscribed = false; |
87 | 87 |
|
88 | 88 |
#endregion |
... | ... | |
111 | 111 |
ButtonIsEnabled = true; |
112 | 112 |
ButtonLabel = "0"; |
113 | 113 |
TimeIn = ""; |
114 |
CurrentSet = JourneeViewModel.Instance.GetCurrentSet(); |
|
114 |
CurrentSet = JourneeViewModel.Instance?.GetCurrentSet();
|
|
115 | 115 |
|
116 | 116 |
UpdateChamberId(chamberId); |
117 | 117 |
} |
... | ... | |
126 | 126 |
} |
127 | 127 |
public void UpdateProperties() |
128 | 128 |
{ |
129 |
AnimalSet = CurrentSet.GetSerieAnimalByNumBoite(ChamberId); |
|
129 |
CurrentSet = JourneeViewModel.Instance?.GetCurrentSet(); |
|
130 |
AnimalSet = CurrentSet?.GetSerieAnimalByNumBoite(ChamberId); |
|
130 | 131 |
ButtonText = ChamberId.ToString(); |
131 | 132 |
|
132 | 133 |
int measureCount = AnimalSet?.GetMeasureCount() ?? 0; |
GES_PAC/ViewModel/CreateBehaviourViewModel.cs | ||
---|---|---|
93 | 93 |
var newBehaviour = new Comportement(date, SelectedType, Description); |
94 | 94 |
set.AddBehaviour(newBehaviour, ChamberId, IsAnimalOut); |
95 | 95 |
|
96 |
await Shell.Current.GoToAsync(nameof(ChambersView));
|
|
96 |
await Shell.Current.Navigation.PopToRootAsync();
|
|
97 | 97 |
IsBusy = false; |
98 | 98 |
} |
99 | 99 |
|
GES_PAC/ViewModel/CreateMeasureViewModel.cs | ||
---|---|---|
199 | 199 |
|
200 | 200 |
currentSet.AddMeasure(newMeasure, ChamberId, IsAnimalOut); |
201 | 201 |
|
202 |
await Shell.Current.GoToAsync(nameof(ChambersView));
|
|
202 |
await Shell.Current.Navigation.PopToRootAsync();
|
|
203 | 203 |
|
204 | 204 |
IsBusy = false; |
205 | 205 |
} |
GES_PAC/ViewModel/CreateSetViewModel.cs | ||
---|---|---|
104 | 104 |
var newSet = new Serie(date, DateTimeMAJ, Temperature ?? 0, Humidite ?? 0, Pression ?? 0); |
105 | 105 |
journeeActuelle.AddSet(newSet); |
106 | 106 |
|
107 |
await Shell.Current.GoToAsync(nameof(ChambersView));
|
|
107 |
await Shell.Current.Navigation.PopToRootAsync();
|
|
108 | 108 |
IsBusy = false; |
109 | 109 |
} |
110 | 110 |
|
GES_PAC/ViewModel/JourneeViewModel.cs | ||
---|---|---|
28 | 28 |
{ |
29 | 29 |
return GetCurrentDay().GetCurrentPhase(); |
30 | 30 |
} |
31 |
public Serie GetCurrentSet() |
|
31 |
public Serie? GetCurrentSet()
|
|
32 | 32 |
{ |
33 |
return GetCurrentDay().GetCurrentSet(); |
|
33 |
return GetCurrentDay()?.GetCurrentSet();
|
|
34 | 34 |
} |
35 | 35 |
#endregion |
36 | 36 |
} |
GES_PAC/ViewModel/MainViewModel.cs | ||
---|---|---|
1 | 1 |
using GES_PAC.Model; |
2 |
using GES_PAC.Services; |
|
3 | 2 |
using GES_PAC.View; |
4 | 3 |
using System.Windows.Input; |
5 | 4 |
|
... | ... | |
13 | 12 |
private string _currentDayText; |
14 | 13 |
#endregion |
15 | 14 |
|
16 |
#region Services |
|
17 |
private readonly ConnexionService connService; |
|
18 |
#endregion |
|
15 |
|
|
19 | 16 |
|
20 | 17 |
#region Commandes |
21 | 18 |
public ICommand GoToCreateDayCommand { get; } |
... | ... | |
53 | 50 |
#endregion |
54 | 51 |
|
55 | 52 |
#region Constructeur |
56 |
public MainViewModel(ConnexionService connService)
|
|
53 |
public MainViewModel() |
|
57 | 54 |
{ |
58 | 55 |
//ONLY FOR TESTS |
59 |
var date = DateTime.Now; |
|
60 |
var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], ""); |
|
61 |
newDay.AddSet(new Serie(date, date, 25, 25, 25)); |
|
62 |
newDay.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.Debut); |
|
63 |
newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.Debut); |
|
64 |
newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.Debut); |
|
65 |
newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, "")); |
|
66 |
newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false); |
|
67 |
JourneeViewModel.Instance.Journees.Add(newDay); |
|
56 |
//var date = DateTime.Now;
|
|
57 |
//var newDay = new Journee(date, PersonViewModel.Instance.Persons[0], PlaceViewModel.Instance.Places[0], "");
|
|
58 |
//newDay.AddSet(new Serie(date, date, 25, 25, 25));
|
|
59 |
//newDay.AddCalibration(new MesureCalibration(date, 50, 40, 500, TypeCalibration.Air, ""), PhaseCalibration.Debut);
|
|
60 |
//newDay.AddCalibration(new MesureCalibration(date, 0, 0, 1000000, TypeCalibration.Methane, "dazdazd"), PhaseCalibration.Debut);
|
|
61 |
//newDay.AddCalibration(new MesureCalibration(date, 30, 30, 3000, TypeCalibration.Melange, "deqsfsdf"), PhaseCalibration.Debut);
|
|
62 |
//newDay.GetCurrentSet().AddSerieAnimal(new SerieAnimal(1, 500, date, ""));
|
|
63 |
//newDay.GetCurrentSet().AddMeasure(new Mesure(date, 50, 50, 50), 1, false);
|
|
64 |
//JourneeViewModel.Instance.Journees.Add(newDay);
|
|
68 | 65 |
//ONLY FOR TESTS |
69 | 66 |
|
70 | 67 |
GoToCreateDayCommand = new Command(async () => await GoToCreateDayPage()); |
71 | 68 |
ResumeDayCommand = new Command(async () => await ResumeDay()); |
72 | 69 |
|
73 |
this.connService = connService; |
|
74 |
|
|
75 | 70 |
GetLastDay(); |
76 | 71 |
} |
77 | 72 |
#endregion |
GES_PAC/ViewModel/SetListViewModel.cs | ||
---|---|---|
62 | 62 |
{ |
63 | 63 |
if (IsBusy) return; |
64 | 64 |
IsBusy = true; |
65 |
await Shell.Current.GoToAsync(nameof(ChambersView));
|
|
65 |
await Shell.Current.Navigation.PopToRootAsync();
|
|
66 | 66 |
IsBusy = false; |
67 | 67 |
} |
68 | 68 |
private async Task GoToEndDayPage() |
Formats disponibles : Unified diff