|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- 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 (value is bool)
- {
- bool value_get = (bool)value;
- if (value_get)
- {
- return 2;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|