Category2ToTextConverter.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace GDNXFD.Alert.Config.Converters
  2. {
  3. using System;
  4. using System.IO;
  5. using System.Windows.Data;
  6. using System.Windows.Media.Imaging;
  7. /// <summary>
  8. /// Byte to image converter
  9. /// </summary>
  10. public class Category2ToTextConverter : IValueConverter
  11. {
  12. /// <summary>
  13. /// Convert a byte array to an image.
  14. /// </summary>
  15. /// <param name="value"></param>
  16. /// <param name="targetType"></param>
  17. /// <param name="parameter"></param>
  18. /// <param name="culture"></param>
  19. /// <returns></returns>
  20. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  21. {
  22. if (value != null)
  23. {
  24. string code = value.ToString().Trim();
  25. switch (code)
  26. {
  27. case "SYZ":
  28. return "升压站";
  29. case "GF":
  30. return "光伏";
  31. }
  32. }
  33. return "未知";
  34. }
  35. /// <summary>
  36. /// Convert an image to a byte array
  37. /// </summary>
  38. /// <param name="value"></param>
  39. /// <param name="targetType"></param>
  40. /// <param name="parameter"></param>
  41. /// <param name="culture"></param>
  42. /// <returns></returns>
  43. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  44. {
  45. throw new NotImplementedException();
  46. }
  47. }
  48. }