root / GES_PAC / ViewModel / JourneeViewModel.cs @ 9601eaf0
Historique | Voir | Annoter | Télécharger (993 octets)
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.LastOrDefault(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 |
#endregion |
36 |
} |
37 |
} |