object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) { PasswordStrength ret = PasswordStrengthUtils.CalculatePasswordStrength((string)value); switch (ret) { case PasswordStrength.VeryWeak: return((SolidColorBrush)(new BrushConverter().ConvertFrom("#f54842"))); case PasswordStrength.Weak: return((SolidColorBrush)(new BrushConverter().ConvertFrom("#f57542"))); case PasswordStrength.Average: return((SolidColorBrush)(new BrushConverter().ConvertFrom("#f5da42"))); case PasswordStrength.Strong: return((SolidColorBrush)(new BrushConverter().ConvertFrom("#7bf542"))); case PasswordStrength.VeryStrong: return((SolidColorBrush)(new BrushConverter().ConvertFrom("#237529"))); default: return(null); } }
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) { PasswordStrength ret = PasswordStrengthUtils.CalculatePasswordStrength((string)value); switch (ret) { case PasswordStrength.VeryWeak: return(20); case PasswordStrength.Weak: return(40); case PasswordStrength.Average: return(60); case PasswordStrength.Strong: return(80); case PasswordStrength.VeryStrong: return(100); default: return(null); } }
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(PasswordStrengthUtils.CalculatePasswordStrength((string)value).ToString()); }