1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- namespace GDNXFD.Alert.Config.Converters
- {
- using System;
- using System.IO;
- using System.Windows.Data;
- using System.Windows.Media.Imaging;
- /// <summary>
- /// Byte to image converter
- /// </summary>
- public class StationIdToTextConverter : IValueConverter
- {
- /// <summary>
- /// Convert a byte array to an image.
- /// </summary>
- /// <param name="value"></param>
- /// <param name="targetType"></param>
- /// <param name="parameter"></param>
- /// <param name="culture"></param>
- /// <returns></returns>
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- if (value != null)
- {
- string code = value.ToString().Trim();
- switch (code)
- {
- case "MHS_FDC":
- return "麻黄山风电场";
- case "NSS_FDC":
- return "牛首山风电场";
- case "QS_FDC":
- return "青山风电场";
- case "SBQ_FDC":
- return "石板泉风电场";
- case "XS_FDC":
- return "香山风电场";
- case "DWK_GDC":
- return "大武口光伏电站";
- case "PL_GDC":
- return "平罗光伏电站";
- case "MCH_GDC":
- return "马场湖光伏电站";
- case "XH_GDC":
- return "宣和光伏电站";
- }
- }
- return "未知";
- }
- /// <summary>
- /// Convert an image to a byte array
- /// </summary>
- /// <param name="value"></param>
- /// <param name="targetType"></param>
- /// <param name="parameter"></param>
- /// <param name="culture"></param>
- /// <returns></returns>
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|