예제 #1
0
 private void lvRules_DoubleClick(object sender, System.EventArgs e)
 {
     if (this.lvRules.SelectedItems.Count != 0)
     {
         // Create new rule
         if (this.lvRules.SelectedIndices[0] == 0)
         {
             RuleEditor re = new RuleEditor(this.pndSelectedDocument);
             if (DialogResult.OK == re.ShowDialog())
             {
                 if (re.CreatedRule != null)
                 {
                     this.pndSelectedDocument.Rules.Add(re.CreatedRule);
                     this.PopulateRules();
                 }
             }
         }
         else
         {
             // Edit existing rule
             Rule       r  = (Rule)this.lvRules.SelectedItems[0].Tag;
             RuleEditor re = new RuleEditor(this.pndSelectedDocument, r.Expression, r.Description);
             if (DialogResult.OK == re.ShowDialog())
             {
                 if (re.CreatedRule != null)
                 {
                     this.pndSelectedDocument.Rules[this.pndSelectedDocument.Rules.IndexOf(r)] = re.CreatedRule;
                     this.PopulateRules();
                 }
             }
         }
     }
 }
예제 #2
0
        private void miInsert_Click(object sender, System.EventArgs e)
        {
            RuleEditor re = new RuleEditor(this.pndSelectedDocument);

            if (DialogResult.OK == re.ShowDialog())
            {
                if (re.CreatedRule != null)
                {
                    this.pndSelectedDocument.Rules.Insert(this.lvRules.SelectedIndices[0] - 1, re.CreatedRule);
                    this.PopulateRules();
                }
            }
        }