终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.5 KiB

  1. using Org.BouncyCastle.Asn1.EdEC;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Data;
  9. namespace BPASmartClient.MorkCL.Converter
  10. {
  11. public class FryPanConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (value != null && value is EDeviceType deviceType)
  16. {
  17. //switch (deviceType)
  18. //{
  19. // case EDeviceType.炒锅1:
  20. // return "1#炒锅";
  21. // case EDeviceType.炒锅2:
  22. // return "2#炒锅";
  23. //}
  24. return deviceType.ToString();
  25. }
  26. return null;
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  29. {
  30. //if (value != null)
  31. //{
  32. // string v=value.ToString();
  33. // switch (v)
  34. // {
  35. // case "1#炒锅":
  36. // return EDeviceType.炒锅1;
  37. // case "2#炒锅":
  38. // return EDeviceType.炒锅2;
  39. // }
  40. //}
  41. if (value is string strValue && Enum.TryParse(typeof(EDeviceType),strValue,out var enumValue))
  42. {
  43. return enumValue;
  44. }
  45. return DependencyProperty.UnsetValue;
  46. }
  47. }
  48. }