private void addFilter_button_Click(object sender, EventArgs e) { var popup = new FilterPopup(); popup.SetStartPosition(); if (popup.ShowDialog() == DialogResult.OK) { Filter result = popup.Result; filter_listbox.Items.Add(result); } }
private void editFilter_button_Click(object sender, EventArgs e) { if (filter_listbox.SelectedIndex == -1) { return; } int i = filter_listbox.SelectedIndex; var filterToEdit = (Filter)filter_listbox.SelectedItem; var popup = new FilterPopup(filterToEdit); popup.SetStartPosition(); if (popup.ShowDialog() == DialogResult.OK) { Filter result = popup.Result; filter_listbox.Items.RemoveAt(i); filter_listbox.Items.Insert(i, result); } }