42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Data;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace InSituLaboratory.Base
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 故障状态转换器
|
|||
|
|
/// </summary>
|
|||
|
|
public class FaultStateConvert : IValueConverter
|
|||
|
|
{
|
|||
|
|
public static object ConvertObject;
|
|||
|
|
|
|||
|
|
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
Brush background = null;
|
|||
|
|
if ((string)value == "故障")
|
|||
|
|
{
|
|||
|
|
//红色
|
|||
|
|
background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
|||
|
|
}
|
|||
|
|
else if ((string)value == "正常")
|
|||
|
|
{
|
|||
|
|
//绿色
|
|||
|
|
background = new SolidColorBrush(Color.FromRgb(0, 255, 0));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return background;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|||
|
|
{
|
|||
|
|
throw new NotImplementedException();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|