34 lines
873 B
C#
34 lines
873 B
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 SamplePreSystem.UI.Converters
|
|
{
|
|
public class CommunicationColorConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
string str = value.ToString();
|
|
|
|
if (str.Contains("PLC通信异常"))
|
|
{
|
|
return new SolidColorBrush(Colors.Red);
|
|
}
|
|
else
|
|
{
|
|
return new SolidColorBrush(Colors.Green);
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value;
|
|
}
|
|
}
|
|
}
|