20230201_145_upperpc/InSituLaboratory.Base/WorkStateConvert.cs

42 lines
1.1 KiB
C#
Raw Normal View History

2024-04-23 10:20:19 +00:00
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 WorkStateConvert : 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, 128, 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();
}
}
}