Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
 public ValidationSet(FormValidator formValidator, Control control)
 {
     FormValidator = formValidator;
     Control = control;
 }
 public ValidationSet(FormValidator formValidator, Control control)
 {
     FormValidator = formValidator;
     Control       = control;
 }