namespace GDNXFD.Alert.Config.Converters { using System; using System.IO; using System.Windows.Data; using System.Windows.Media.Imaging; /// /// Byte to image converter /// public class CategoryCodeToTextConverter : IValueConverter { /// /// Convert a byte array to an image. /// /// /// /// /// /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null) { string code = value.ToString().Trim(); switch (code) { case "1": return "风机"; case "2": return "风场"; case "3": return "工程"; case "4": return "线路"; case "5": return "电气"; } } return "未知"; } /// /// Convert an image to a byte array /// /// /// /// /// /// public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }