/// <summary> /// Create a new rule. /// </summary> private void settingsNewRule_Click(object sender, EventArgs e) { RuleGroup newRuleGroup = new RuleGroup { title = "", active = true, type = RuleGroupType.Any, actionCode = RuleActionCodes.Unread | RuleActionCodes.Clear, rule = new[] { new Rule { property = "Subject", value = string.Empty, op = PredicateBuilder.Op.Equals } } }; RuleEditor ruleEditor = new RuleEditor(newRuleGroup); if (ruleEditor.ShowDialog() == DialogResult.OK) { CIX.RuleCollection.AddRule(newRuleGroup); _arrayOfRules = CIX.RuleCollection.AllRules; ReloadRules(0); } }
/// <summary> /// Invoke the rule editor to edit the selected item and save it back /// if the user OK's the editor dialog. /// </summary> private void EditRule() { int index = settingsRulesList.SelectedIndex; if (index >= 0) { RuleEditor ruleEditor = new RuleEditor(_arrayOfRules[index]); if (ruleEditor.ShowDialog() == DialogResult.OK) { CIX.RuleCollection.Save(); } } }