コード例 #1
0
        internal ValidationBuilder(Control control)
        {
            var form = control.TopLevelControl;

            if (!(form is Form))
            {
                throw new InvalidOperationException("Control must be on form");
            }

            this.control  = control;
            formValidator = FormValidator.GetValidator((Form)form);
            validationSet = formValidator.GetValidationSet(control);
            if (validationSet == null)
            {
                validationSet = new ValidationSet(formValidator, control);
                formValidator.AddValidationSet(validationSet);
            }
        }
コード例 #2
0
        public void Dispose()
        {
            CheckThread();

            // dispose timer
            if (timer != null)
            {
                timer.Enabled = false;
                timer.Dispose();
                timer = null;
            }

            // clear rules
            if (rules != null)
            {
                rules.Clear();
                rules = null;
            }

            // remove validator
            FormValidator validator = null;

            validators.TryRemove(form, out validator);
        }
コード例 #3
0
 public ValidationSet(FormValidator formValidator, Control control)
 {
     FormValidator = formValidator;
     Control = control;
 }
コード例 #4
0
 public ValidationSet(FormValidator formValidator, Control control)
 {
     FormValidator = formValidator;
     Control       = control;
 }