/// <summary> /// Handles the Edit_ click event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> private void Edit_Click(object sender, EventArgs e) { var selectedIndex = this.Types.SelectedIndex; if (selectedIndex < 0) { return; } var rule = this.Types.Items[selectedIndex] as Rule; var page = new ValueAnalysisDetailsPage(); page.Display(rule); if (page.ShowDialog() != DialogResult.OK) { return; } this.Types.Items[selectedIndex] = rule; }
/// <summary> /// Handles the Button1_ click event. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> private void Add_Click(object sender, EventArgs e) { var page = new ValueAnalysisDetailsPage(); var rule = new Rule(); page.Display(rule); if (page.ShowDialog() != DialogResult.OK) { return; } var index = this.Types.Items.Add(rule); this.Types.SetSelected(index, true); }