예제 #1
0
        public void ConfigureRule(IExecutable rule)
        {
            if (this.XMLConfig.RuleConfigurations == null)
            {
                return;
            }

            var ruleName   = rule.IsSQLRule() ? rule.Name : rule.GetType().ToString();
            var ruleConfig = this.XMLConfig.RuleConfigurations.Where(r => r.Name == ruleName).FirstOrDefault();

            if (ruleConfig == null) //No rule configuration in config file for the specified rule
            {
                return;
            }

            foreach (IProperty property in rule.GetProperties())
            {
                //Find matching property from config file
                RuleProperty ruleProperty = ruleConfig.Properties.Where(p => p.Name == property.Name).FirstOrDefault();
                if (ruleProperty != null)
                {
                    if (property.isValidPropertyValue(ruleProperty.Value))
                    {
                        property.SetValue(ruleProperty.Value);
                    }
                }
            }
        }
예제 #2
0
        public RuleConfiguration(IExecutable rule, bool runRule)
        {
            this.Name    = rule.IsSQLRule() ? rule.Name : rule.GetType().ToString();
            this.RunRule = runRule;

            //Add properties
            this.Properties = new List <RuleProperty>();
            foreach (IProperty property in rule.GetProperties())
            {
                this.Properties.Add(new RuleProperty(property));
            }
        }
예제 #3
0
        public ConfigureRule(IExecutable executable)
        {
            InitializeComponent();
            this.executable = executable;
            this.Title      = string.Format("Configure '{0}'", executable.Name);
            ValueColumn.CellTemplateSelector = new TemplateSelector(this);
            this._properties = (from p in executable.GetProperties()
                                select new Property(p)).ToList();
            this.DataContext = this._properties;

            ThreadStart setColWidth = () => OptionColumn.Width = OptionColumn.ActualWidth;

            Dispatcher.BeginInvoke(setColWidth);
        }