1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-11 21:13:37 +00:00
Files
mobile/src/App/Utilities/BoolToColorConverter.cs
André Bispo 7a65bf7fd7 [PM-3340] Update timeout action for users without master password. (#2818)
* [PM-3340] Update timeout action for users without master password.

* [PM-3340] PR fixes and refactor

* [PM-3340] Raise command can execute.

* [PM-3340] Fix converter name

* [PM-3340] Fix variable naming

---------

Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2023-11-06 15:28:54 +00:00

27 lines
858 B
C#

using System;
using Xamarin.Forms;
namespace Bit.App.Utilities
{
public class BoolEnablementToTextColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType == typeof(Color) && value is bool valueBool)
{
return valueBool ? ThemeManager.GetResourceColor("TextColor") :
ThemeManager.GetResourceColor("MutedColor");
}
throw new InvalidOperationException("The value must be a boolean with a Color target.");
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}