/// <summary> /// The ButtonModify_Click method. /// </summary> /// <param name="sender">The <paramref name="sender"/> parameter.</param> /// <param name="args">The <paramref name="args"/> parameter.</param> private void ButtonModify_Click(object sender, EventArgs args) { if (lvTimeTableManager.SelectedItems.Count == 0) { return; } var timeTable = (TimeTable)lvTimeTableManager.SelectedItems[0].Tag; // Show the ModifyTimeTableForm dialog. DialogResult result; using (var modifyTimeTableForm = new ModifyTimeTableForm(timeTable)) { result = modifyTimeTableForm.ShowDialog(); } // If the dialog was closed without clicking OK then skip the refresh. if (result != DialogResult.OK) { return; } // Refresh the items in the list view. PopulateTimeTables(); }
/// <summary> /// The ButtonAdd_Click method. /// </summary> /// <param name="sender">The <paramref name="sender"/> parameter.</param> /// <param name="args">The <paramref name="args"/> parameter.</param> private void ButtonAdd_Click(object sender, EventArgs args) { // Show the ModifyTimeTableForm dialog. DialogResult result; using (var modifyTimeTableForm = new ModifyTimeTableForm(new NewTimeTable())) { result = modifyTimeTableForm.ShowDialog(); } // If the dialog was closed without clicking OK then skip the refresh. if (result != DialogResult.OK) { return; } // Refresh the items in the list view. PopulateTimeTables(); }