WaferHistoryDBView.xaml.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using MECF.Framework.Common.CommonData;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace CyberX8_MainPages.Views
  18. {
  19. /// <summary>
  20. /// WaferHistoryDBView.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class WaferHistoryDBView : UserControl
  23. {
  24. public WaferHistoryDBView()
  25. {
  26. InitializeComponent();
  27. }
  28. }
  29. public class HistoryLayoutSelectorConverter : IValueConverter
  30. {
  31. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  32. {
  33. if (value != null)
  34. {
  35. var type = ((WaferHistoryItem)value).Type;
  36. switch (type)
  37. {
  38. case WaferHistoryItemType.None:
  39. return LotsLayout;
  40. case WaferHistoryItemType.Lot:
  41. return WaferLayout;
  42. case WaferHistoryItemType.Wafer:
  43. return MovementLayout;
  44. case WaferHistoryItemType.Recipe:
  45. return RecipeLayout;
  46. default:
  47. break;
  48. }
  49. }
  50. return null;
  51. }
  52. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  53. {
  54. return null;
  55. }
  56. public object WaferLayout { get; set; }
  57. public object MovementLayout { get; set; }
  58. public object RecipeLayout { get; set; }
  59. public object LotsLayout { get; set; }
  60. }
  61. public class HideMinTimeConverters : IValueConverter
  62. {
  63. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  64. {
  65. if (value is DateTime)
  66. return (DateTime)value == DateTime.MinValue ? "" : ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss");
  67. if (DateTime.TryParse((string)value, out DateTime dateTime))
  68. return dateTime == DateTime.MinValue ? "" : dateTime.ToString("yyyy-MM-dd HH:mm:ss");
  69. return "";
  70. }
  71. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  72. {
  73. return null;
  74. }
  75. }
  76. public class MinTime2BoolConverters : IValueConverter
  77. {
  78. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  79. {
  80. if (value is DateTime)
  81. return (DateTime)value != DateTime.MinValue;
  82. if (DateTime.TryParse((string)value, out DateTime dateTime))
  83. return dateTime != DateTime.MinValue;
  84. return false;
  85. }
  86. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  87. {
  88. return null;
  89. }
  90. }
  91. public class RecipeStepNull2Empty : IValueConverter
  92. {
  93. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  94. {
  95. if (value != null && (value is List<RecipeStep>) && ((List<RecipeStep>)value).Count > 0)
  96. {
  97. return value;
  98. }
  99. return new List<RecipeStep>() { new RecipeStep() { Name = "", StartTime = DateTime.MinValue, EndTime = DateTime.MinValue, ActualTime = "", SettingTime = "" } };
  100. }
  101. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  102. {
  103. return null;
  104. }
  105. }
  106. }