WaferTransferDialogViewModel.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Input;
  4. using Aitex.Core.RT.Log;
  5. using MECF.Framework.Common.CommonData;
  6. using MECF.Framework.Common.DataCenter;
  7. using OpenSEMI.ClientBase;
  8. using OpenSEMI.ClientBase.Command;
  9. namespace MECF.Framework.UI.Client.ClientBase
  10. {
  11. public class WaferTransferDialogViewModel : DialogViewModel<WaferTransferCondition>
  12. {
  13. private WaferTransferCondition _Conditions;
  14. public WaferTransferCondition Conditions
  15. {
  16. get { return _Conditions; }
  17. set { _Conditions = value; }
  18. }
  19. private string _ConfirmText;
  20. public string ConfirmText
  21. {
  22. get { return _ConfirmText; }
  23. set { _ConfirmText = value; }
  24. }
  25. public bool IsBlade1 { get; set; }
  26. public bool IsBlade2 { get; set; }
  27. public bool DisplayPassAlignerCondition { get; set; }
  28. public bool DisplayPassCoolingCondition { get; set; }
  29. public bool DisplayBladeCondition { get; set; }
  30. public Visibility AlignerVisibility { get; set; }
  31. public Visibility CoolingVisibility { get; set; }
  32. public Visibility BladeVisibility { get; set; }
  33. private ICommand _TransferCommand;
  34. public ICommand TransferCommand
  35. {
  36. get
  37. {
  38. if (this._TransferCommand == null)
  39. this._TransferCommand = new BaseCommand<EventCommandParameter<object, RoutedEventArgs>>((EventCommandParameter<object, RoutedEventArgs> arg) => this.OnTransferCommand(arg));
  40. return this._TransferCommand;
  41. }
  42. }
  43. private ICommand _BtnCancelCommand;
  44. public ICommand CancelCommand
  45. {
  46. get
  47. {
  48. if (this._BtnCancelCommand == null)
  49. this._BtnCancelCommand = new BaseCommand<EventCommandParameter<object, RoutedEventArgs>>((EventCommandParameter<object, RoutedEventArgs> arg) => this.OnCancelCommand(arg));
  50. return this._BtnCancelCommand;
  51. }
  52. }
  53. protected override void OnInitialize()
  54. {
  55. base.OnInitialize();
  56. }
  57. public WaferTransferDialogViewModel(string message, bool displayPassAlignerCondition, bool displayPassCoolingCondition, bool displayBladeCondition = false)
  58. {
  59. AlignerVisibility = Visibility.Visible;
  60. CoolingVisibility = Visibility.Visible;
  61. BladeVisibility = displayBladeCondition ? Visibility.Visible : Visibility.Hidden;
  62. this.DisplayName = "Wafer Transfer Dialog";
  63. ConfirmText = message;
  64. Conditions = new WaferTransferCondition();
  65. DisplayPassAlignerCondition = displayPassAlignerCondition;
  66. DisplayPassCoolingCondition = displayPassCoolingCondition;
  67. DisplayBladeCondition = displayBladeCondition;
  68. try
  69. {
  70. var defaultAutoAlign = QueryDataClient.Instance.Service.GetConfig("System.AutoAlignManualTransfer");
  71. if (!displayPassAlignerCondition)
  72. defaultAutoAlign = false;
  73. var defaultPassCooling = QueryDataClient.Instance.Service.GetConfig("System.AutoPassCooling");
  74. if (!displayPassCoolingCondition)
  75. defaultPassCooling = false;
  76. Conditions.IsPassAligner = defaultAutoAlign == null || (bool)defaultAutoAlign;
  77. Conditions.IsPassCooling = defaultPassCooling == null || (bool)defaultPassCooling;
  78. var alignerAngle = QueryDataClient.Instance.Service.GetConfig("Aligner.DefaultNotchDegree");
  79. var coolingTime = QueryDataClient.Instance.Service.GetConfig("LoadLock.DefaultCoolingTime");
  80. if (alignerAngle != null)
  81. Conditions.AlignerAngle = (int)((double)alignerAngle);
  82. if (coolingTime != null)
  83. Conditions.CoolingTime = (int)coolingTime;
  84. }
  85. catch (Exception ex)
  86. {
  87. LOG.Write(ex);
  88. }
  89. }
  90. private void OnTransferCommand(EventCommandParameter<object, RoutedEventArgs> arg)
  91. {
  92. if (IsBlade1)
  93. Conditions.Blade = RobotArm.ArmA;
  94. else if (IsBlade2)
  95. Conditions.Blade = RobotArm.ArmB;
  96. DialogResult = Conditions;
  97. TryClose(true);
  98. }
  99. private void OnCancelCommand(EventCommandParameter<object, RoutedEventArgs> arg)
  100. {
  101. TryClose(false);
  102. }
  103. }
  104. }