Esempio n. 1
0
        private void DeleteRuleControl(SmartRuleControl rule)
        {
            int index = rule.Index;

            _rulePanel.Controls.Remove(rule);
            foreach (SmartRuleControl control in _rulePanel.Controls)
            {
                if (control.Index > index)
                {
                    control.Index--;
                }
            }
            LayoutRuleControls();
        }
Esempio n. 2
0
        private void InsertRuleControl(SmartRuleControl afterRule)
        {
            int num = afterRule.Index + 1;

            foreach (SmartRuleControl control in _rulePanel.Controls)
            {
                if (control.Index >= num)
                {
                    control.Index++;
                }
            }
            SmartRuleControl value = CreateRuleControl(null, num);

            _rulePanel.Controls.Add(value);
            LayoutRuleControls();
        }
Esempio n. 3
0
        private SmartRuleControl CreateRuleControl(Rule rule, int index)
        {
            SmartRuleControl newRule = new SmartRuleControl(rule, ref _nextRuleTabIndex)
            {
                Index = index
            };

            newRule.AddButton.Click += delegate
            {
                InsertRuleControl(newRule);
            };
            newRule.DeleteButton.Click += delegate
            {
                DeleteRuleControl(newRule);
            };
            return(newRule);
        }
Esempio n. 4
0
        private void AddRuleControl(Rule rule)
        {
            SmartRuleControl value = CreateRuleControl(rule, _rulePanel.Controls.Count);

            _rulePanel.Controls.Add(value);
        }