private void input_Password1_PasswordChanged(object sender, RoutedEventArgs e) { Password pass = new Password(); string password = input_Password1.Password; if (pass.MinLength(password)) { } pass.CheckSymbols(password); pass.CheckAlphabet(password); }
private void Input_password_PreviewKeyUp(object sender, KeyEventArgs e) { var PassCheck = new Password(); if (PassCheck.CheckPass(Input_password.Password).accept) { lb_er1.Visibility = Visibility.Hidden; } else { lb_er1.Visibility = Visibility.Visible; } if (PassCheck.CheckAlphabet(Input_password.Password).acces) { txtblk_error_mesage_3.Foreground = Brushes.GreenYellow; txtblk_error_mesage_3.Text = PassCheck.CheckAlphabet(Input_password.Password).error; } else { txtblk_error_mesage_3.Foreground = Brushes.Red; txtblk_error_mesage_3.Text = PassCheck.CheckAlphabet(Input_password.Password).error; } if (PassCheck.CheckSymbols(Input_password.Password).acces) { txtblk_error_mesage_2.Foreground = Brushes.GreenYellow; txtblk_error_mesage_2.Text = PassCheck.CheckSymbols(Input_password.Password).error; } else { txtblk_error_mesage_2.Foreground = Brushes.Red; txtblk_error_mesage_2.Text = PassCheck.CheckSymbols(Input_password.Password).error; } if (PassCheck.MinLength(Input_password.Password).acces) { txtblk_error_mesage_1.Foreground = Brushes.GreenYellow; txtblk_error_mesage_1.Text = PassCheck.MinLength(Input_password.Password).error; } else { txtblk_error_mesage_1.Foreground = Brushes.Red; txtblk_error_mesage_1.Text = PassCheck.MinLength(Input_password.Password).error; } txtblk_error_mesage_3.Visibility = Visibility.Visible; txtblk_error_mesage_2.Visibility = Visibility.Visible; txtblk_error_mesage_1.Visibility = Visibility.Visible; }
private void button_Register_Click(object sender, RoutedEventArgs e) { string password = input_Password1.Password; Password pass = new Password(); //pass.Error += ErrorMessage; //pass.Success += SuccessMessage; bool minLength = pass.MinLength(password); bool checkSymbols = pass.CheckSymbols(password); bool checkAlphabet = pass.CheckAlphabet(password); if (minLength && checkSymbols && checkAlphabet) { //SuccessMessage("Всё OK"); } else { //ErrorMessage("Пароль не соответствует требованиям"); } }