27 lines
865 B
C#
27 lines
865 B
C#
using System.Globalization;
|
|
using NFCLockDemoV2.ViewModels;
|
|
|
|
namespace NFCLockDemoV2.Converters;
|
|
|
|
public class OperationColorConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is OperationType currentOperation && parameter is string operationStr)
|
|
{
|
|
if (Enum.TryParse<OperationType>(operationStr, out var targetOperation))
|
|
{
|
|
return currentOperation == targetOperation
|
|
? Color.FromArgb("#00BCD4") // Cyan
|
|
: Color.FromArgb("#D3D3D3"); // LightGray
|
|
}
|
|
}
|
|
return Color.FromArgb("#D3D3D3");
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|