Example #1
0
 void ResetParent()
 {
     if (RuleLibrary.GetRuleByName(selectedRule.parentRule) == null)
     {
         parentRule.SelectedItem = noParent;
     }
     else
     {
         parentRule.SelectedItem = selectedRule.parentRule;
     }
 }
Example #2
0
 private void ParentRule_SelectedIndexChanged(object s, EventArgs e)
 {
     if (selectedRule != null)
     {
         Rule checkedRule = RuleLibrary.GetRuleByName(parentRule.Text);
         while (checkedRule != null)
         {
             checkedRule = RuleLibrary.GetRuleByName(checkedRule.parentRule);
             if (checkedRule == selectedRule)
             {
                 MessageBox.Show("Loops are not allowed in the parent rule chain.");
                 ResetParent();
                 return;
             }
         }
         selectedRule.parentRule = !parentRule.Text.Equals(noParent) ? parentRule.Text : null;
     }
 }