

namespace HistoryView.Converters;

internal class BoolBurshConverter : IValueConverter
{
    object? IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not bool b)
            return null;
        try
        {
            return b switch
            {
                true => Application.Current.Resources["NormalColor"],
                false => Application.Current.Resources["EmergencyColor"]
            };
        }
        catch
        {
            return null;
        }
    }

    object? IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}

internal class BoolBurshConverter2 : IValueConverter
{
    object? IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not bool b)
            return Application.Current.Resources["LightThemeColor"];
        try
        {
            return b switch
            {
                true => Application.Current.Resources["LightThemeColor"],
                false => Application.Current.Resources["LightEmergencyColor"]
            };
        }
        catch
        {
            return null;
        }
    }

    object? IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}
