|
- 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();
- }
- }
- }
|