Exemplo n.º 1
0
        private void CheckPass()
        {
            errorProvider1.Clear();
            if (textBoxX1.Text == "")
            {
                SetError("不可空白。");
                btn_save.Enabled = false;
                return;
            }

            if (ValidateEvent != null)
            {
                ReviseRuleNameEventArgs eventArg = GetArgs();

                ValidateEvent.Invoke(this, eventArg);

                if (eventArg.Error == true)
                {
                    SetError(eventArg.ErrorString);
                    btn_save.Enabled = false;
                    return;
                }
                else
                {
                    btn_save.Enabled = true;
                }
            }
        }
Exemplo n.º 2
0
/*
 *      public bool ValidateControl()
 *      {
 *          var evt = new ValidateEvent();
 *          ValidateControlTree(evt);
 *          ViewContext.ControllerContext.Application.NotifyOnValidate(evt);
 *          return evt.Validations.All(x => x.IsValid);
 *      }
 */

/*
 *      private void ValidateControlTree(ValidateEvent evt)
 *      {
 *          OnValidate(evt);
 *          foreach (var child in Children)
 *              child.ValidateControlTree(evt);
 *      }
 */

        protected virtual void OnValidate(ValidateEvent evt)
        {
            var validate = Validate;

            if (validate != null)
            {
                validate(evt);
            }
        }
Exemplo n.º 3
0
 private void ValidateCommandExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     if ((MainViewModel.Instance.Parameters.BaseParameters.AdminLogin == Login && MainViewModel.Instance.Parameters.BaseParameters.AdminPassword == Password) ||
         TeacherModel.Login(Login, Password).Any())
     {
         ValidateEvent?.Invoke();
     }
     else
     {
         MessageBox.Show("Erreur d'authentification", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the final value of the ValidateEventArgs.IsValid property.
        /// </summary>
        private bool RaiseEvent(ValidatorItem <T> validator_item)
        {
            ValidateEventArgs <T> e = new ValidateEventArgs <T>(validator_item.PropertyName);

            e.Remark = "";

            ValidateEvent?.Invoke(this, _viewmodel, e);

            //if (validator_item.Control != null)
            //{
            //FormField ff = VenturaVisualTreeHelper.FindParent<FormField>(validator_item.Control);

            if (validator_item.FormField != null)
            {
                validator_item.FormField.Remark = e.Remark;
            }

            //}

            return(e.IsValid);
        }
Exemplo n.º 5
0
 public virtual void Validate()
 {
     ValidateEvent?.Invoke(this, new LayerConstructEventArgs(this));
 }