/// <summary> /// Method deletes an appointment and updates appointment's list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuAppointmentDelete_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Czy napewno chcesz usunąć wybrany termin?", "Potwierdzenie", MessageBoxButton.YesNo, MessageBoxImage.Information); if (result == MessageBoxResult.Yes) { AppointmentModel app = (AppointmentModel)MyDataGridPlan.SelectedItem; AppointmentList.Remove(app); MyDataGridPlan.Items.Refresh(); app.Delete(); if (mainWindow.MyCalendarPV.SelectedDate != null && mainWindow.MyCalendarPV.SelectedDate.Value == MyCalendar.SelectedDate.Value) { AppointmentModel appMW = mainWindow.AppointmentList.Find(a => a.ID == app.ID); mainWindow.AppointmentList.Remove(appMW); mainWindow.MyDataGridApp.Items.Refresh(); } } }