using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using ProjetTheAlone.Classes; using System.Collections.ObjectModel; namespace ProjetTheAlone.ViewModel { public class RepaModel : INotifyPropertyChanged { private string quand; private ObservableCollection listPlat = new ObservableCollection(); public ObservableCollection ListPlat { get => listPlat; set { listPlat = value; OnPropertyChanged("ListPlat"); OnPropertyChanged("Plat1"); OnPropertyChanged("Plat2"); OnPropertyChanged("Plat3"); } } private C_T_plat plat1, plat2, plat3; public C_T_plat Plat1 { get => plat1; set { plat1 = value; OnPropertyChanged("Plat1"); } } public C_T_plat Plat2 { get => plat2; set { plat2 = value; OnPropertyChanged("Plat2"); } } public C_T_plat Plat3 { get => plat3; set { plat3 = value; OnPropertyChanged("Plat3"); } } public string Quand { get => quand; set { quand = value; OnPropertyChanged("Quand"); } } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } public RepaModel() { } public RepaModel(DateTime d) { ListPlat = new ObservableCollection(new Gestion.G_T_repa(Config.Settings1.Default.schCon).Lire(d) as List); Plat1 = (ListPlat.Count > 0) ? ListPlat[0] : new C_T_plat(); Plat2 = (ListPlat.Count > 1) ? ListPlat[1] : new C_T_plat(); Plat3 = (ListPlat.Count > 2) ? ListPlat[2] : new C_T_plat(); Quand = d.ToShortDateString(); } public RepaModel(ObservableCollection ListPlat, string quand) { this.ListPlat = ListPlat; this.Quand = quand; } } }