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;
                }
            }
        }
Exemple #2
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);
     }
 }
        /// <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);
        }
Exemple #4
0
 public virtual void Validate()
 {
     ValidateEvent?.Invoke(this, new LayerConstructEventArgs(this));
 }