root / GES_PAC / ViewModel / JourneeViewModel.cs @ 1019554c
Historique | Voir | Annoter | Télécharger (1,14 ko)
1 |
using GES_PAC.Model; |
---|---|
2 |
using System.Collections.ObjectModel; |
3 |
|
4 |
namespace GES_PAC.ViewModel |
5 |
{ |
6 |
public class JourneeViewModel |
7 |
{ |
8 |
#region Attributs |
9 |
private static JourneeViewModel _instance; |
10 |
#endregion |
11 |
|
12 |
#region Propriétés |
13 |
public ObservableCollection<Journee> Journees { get; set; } = new(); |
14 |
public static JourneeViewModel Instance => _instance ??= new JourneeViewModel(); |
15 |
#endregion |
16 |
|
17 |
#region Constructeurs |
18 |
private JourneeViewModel() { } |
19 |
#endregion |
20 |
|
21 |
#region Méthodes |
22 |
public Journee GetCurrentDay() |
23 |
{ |
24 |
DateTime today = DateTime.Today; |
25 |
return Journees.FirstOrDefault(j => j.Date.Date == today); |
26 |
} |
27 |
public PhaseCalibration GetCurrentPhase() |
28 |
{ |
29 |
return GetCurrentDay().GetCurrentPhase(); |
30 |
} |
31 |
public Serie GetCurrentSet() |
32 |
{ |
33 |
return GetCurrentDay().GetCurrentSet(); |
34 |
} |
35 |
|
36 |
public void AddMeasureToCurrentSet(Mesure newMeasure, int numBoite) |
37 |
{ |
38 |
GetCurrentDay().GetCurrentSet().AddMeasure(newMeasure, numBoite); |
39 |
} |
40 |
#endregion |
41 |
} |
42 |
} |