| 123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.Globalization;
- using System.Windows.Data;
- namespace DeviceCenter
- {
- [ValueConversion(typeof(DeviceStatus), typeof(String))]
- class DeviceStatusColorConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null)
- {
- DeviceStatus status = (DeviceStatus)value;
- switch (status)
- {
- case DeviceStatus.CONNECTING:
- return "#E6A23C";
- case DeviceStatus.CONNECTED:
- return "#67C23A";
- case DeviceStatus.FAIL:
- return "#F56C6C";
- }
- }
- return "";
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return null;
- }
- }
- }
|