Esempio n. 1
0
        public RuleFile GetRule()
        {
            if (rule == null)
                rule = new RuleFileExtension();

            rule.ExtensionPattern = txtExtension.Text;

            return rule;
        }
Esempio n. 2
0
        public static RuleFile GetFileRule(RuleFile.TypeFileRule type)
        {
            RuleFile res = null;

            switch(type)
            {
                case RuleFile.TypeFileRule.Date:
                    res = new RuleFileDate();
                    break;
                case RuleFile.TypeFileRule.Extension:
                    res = new RuleFileExtension();
                    break;
                case RuleFile.TypeFileRule.FileName:
                    res = new RuleFileName();
                    break;
            }

            if(res != null)
            {
                res.RuleType = (int) type;
            }

            return res;
        }
Esempio n. 3
0
        private void SaveRule()
        {
            Boolean typeChoose = false;
            RuleFile ruleAux = null;

            if (rbtDate.IsChecked.HasValue && rbtDate.IsChecked.Value)
            {
                ruleAux = new RuleFileDate();
                ruleAux.RuleType = (int)RuleFile.TypeFileRule.Date;
                ruleAux.ImagePath = @"/images/icon_ruleFileDate.png";

                typeChoose = true;
            }
            else if (rbtExtension.IsChecked.HasValue && rbtExtension.IsChecked.Value)
            {
                ruleAux = new RuleFileExtension();
                ruleAux.RuleType = (int)RuleFile.TypeFileRule.Extension;
                ruleAux.ImagePath = @"/images/icon_ruleFileExtension.png";

                typeChoose = true;
            }
            else if (rbtName.IsChecked.HasValue && rbtName.IsChecked.Value)
            {
                ruleAux = new RuleFileName();
                ruleAux.RuleType = (int)RuleFile.TypeFileRule.FileName;
                ruleAux.ImagePath = @"/images/icon_ruleFileName.png";

                typeChoose = true;
            }

            if (!typeChoose)
            {
                MessageBox.Show("Necesita especificar el tipo de la regla");
                return;
            }

            RuleControl rControl = (RuleControl) pnlExtensionControl.Children[0];
            rule = rControl.GetRule();

            rule.RuleType = ruleAux.RuleType;
            rule.ImagePath = ruleAux.ImagePath;
            rule.Name = txtName.Text;

            this.Close();
        }
Esempio n. 4
0
        public void SetRule(RuleFile rule)
        {
            this.rule = (RuleFileExtension)rule;

            txtExtension.Text = this.rule.ExtensionPattern;
        }