Simu_EfemView.xaml.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. using System.Collections.Generic;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Core.Utilities;
  7. using EfemDualSimulator.Devices;
  8. using MECF.Framework.Simulator.Core.Commons;
  9. namespace EfemDualSimulator.Views
  10. {
  11. /// <summary>
  12. /// Interaction logic for Simu_EfemView.xaml
  13. /// </summary>
  14. public partial class Simu_EfemView : UserControl
  15. {
  16. public Simu_EfemView()
  17. {
  18. InitializeComponent();
  19. this.DataContext = new EfemSimulatorViewModel();
  20. this.Loaded += OnViewLoaded;
  21. }
  22. private void OnViewLoaded(object sender, RoutedEventArgs e)
  23. {
  24. (DataContext as TimerViewModelBase)?.Start();
  25. }
  26. }
  27. class EfemSimulatorViewModel : SocketDeviceViewModel
  28. {
  29. public string Title
  30. {
  31. get { return "EFEM Simulator"; }
  32. }
  33. public string WaferMap
  34. {
  35. get { return _sim.SlotMap; }
  36. }
  37. private bool _doorOpen;
  38. [IgnorePropertyChange]
  39. public bool DoorOpen
  40. {
  41. get
  42. {
  43. return _doorOpen;
  44. }
  45. set
  46. {
  47. _doorOpen = value;
  48. _sim.SetCassetteDoor(_doorOpen);
  49. }
  50. }
  51. private bool _Maintain;
  52. [IgnorePropertyChange]
  53. public bool Maintain
  54. {
  55. get
  56. {
  57. return _Maintain;
  58. }
  59. set
  60. {
  61. _Maintain = value;
  62. _sim.SetMaintain(_Maintain);
  63. }
  64. }
  65. private bool _Protrude1;
  66. [IgnorePropertyChange]
  67. public bool Protrude1
  68. {
  69. get
  70. {
  71. return _Protrude1;
  72. }
  73. set
  74. {
  75. _Protrude1 = value;
  76. _sim.SetProtrude1(_Protrude1);
  77. }
  78. }
  79. private bool _Protrude2;
  80. [IgnorePropertyChange]
  81. public bool Protrude2
  82. {
  83. get
  84. {
  85. return _Protrude2;
  86. }
  87. set
  88. {
  89. _Protrude2 = value;
  90. _sim.SetProtrude2(_Protrude2);
  91. }
  92. }
  93. private EfemSimulatorServer _sim;
  94. public ICommand Place1Command { get; set; }
  95. public ICommand Remove1Command { get; set; }
  96. public ICommand Place2Command { get; set; }
  97. public ICommand Remove2Command { get; set; }
  98. public ICommand ClearCommand { get; set; }
  99. public ICommand SetAllCommand { get; set; }
  100. public ICommand RandomCommand { get; set; }
  101. public EfemSimulatorViewModel() : base("EfemSimuViewModel")
  102. {
  103. Place1Command = new DelegateCommand<string>(Place1);
  104. Remove1Command = new DelegateCommand<string>(Remove1);
  105. Place2Command = new DelegateCommand<string>(Place2);
  106. Remove2Command = new DelegateCommand<string>(Remove2);
  107. ClearCommand = new DelegateCommand<string>(Clear);
  108. SetAllCommand = new DelegateCommand<string>(SetAll);
  109. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  110. _sim = new EfemSimulatorServer();
  111. Init(_sim);
  112. }
  113. private void RandomGenerateWafer(string obj)
  114. {
  115. _sim.RandomWafer();
  116. }
  117. private void SetAll(string obj)
  118. {
  119. _sim.SetAllWafer();
  120. }
  121. private void Clear(string obj)
  122. {
  123. _sim.ClearWafer();
  124. }
  125. private void Remove1(string obj)
  126. {
  127. _sim.RemoveCarrier1();
  128. }
  129. private void Place1(string obj)
  130. {
  131. _sim.PlaceCarrier1();
  132. }
  133. private void Remove2(string obj)
  134. {
  135. _sim.RemoveCarrier2();
  136. }
  137. private void Place2(string obj)
  138. {
  139. _sim.PlaceCarrier2();
  140. }
  141. private List<string> _WaferSizeItems = new List<string>() { "Small", "Mid", "Big"};
  142. public List<string> WaferSizeItems
  143. {
  144. get
  145. {
  146. return _WaferSizeItems;
  147. }
  148. }
  149. private string _SelectedWaferSize;
  150. public string SelectedWaferSize
  151. {
  152. get
  153. {
  154. return _SelectedWaferSize;
  155. }
  156. set
  157. {
  158. _SelectedWaferSize = value;
  159. switch (value)
  160. {
  161. case "Small":
  162. _sim.WaferSize = 3;
  163. break;
  164. case "Mid":
  165. _sim.WaferSize = 4;
  166. break;
  167. case "Big":
  168. _sim.WaferSize = 6;
  169. break;
  170. }
  171. }
  172. }
  173. }
  174. }