45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
namespace Common.UI.Infrastructure
|
|
{
|
|
using Common.Hardware.SIRT;
|
|
using Common.Hardware.SIRT.Parameters;
|
|
using Common.Hardware.SIRT.Tasks;
|
|
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
internal class TaskStateToForegroundBrushConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var brush = Brushes.Gray;
|
|
|
|
if (value is string label)
|
|
{
|
|
switch (label)
|
|
{
|
|
case nameof(SIRTTaskState.Pending):; break;
|
|
case nameof(SIRTTaskState.Completed): brush = Brushes.DarkGreen; break;
|
|
case nameof(SIRTTaskState.Cancelled): brush = Brushes.DarkRed; break;
|
|
case nameof(SIRTTaskState.Running): brush = Brushes.DarkOrange; break;
|
|
case nameof(SIRTConstants.BUP): brush = Brushes.DarkOrange; break;
|
|
case nameof(SIRTConstants.LAT): brush = Brushes.DarkOrange; break;
|
|
case nameof(SIRTConstants.DEBUG): brush = Brushes.DarkBlue; break;
|
|
case nameof(SIRTConstants.SEMI): brush = Brushes.DarkGreen; break;
|
|
case nameof(PAMStatus.OK): brush = Brushes.DarkGreen; break;
|
|
case "AKN": brush = Brushes.DarkOrange; break;
|
|
default: brush = Brushes.DarkRed; break;
|
|
}
|
|
}
|
|
|
|
return brush;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|