123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- 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 LevelIdToTextConverter : 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 "LOLO":
- return "低";
- case "LO":
- return "中低";
- case "MEDIUM":
- return "中";
- case "HI":
- return "中高";
- case "HIHI":
- 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();
- }
- }
- }
|