private void editReminderButton_Click(object sender, EventArgs e) { if (IsRemindsNotNull()) { if (IsCurentRowNotNull(reminderDataGridView.CurrentRow)) { var indexToEdit = reminderDataGridView.CurrentRow.Index; if (indexToEdit < remindersList.Count) { var listElementToEdit = FindIndexInArray(indexToEdit); var remindToEdit = remindersList.ElementAt(listElementToEdit); Form form = new CreateReminderForm(remindToEdit); form.ShowDialog(); if (CreateReminderForm.SaveButtonClicked) { remindersList.RemoveAt(listElementToEdit); reminderDataGridView.Rows.RemoveAt(indexToEdit); remindersList.Insert(listElementToEdit, CreateReminderForm.Remind); repository.Save(remindersList); UpdateGrid(); } } else { MessageBox.Show("Пожалуйста, выберите строку корректно"); } } } }
private void createReminderButton_Click(object sender, EventArgs e) { Form form = new CreateReminderForm(new Remind()); form.ShowDialog(); UpdateGrid(); }