Example #1
0
        private void EditCriteria()
        {
            var index = listBoxCriteria.SelectedIndex;

            if (index == -1)
            {
                return;
            }

            var criteria    = (Solver.Criteria)listBoxCriteria.SelectedItem;
            var formDetails = new FormCriteriaDetails();

            criteria = formDetails.ShowDialog(criteria);
            if (criteria == null)
            {
                return;
            }

            _solver.Comparer.Criteria[index] = criteria;

            listBoxCriteria.Items.RemoveAt(index);
            listBoxCriteria.Items.Insert(index, criteria);
            listBoxCriteria.SelectedIndex = index;

            comboBoxPresets.SelectedIndex = -1;
        }
Example #2
0
        private void AddCriteria()
        {
            var formDetails = new FormCriteriaDetails();
            var criteria    = formDetails.ShowDialog(null);

            if (criteria == null)
            {
                return;
            }
            var index = listBoxCriteria.SelectedIndex;

            if (index == -1)
            {
                index = listBoxCriteria.Items.Count;
            }
            listBoxCriteria.Items.Insert(index, criteria);

            comboBoxPresets.SelectedIndex = -1;
        }