private void EditFilter() { var index = listBoxFilters.SelectedIndex; if (index == -1) { return; } var filter = (Solver.Filter)listBoxFilters.SelectedItem; var formDetails = new FormFilterDetails(); filter = formDetails.ShowDialog(filter); if (filter == null) { return; } _solver.Filters[index] = filter; listBoxFilters.Items.RemoveAt(index); listBoxFilters.Items.Insert(index, filter); listBoxFilters.SelectedIndex = index; // not preset anymore comboBoxPresets.SelectedIndex = -1; }
private void AddFilter() { FormFilterDetails formDetails = new FormFilterDetails(); Solver.Filter filter = formDetails.ShowDialog(null); if (filter == null) { return; } /*int index = listBoxFilters.SelectedIndex; * if (index == -1) * index = listBoxFilters.Items.Count; * listBoxFilters.Items.Insert(index, filter);*/ listBoxFilters.Items.Add(filter); listBoxFilters.SelectedIndex = listBoxFilters.Items.Count - 1; // not preset anymore comboBoxPresets.SelectedIndex = -1; }