StationIdToTextConverter.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 StationIdToTextConverter : 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 "MHS_FDC":
  28. return "麻黄山风电场";
  29. case "NSS_FDC":
  30. return "牛首山风电场";
  31. case "QS_FDC":
  32. return "青山风电场";
  33. case "SBQ_FDC":
  34. return "石板泉风电场";
  35. case "XS_FDC":
  36. return "香山风电场";
  37. case "DWK_GDC":
  38. return "大武口光伏电站";
  39. case "PL_GDC":
  40. return "平罗光伏电站";
  41. case "MCH_GDC":
  42. return "马场湖光伏电站";
  43. case "XH_GDC":
  44. return "宣和光伏电站";
  45. }
  46. }
  47. return "未知";
  48. }
  49. /// <summary>
  50. /// Convert an image to a byte array
  51. /// </summary>
  52. /// <param name="value"></param>
  53. /// <param name="targetType"></param>
  54. /// <param name="parameter"></param>
  55. /// <param name="culture"></param>
  56. /// <returns></returns>
  57. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  58. {
  59. throw new NotImplementedException();
  60. }
  61. }
  62. }