コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
            }
        }