2020-01-03 20:56:55 +01:00
|
|
|
|
using System;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Utilities
|
|
|
|
|
{
|
|
|
|
|
public class ColoredPasswordConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter,
|
|
|
|
|
System.Globalization.CultureInfo culture)
|
|
|
|
|
{
|
2020-03-28 14:16:28 +01:00
|
|
|
|
if (targetType != typeof(string))
|
2020-01-03 20:56:55 +01:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("The target must be a string.");
|
|
|
|
|
}
|
2020-03-28 14:16:28 +01:00
|
|
|
|
if (value == null)
|
2020-01-03 20:56:55 +01:00
|
|
|
|
{
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
return PasswordFormatter.FormatPassword((string)value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter,
|
|
|
|
|
System.Globalization.CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|