//edit the chosen booking private void btn_editbooking_Click(object sender, RoutedEventArgs e) { dynamic selected = lv_bookings.SelectedItem; //if no booking chosen then display error message if (selected == null) { MessageBox.Show("You haven't selected a booking to edit."); return; } int bref = 0; bref = selected.BookingRef; Booking booking = bookingslist.Find(x => x.BookingRef == bref); var newWindow = new BookingWindow(this, booking, customerlist); newWindow.ShowDialog(); }
//When the add booking button is pressed open an add booking window and pass through the mainwindow and the customerlist private void btn_addbooking_Click(object sender, RoutedEventArgs e) { var newWindow = new BookingWindow(this, customerlist); newWindow.ShowDialog(); }