|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using Org.BouncyCastle.Asn1.EdEC;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Data;
-
- namespace BPASmartClient.MorkCL.Converter
- {
- public class FryPanConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value != null && value is EDeviceType deviceType)
- {
- //switch (deviceType)
- //{
- // case EDeviceType.炒锅1:
- // return "1#炒锅";
- // case EDeviceType.炒锅2:
- // return "2#炒锅";
- //}
- return deviceType.ToString();
- }
- return null;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- //if (value != null)
- //{
- // string v=value.ToString();
- // switch (v)
- // {
- // case "1#炒锅":
- // return EDeviceType.炒锅1;
- // case "2#炒锅":
- // return EDeviceType.炒锅2;
- // }
- //}
- if (value is string strValue && Enum.TryParse(typeof(EDeviceType),strValue,out var enumValue))
- {
- return enumValue;
- }
- return DependencyProperty.UnsetValue;
- }
- }
- }
|