终端一体化运控平台
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

140 líneas
3.9 KiB

  1. using BPASmartClient.Model;
  2. using System;
  3. using System.Collections.Concurrent;
  4. using System.Collections.ObjectModel;
  5. using System.Globalization;
  6. using System.Linq;
  7. using System.Windows;
  8. using System.Windows.Data;
  9. namespace BPASmartClient.DosingSystem.Converter
  10. {
  11. public class VisibleConvert : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (value is bool temp)
  16. {
  17. if (temp)
  18. {
  19. return Visibility.Visible;
  20. }
  21. else
  22. {
  23. return Visibility.Collapsed;
  24. }
  25. }
  26. return value;
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  29. {
  30. throw new NotImplementedException();
  31. }
  32. }
  33. public class AutoConvert : IValueConverter
  34. {
  35. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  36. {
  37. if (value is bool temp)
  38. {
  39. if (temp)
  40. {
  41. return "自动";
  42. }
  43. else
  44. {
  45. return "手动";
  46. }
  47. }
  48. return value;
  49. }
  50. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  51. {
  52. throw new NotImplementedException();
  53. }
  54. }
  55. public class RunStateConvert : IValueConverter
  56. {
  57. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  58. {
  59. if (value is bool temp)
  60. {
  61. if (temp)
  62. {
  63. return "系统启动";
  64. }
  65. else
  66. {
  67. return "系统停止";
  68. }
  69. }
  70. return value;
  71. }
  72. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  73. {
  74. throw new NotImplementedException();
  75. }
  76. }
  77. public class RunStatusConvert : IValueConverter
  78. {
  79. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  80. {
  81. if (value is ushort tempValue)
  82. {
  83. if (tempValue == 1) return "等待配料";
  84. if (tempValue == 2) return "配料中";
  85. if (tempValue == 3) return "配料完成";
  86. }
  87. return "等待配料";
  88. }
  89. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  90. {
  91. throw new NotImplementedException();
  92. }
  93. }
  94. public class EnbleConvert : IValueConverter
  95. {
  96. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  97. {
  98. if (value is ushort tempValue)
  99. {
  100. if (tempValue == 0) return true;
  101. if (tempValue == 1) return false;
  102. }
  103. return true;
  104. }
  105. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  106. {
  107. throw new NotImplementedException();
  108. }
  109. }
  110. public class IntToSourceConvert : IValueConverter
  111. {
  112. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  113. {
  114. if (value is ushort tempValue)
  115. {
  116. if (tempValue == 0) return "本地原料";
  117. if (tempValue == 1) return "设备原料";
  118. }
  119. return "未知";
  120. }
  121. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  122. {
  123. throw new NotImplementedException();
  124. }
  125. }
  126. }