|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using BPASmartClient.CustomResource.UserControls.Enum;
- 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 BPASmartClient.Academy.Converter
- {
- public class DeviceCtrlConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (parameter.ToString() == "1")//流向正向
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
-
- }
- else if (parameter.ToString() == "2")//管道颜色
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return Color.FromRgb(227,26,26);
- }
- else
- {
- return Color.FromRgb(255,255,255);
- }
- }
- else
- {
- return Color.FromRgb(255, 255, 255);
- }
- }
- else if(parameter.ToString() == "3")//电机颜色
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return MotorColor.Green;
- }
- else
- {
- return MotorColor.Gray;
- }
- }
- else
- {
- return MotorColor.Gray;
- }
- }
- else if(parameter.ToString()=="4")//字体颜色
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return new SolidColorBrush(Color.FromRgb(227, 26, 26));
- }
- else
- {
- return new SolidColorBrush(Color.FromRgb(255, 255, 255));
- }
- }
- else
- {
- return new SolidColorBrush(Color.FromRgb(255, 255, 255));
- }
- }
- else if(parameter.ToString() == "5")//流向反向
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return 2;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
- else if (parameter.ToString() == "6")//冷凝水颜色
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return Color.FromRgb(0, 255, 0);
- }
- else
- {
- return Color.FromRgb(255, 255, 255);
- }
- }
- else
- {
- return Color.FromRgb(255, 255, 255);
- }
- }
- else //冷凝水、疏水管道颜色
- {
- if (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return Color.FromRgb(0, 255, 0);
- }
- else
- {
- return Color.FromRgb(227, 26, 26);
- }
- }
- else
- {
- return Color.FromRgb(227, 26, 26);
- }
- }
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|