/// <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); WachtendeVluchten = new ObservableCollection <VluchtViewModel>(); NieuweVluchtAantalKoffers = 5; _aankomsthal = aankomsthal; // TODO: Hier kijken naar _aankomsthal.WachtendeVluchten.CollectionChanged en verversWachtendeVluchten weghalen. _aankomsthal.WachtendeVluchten.CollectionChanged += new NotifyCollectionChangedEventHandler(VerversWachtendeVluchten); Band1 = new BagagebandViewModel(_aankomsthal.Bagagebanden[0]); Band2 = new BagagebandViewModel(_aankomsthal.Bagagebanden[1]); Band3 = new BagagebandViewModel(_aankomsthal.Bagagebanden[2]); InitializeDefaultVluchten(); }