using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Windows.Data; using System.Globalization; using System.Text.RegularExpressions; using BPASmartClient.CustomResource.Pages.Enums; namespace BPASmartClient.CustomResource.Converters { public class StatusIconConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { if (value.ToString() == Status.等待配料.ToString()) return Regex.Unescape(StringToUnicode("")); else if (value.ToString() == Status.正在配料.ToString()) return Regex.Unescape(StringToUnicode("")); else if (value.ToString() == Status.配料完成.ToString()) return Regex.Unescape(StringToUnicode("")); } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } /// /// 字符串转为UniCode码字符串 /// public static string StringToUnicode(string s) { if (!string.IsNullOrEmpty(s)) { //这里把格式 转为 \ue625 return s.Replace(@"&#x", @"\u").Replace(";", ""); } return s; } } }