25 lines
819 B
C#
25 lines
819 B
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
namespace Livia.Views.Converters;
|
|
|
|
[ValueConversion(typeof(int), typeof(SolidColorBrush))]
|
|
public class ServerJobStatusColorConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
return value switch
|
|
{
|
|
4 => Application.Current.TryFindResource("SuccessTextColorBrush"),
|
|
5 => Application.Current.TryFindResource("FailedTextColorBrush"),
|
|
_ => Application.Current.TryFindResource("ProcessingTextColorBrush")
|
|
};
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
} |