Ejemplo n.º 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     SelectionRule rule = new SelectionRule();
     if (DialogResult.OK == EditRule(rule))
     {
         AddNewRule(rule);
     }
 }
Ejemplo n.º 2
0
        public void LoadRule(SelectionRule rule)
        {
            ecbRuleType.SelectedItem = rule.Type;
            txtRule.Text = rule.RuleText;

            for (int i = 0, c = cmbBrowser.Items.Count; i < c; ++i)
            {
                if (((BrowserInfo)cmbBrowser.Items[i]).Name == rule.TargetBrowserId)
                {
                    cmbBrowser.SelectedIndex = i;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private void AddNewRule(SelectionRule rule)
        {
            System.Diagnostics.Debug.Assert(listView1.Items.Count == AppConfig.SelectionRules.Count);

            // Store the new rule
            AppConfig.UnsavedChanges = true;
            AppConfig.SelectionRules.Add(rule);

            // Display the new rule
            RuleListViewItem lvi = new RuleListViewItem(rule);
            listView1.Items.Add(lvi);

            System.Diagnostics.Debug.Assert(listView1.Items.Count == AppConfig.SelectionRules.Count);
        }
Ejemplo n.º 4
0
 internal void UpdateRule(SelectionRule rule)
 {
     rule.TargetBrowserId = ((BrowserInfo)cmbBrowser.SelectedItem).Name;
     rule.Type = ecbRuleType.SelectedItem;
     rule.RuleText = txtRule.Text;
 }
Ejemplo n.º 5
0
        private DialogResult EditRule(SelectionRule rule)
        {
            RuleEditor editor = new RuleEditor(Browsers);
            editor.LoadRule(rule);
            DialogResult answer = editor.ShowDialog(this);
            if (DialogResult.OK == answer)
            {
                AppConfig.UnsavedChanges = true;
                editor.UpdateRule(rule);
            }

            return answer;
        }
Ejemplo n.º 6
0
        public RuleListViewItem(SelectionRule rule)
        {
            Rule = rule;

            Update();
        }