예제 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string)
            {
                int str = (int)PasswordStrengthUtils.CalculatePasswordStrength(value as string);
                switch (str)
                {
                case 0:
                    return(Brushes.Red);

                case 1:
                    return(Brushes.Red);

                case 2:
                    return(Brushes.Orange);

                case 3:
                    return(Brushes.Yellow);

                case 4:
                    return(Brushes.Lime);

                case 5:
                    return(Brushes.Green);

                default:
                    return(null);
                }
            }
            return(null);
        }
예제 #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         int str = (int)PasswordStrengthUtils.CalculatePasswordStrength(value as string);
         return(Enum.GetName(typeof(PasswordStrength), str));
     }
     return(null);
 }
예제 #3
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         int str = (int)PasswordStrengthUtils.CalculatePasswordStrength(value as string);
         return($"{5-str}*");
     }
     return(null);
 }