private void ButtonMakeAppointment_Click(object sender, RoutedEventArgs e) { try { var dlg = new AppointmentDialogView(ViewModel.VetClinic.Schedule, ViewModel.VetClinic.Patients) { Owner = this }; dlg.ShowDialog(); if (dlg.DialogResult == true) { ViewModel.AddAppointment(dlg.ViewModel.Appointment); } } catch (Exception) { MessageBox.Show("Unexpected error occurred during making appointment"); } }
private void BtnEditAppointment_Click(object sender, RoutedEventArgs e) { try { var button = sender as Button; var appointment = button.DataContext as Appointment; var dlg = new AppointmentDialogView(ViewModel.VetClinic.Schedule, ViewModel.VetClinic.Patients, appointment) { Owner = this }; dlg.ShowDialog(); if (dlg.DialogResult == true) { ViewModel.EditAppointment(dlg.ViewModel.Appointment); } } catch (Exception) { MessageBox.Show("Unexpected error occurred during editing appointment"); } }