//makes a new booking private void btnNew_Click(object sender, RoutedEventArgs e) { //points to the fact that we're making a new booking, and not editing one instance.CurrentBooking = 0; //opens the booking window, then closes this one WindowBooking booking = new WindowBooking(); booking.Show(); this.Close(); }
//opens the booking window for editing a booking, when a booking is double clicked private void dgridBookings_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (dgridBookings.SelectedIndex != -1) { //gets the booking to be edited var currBooking = dgridBookings.SelectedItem as Booking; //stores it's refference number for easy finding in the booking window instance.CurrentBooking = currBooking.BookingRefference; WindowBooking booking = new WindowBooking(); booking.Show(); this.Close(); } }