public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { PasswordStrength result = PasswordStrengthUtils.CalculatePasswordStrength((string)value); int rs = 0; switch (result) { case PasswordStrength.Invalid: rs = 0; break; case PasswordStrength.VeryWeak: rs = 1; break; case PasswordStrength.Weak: rs = 2; break; case PasswordStrength.Average: rs = 3; break; case PasswordStrength.Strong: rs = 4; break; case PasswordStrength.VeryStrong: rs = 5; break; } return((int)rs); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { PasswordStrength result = PasswordStrengthUtils.CalculatePasswordStrength((string)value); SolidColorBrush rs = null; switch (result) { case PasswordStrength.Invalid: rs = new SolidColorBrush(Colors.Red); break; case PasswordStrength.VeryWeak: rs = new SolidColorBrush(Colors.Orange); break; case PasswordStrength.Weak: rs = new SolidColorBrush(Colors.Yellow); break; case PasswordStrength.Average: rs = new SolidColorBrush(Colors.LightBlue); break; case PasswordStrength.Strong: rs = new SolidColorBrush(Colors.LightGreen); break; case PasswordStrength.VeryStrong: rs = new SolidColorBrush(Colors.Green); break; } return(rs); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { PasswordStrength result = PasswordStrengthUtils.CalculatePasswordStrength((string)value); string rs = null; switch (result) { case PasswordStrength.Invalid: rs = "Invalid"; break; case PasswordStrength.VeryWeak: rs = "VeryWeak"; break; case PasswordStrength.Weak: rs = "Weak"; break; case PasswordStrength.Average: rs = "Average"; break; case PasswordStrength.Strong: rs = "Strong"; break; case PasswordStrength.VeryStrong: rs = "VeryStrong"; break; } return(rs); }