private void AddRuleBtn_Click(object sender, EventArgs e) { ExcludeRule rule = null; if (SampleRulesCB.SelectedIndex >= 0) { switch ((RuleAppliesTo)ApplyToCB.SelectedIndex) { case RuleAppliesTo.Files: rule = CommonRules.RulesFiles[SampleRulesCB.SelectedIndex]; break; case RuleAppliesTo.FolderAndSubfolders: rule = CommonRules.RulesFoldersAndSubs[SampleRulesCB.SelectedIndex]; break; case RuleAppliesTo.ParentFolderOnly: rule = CommonRules.RulesParentFolder[SampleRulesCB.SelectedIndex]; break; } if (rule != null) { RuleTB.Text += Environment.NewLine + @"// " + rule.Desc + Environment.NewLine + rule.RuleCode; if (DescTB.Text == string.Empty) { DescTB.Text = rule.Desc; } } } }
public RuleEditFrm(ExcludeRule init, bool addMode) { InitializeComponent(); this.Text = addMode ? "Add Exclusion Rule" : "Edit Exclusion Rule"; Result = init ?? new ExcludeRule(); RuleTB.Text = Result.RuleCode; DescTB.Text = Result.Desc; DiagTB.Text = string.Empty; //SampleRulesCB.DataSource = CommonRules.AllRules.Select(r => r.Desc).ToArray(); ApplyToCB.DataSource = Enum.GetNames(typeof(RuleAppliesTo)); ApplyToCB.SelectedIndex = (int)Result.AppliesTo; SampleRulesCB.SelectedIndex = -1; }
public CompiledExclusionRule(ExcludeRule rule) : this(rule.AppliesTo, rule.RuleCode) { }