private void Group_Button_Click(object sender, WIN.RoutedEventArgs e) { if (ClashTestListBox.SelectedItems.Count != 0) { //Unsubscribe temporarly UnRegisterChanges(); foreach (object selectedItem in ClashTestListBox.SelectedItems) { CustomClashTest selectedClashTest = (CustomClashTest)selectedItem; ClashTest clashTest = selectedClashTest.ClashTest; if (clashTest.Children.Count != 0) { //Some selection check if (comboBoxGroupBy.SelectedItem == null) { comboBoxGroupBy.SelectedItem = GroupingMode.None; } if (comboBoxThenBy.SelectedItem == null) { comboBoxThenBy.SelectedItem = GroupingMode.None; } if ((GroupingMode)comboBoxThenBy.SelectedItem != GroupingMode.None || (GroupingMode)comboBoxGroupBy.SelectedItem != GroupingMode.None) { if ((GroupingMode)comboBoxThenBy.SelectedItem == GroupingMode.None && (GroupingMode)comboBoxGroupBy.SelectedItem != GroupingMode.None) { GroupingMode mode = (GroupingMode)comboBoxGroupBy.SelectedItem; GroupingFunctions.GroupClashes(clashTest, mode, GroupingMode.None, (bool)keepExistingGroupsCheckBox.IsChecked); } else if ((GroupingMode)comboBoxGroupBy.SelectedItem == GroupingMode.None && (GroupingMode)comboBoxThenBy.SelectedItem != GroupingMode.None) { GroupingMode mode = (GroupingMode)comboBoxThenBy.SelectedItem; GroupingFunctions.GroupClashes(clashTest, mode, GroupingMode.None, (bool)keepExistingGroupsCheckBox.IsChecked); } else { GroupingMode byMode = (GroupingMode)comboBoxGroupBy.SelectedItem; GroupingMode thenByMode = (GroupingMode)comboBoxThenBy.SelectedItem; GroupingFunctions.GroupClashes(clashTest, byMode, thenByMode, (bool)keepExistingGroupsCheckBox.IsChecked); } } } } //Resubscribe RegisterChanges(); } }
private void Ungroup_Button_Click(object sender, WIN.RoutedEventArgs e) { if (ClashTestListBox.SelectedItems.Count != 0) { //Unsubscribe temporarly UnRegisterChanges(); foreach (object selectedItem in ClashTestListBox.SelectedItems) { CustomClashTest selectedClashTest = (CustomClashTest)selectedItem; ClashTest clashTest = selectedClashTest.ClashTest; if (clashTest.Children.Count != 0) { GroupingFunctions.UnGroupClashes(clashTest); } } //Resubscribe RegisterChanges(); } }
private void Group_Button_Click(object sender, WIN.RoutedEventArgs e) { if (ClashTestListBox.SelectedItem != null) { CustomClashTest selectedClashTest = (CustomClashTest)ClashTestListBox.SelectedItem; ClashTest clashTest = selectedClashTest.ClashTest; if (comboBoxGroupBy.SelectedItem != null) { if (comboBoxThenBy.SelectedItem == null) { GroupingMode mode = (GroupingMode)((EnumerationExtension.EnumerationMember)comboBoxGroupBy.SelectedItem).Value; GroupingFunctions.GroupClashes(clashTest, mode, GroupingMode.None); } else { GroupingMode byMode = (GroupingMode)((EnumerationExtension.EnumerationMember)comboBoxGroupBy.SelectedItem).Value; GroupingMode thenByMode = (GroupingMode)((EnumerationExtension.EnumerationMember)comboBoxThenBy.SelectedItem).Value; GroupingFunctions.GroupClashes(clashTest, thenByMode, byMode); } } } }