/// <summary> /// Invokes if the button for adding the selected option to the alternative groups /// was pressed. /// /// This will add the selected option to the alternative groups of the current /// variability model by adding a new constraint and modifying the excluded options. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">EventArgs</param> private void selectedOptionAddButton_Click(object sender, EventArgs e) { ConfigurationOption selectedOption = (ConfigurationOption)selectedOptionComboBox.SelectedItem; List <ConfigurationOption> opts = GlobalState.varModel.getOptions() .Where(option => option.Parent != null && option.Parent.Equals(selectedOption)).ToList(); foreach (ConfigurationOption thisOpt in opts) { foreach (ConfigurationOption otherOpt in opts) { if (!thisOpt.Equals(otherOpt)) { List <ConfigurationOption> newContstraint = new List <ConfigurationOption>() { otherOpt }; if (!ConfigurationOption.hasConstraint(thisOpt.Excluded_Options, newContstraint)) { thisOpt.Excluded_Options.Add(new List <ConfigurationOption>() { otherOpt }); } } } } currAltGroups.Add(selectedOption); currAltGroupsListBox.Items.Add(selectedOption); selectedOptionAddButton.Enabled = false; }
/// <summary> /// Invokes if the button for adding the selected option to the alternative groups /// was pressed. /// /// This will add the selected option to the alternative groups of the current /// variability model by adding a new constraint and modifying the excluded options. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">EventArgs</param> private void selectedOptionAddButton_Click(object sender, EventArgs e) { ConfigurationOption selectedOption = (ConfigurationOption)selectedOptionComboBox.SelectedItem; List <ConfigurationOption> opts = selectedOption.Children; List <ConfigurationOption> temp = new List <ConfigurationOption>(); foreach (ConfigurationOption opt in opts) { if (opt is BinaryOption) { temp.Add(opt); } } foreach (ConfigurationOption thisOpt in opts) { foreach (ConfigurationOption otherOpt in opts) { if (!thisOpt.Equals(otherOpt)) { List <ConfigurationOption> newContstraint = new List <ConfigurationOption>() { otherOpt }; if (!ConfigurationOption.hasConstraint(thisOpt.Excluded_Options, newContstraint)) { thisOpt.Excluded_Options.Add(new List <ConfigurationOption>() { otherOpt }); } } } } currAltGroups.Add(selectedOption); currAltGroupsListBox.Items.Add(selectedOption); selectedOptionAddButton.Enabled = false; }