private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataGrid.SelectedItem == null) return; var wagon = dataGrid.SelectedItem as Wagon; if (wagon == null) return; var wagonView = new WagonView(_user, wagon, datePicker.SelectedDate); wagonView.Closed += OnOtherWindowClosed; wagonView.Show(); }
private void changeButton_Click(object sender, RoutedEventArgs e) { var seat = dataGrid.SelectedItem as BookedSeatPair?; if (seat == null) { return; } var seatValue = seat.Value.Seat; var date = seat.Value.Date; seat.Value.Seat.RevokeBooking(_user, seat.Value.Date); UpdateTable(); var wagonView = new WagonView(_user, seatValue.Wagon, new DateTime(date.Year, date.Month, date.Day)); wagonView.Show(); }