private void SelectTicket(object sender, SelectionChangedEventArgs e) { if (ticketList.SelectedItem is TictetCar tictetCar) { ShowTicket ticket = new ShowTicket(tictetCar.Ticket); if (ticket.ShowDialog().Value) { context = new taxiEntities(); ShowResult(); } } }
private void Show(object sender, SelectionChangedEventArgs e) { try { if (ticketList.SelectedItem is ticket ticket1) { ShowTicket ticket = new ShowTicket(ticket1); if (ticket.ShowDialog().Value) { context = new taxiEntities(); ticketList.ItemsSource = context.ticket.ToList(); } } } catch (Exception ex) { MsgBox.Error(ex.Message); } }