/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(Aankomsthal aankomsthal) { NieuweVluchtCommand = new RelayCommand(AddNieuweVlucht); WachtendeVluchten = new ObservableCollection <VluchtViewModel>(); NieuweVluchtAantalKoffers = 5; _aankomsthal = aankomsthal; _aankomsthal.WachtendeVluchten.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { WachtendeVluchten.Add(new VluchtViewModel(e.NewItems[0] as Vlucht)); } else if (e.Action == NotifyCollectionChangedAction.Remove) { WachtendeVluchten.RemoveAt(e.OldStartingIndex); } }; Band1 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[0]); Band2 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[1]); Band3 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[2]); InitializeDefaultVluchten(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(Aankomsthal aankomsthal) { NieuweVluchtCommand = new RelayCommand(AddNieuweVlucht); WachtendeVluchten = new ObservableCollection <VluchtViewModel>(); NieuweVluchtAantalKoffers = 5; _aankomsthal = aankomsthal; _aankomsthal.WachtendeVluchten.CollectionChanged += CollectionChanged; Band1 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[0]); Band2 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[1]); Band3 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[2]); InitializeDefaultVluchten(); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(Aankomsthal aankomsthal) { NieuweVluchtCommand = new RelayCommand(AddNieuweVlucht); AssignVluchtenCommand = new RelayCommand(AssignVluchten); VerversBaggagebandenCommand = new RelayCommand(VerversBaggagebanden); WachtendeVluchten = new ObservableCollection <VluchtViewModel>(); NieuweVluchtAantalKoffers = 5; _aankomsthal = aankomsthal; // TODO: Hier kijken naar _aankomsthal.WachtendeVluchten.CollectionChanged en verversWachtendeVluchten weghalen. Band1 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[0]); Band2 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[1]); Band3 = new BaggagebandViewModel(_aankomsthal.Baggagebanden[2]); InitializeDefaultVluchten(); VerversWachtendeVluchten(); }