修改监控部分功能
This commit is contained in:
33
SamplePreSystem.UI/Converters/CommunicationColorConverter.cs
Normal file
33
SamplePreSystem.UI/Converters/CommunicationColorConverter.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user