public MainWindow() { InitializeComponent(); radioButtons = new Dictionary <RadioButton, string>() { { economyRadio, "Economy" }, { businessRadio, "Business" }, { firstRadio, "First" } }; newReservation = new Reservation(); scheduleRows = ConnectionObject.LoadScheduleRows(); //never used??? AirportRows = ConnectionObject.LoadAirports(); // subscribe to changes to the reservation object newReservation.changeChecker.changeMadeEvent += disableBookingButton; // //newReservation.changeChecker.changeMadeEvent += new ChangeChecker.changeMade(delegate () //{ // // createBooking.IsEnabled = newReservation.isValid(); //}); // get flights with distinct departures this.departuresBox.ItemsSource = scheduleRows.Distinct(new compareDepartures()); this.departuresBox.DisplayMemberPath = "DepartingName"; }
public FlightsPage() { InitializeComponent(); this.dateControl.SelectedDate = DateTime.Now.Date; airports = ConnectionObject.LoadAirports(); //airportDictionary = new Dictionary<string, string>(); //foreach (Airport airport in airports) //{ // airportDictionary.Add( airport.AirportCode, airport.Description); //} selectedItem = new ScheduleRow(); scheduleRows = ConnectionObject.LoadScheduleRows(); editMode = false; //rows = from flight in scheduleRows // select flight; arrivalRows = scheduleRows.Distinct(new compareArrivals()); departureRows = scheduleRows.Distinct(new compareDepartures()); listViewRows = from flight in scheduleRows select flight; this.ArrivingBox.ItemsSource = airports; this.ArrivingBox.DisplayMemberPath = "Description"; //this.DepartingBox.ItemsSource = departureRows; //this.DepartingBox.DisplayMemberPath = "Departing"; this.DepartingBox.ItemsSource = airports; this.DepartingBox.DisplayMemberPath = "Description"; GridView flightsGrid = new GridView(); flightsGrid.AllowsColumnReorder = true; flightsGrid.ColumnHeaderToolTip = "flight Data2"; GridViewColumn departuresColumn = new GridViewColumn(); departuresColumn.DisplayMemberBinding = new Binding("DepartingName"); departuresColumn.Header = "Departing"; departuresColumn.Width = 100; flightsGrid.Columns.Add(departuresColumn); GridViewColumn arrivalsColumn = new GridViewColumn(); arrivalsColumn.Header = "Arriving"; arrivalsColumn.Width = 100; arrivalsColumn.DisplayMemberBinding = new Binding("ArrivingName"); flightsGrid.Columns.Add(arrivalsColumn); GridViewColumn timeColumn = new GridViewColumn(); timeColumn.Header = "Time"; //timeColumn.Width = 100; timeColumn.DisplayMemberBinding = new Binding("Time"); flightsGrid.Columns.Add(timeColumn); this.FlightsList.View = flightsGrid; this.FlightsList.ItemsSource = scheduleRows; }
private void Update_Click(object sender, RoutedEventArgs e) { ConnectionObject.UpdateFlight(this.selectedItem); scheduleRows = ConnectionObject.LoadScheduleRows(); selectedItem = new ScheduleRow(); editMode = false; somethingChanged(); }
private void Delete_Click(object sender, RoutedEventArgs e) { ConnectionObject.RemoveFlight(selectedItem); scheduleRows = ConnectionObject.LoadScheduleRows(); selectedItem = new ScheduleRow(); editMode = false; FlightsList.SelectedItem = null; somethingChanged(); }