Наследование: System.EventArgs
Пример #1
0
        public void view_OnValidate(object sender, ValidateEventArgs e)
        {
            ExternalVariableValidator externalVariableValidator = new ExternalVariableValidator();
            IEnumerable <string>      messages = externalVariableValidator.ValidateValue(e.Variable, e.Value);

            e.ErrorMessage = this.GetMessageText(messages);
            e.Result       = messages.Count() == 0;
        }
        void control_Validating(object sender, CancelEventArgs e)
        {
            var control = sender as Control;

            var args = new ValidateEventArgs();

            args.Variable = mainWindow.ExternalVariables.Where(n => n.id == control.Name).FirstOrDefault();

            if (control is ComboBox)
            {
                args.Value = new ExternalVariableHelper().GetSelectItemValue(control as ComboBox);
            }
            else
            {
                args.Value = control.Text;
            }

            OnValidate(this, args);
            if (!args.Result)
            {
                e.Cancel = true;
                errorProvider.SetError(control, args.ErrorMessage);
            }
        }
Пример #3
0
        void control_Validating(object sender, CancelEventArgs e)
        {
            var control = sender as Control;

            var args = new ValidateEventArgs();
            args.Variable = mainWindow.ExternalVariables.Where(n => n.id == control.Name).FirstOrDefault();

            if (control is ComboBox)
            {
                args.Value = new ExternalVariableHelper().GetSelectItemValue(control as ComboBox);
            }
            else
            {
                args.Value = control.Text;
            }

            OnValidate(this, args);
            if (!args.Result)
            {
                e.Cancel = true;
                errorProvider.SetError(control, args.ErrorMessage);
            }
        }
Пример #4
0
 public void view_OnValidate(object sender, ValidateEventArgs e)
 {
     ExternalVariableValidator externalVariableValidator = new ExternalVariableValidator();
     IEnumerable<string> messages = externalVariableValidator.ValidateValue(e.Variable, e.Value);
     e.ErrorMessage = this.GetMessageText(messages);
     e.Result = messages.Count() == 0;
 }