终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

48 行
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Data;
  7. using System.Windows.Data;
  8. using System.Globalization;
  9. using System.Text.RegularExpressions;
  10. namespace BPASmartClient.SmallBatchingSystem.Converter
  11. {
  12. public class StatusIconConverter : IValueConverter
  13. {
  14. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  15. {
  16. if (value != null)
  17. {
  18. if (value.ToString() == Status.等待配料.ToString())
  19. return Regex.Unescape(StringToUnicode(""));
  20. else if (value.ToString() == Status.正在配料.ToString())
  21. return Regex.Unescape(StringToUnicode(""));
  22. else if (value.ToString() == Status.配料完成.ToString())
  23. return Regex.Unescape(StringToUnicode(""));
  24. }
  25. return value;
  26. }
  27. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  28. {
  29. throw new NotImplementedException();
  30. }
  31. /// <summary>
  32. /// 字符串转为UniCode码字符串
  33. /// </summary>
  34. public static string StringToUnicode(string s)
  35. {
  36. if (!string.IsNullOrEmpty(s))
  37. {
  38. //这里把格式&#xe625; 转为 \ue625
  39. return s.Replace(@"&#x", @"\u").Replace(";", "");
  40. }
  41. return s;
  42. }
  43. }
  44. }