Simu_EfemView.xaml.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 MECF.Framework.Simulator.Core.Commons;
  8. using CyberX8_Simulator.Devices;
  9. namespace CyberX8_Simulator.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 SunWayEfemSimulator _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 Place3Command { get; set; }
  99. public ICommand Remove3Command { get; set; }
  100. public ICommand ClearCommand { get; set; }
  101. public ICommand SetAllCommand { get; set; }
  102. public ICommand RandomCommand { get; set; }
  103. public ICommand RandomDummyCommand { get; set; }
  104. public EfemSimulatorViewModel() : base("EfemSimuViewModel")
  105. {
  106. Place1Command = new DelegateCommand<string>(Place1);
  107. Remove1Command = new DelegateCommand<string>(Remove1);
  108. Place2Command = new DelegateCommand<string>(Place2);
  109. Remove2Command = new DelegateCommand<string>(Remove2);
  110. Place3Command = new DelegateCommand<string>(Place3);
  111. Remove3Command = new DelegateCommand<string>(Remove3);
  112. ClearCommand = new DelegateCommand<string>(Clear);
  113. SetAllCommand = new DelegateCommand<string>(SetAll);
  114. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  115. RandomDummyCommand = new DelegateCommand<string>(RandomDummyGenerateWafer);
  116. _sim = new SunWayEfemSimulator();
  117. Init(_sim);
  118. }
  119. private void RandomGenerateWafer(string obj)
  120. {
  121. _sim.RandomWafer();
  122. }
  123. private void RandomDummyGenerateWafer(string obj)
  124. {
  125. _sim.RandomDummyWafer();
  126. }
  127. private void SetAll(string obj)
  128. {
  129. _sim.SetAllWafer();
  130. }
  131. private void Clear(string obj)
  132. {
  133. _sim.ClearWafer();
  134. }
  135. private void Remove1(string obj)
  136. {
  137. _sim.RemoveCarrier1();
  138. }
  139. private void Place1(string obj)
  140. {
  141. _sim.PlaceCarrier1();
  142. }
  143. private void Remove2(string obj)
  144. {
  145. _sim.RemoveCarrier2();
  146. }
  147. private void Place2(string obj)
  148. {
  149. _sim.PlaceCarrier2();
  150. }
  151. private void Remove3(string obj)
  152. {
  153. _sim.RemoveCarrier3();
  154. }
  155. private void Place3(string obj)
  156. {
  157. _sim.PlaceCarrier3();
  158. }
  159. private List<string> _WaferSizeItems = new List<string>() { "Small", "Mid", "Big"};
  160. public List<string> WaferSizeItems
  161. {
  162. get
  163. {
  164. return _WaferSizeItems;
  165. }
  166. }
  167. private string _SelectedWaferSize;
  168. public string SelectedWaferSize
  169. {
  170. get
  171. {
  172. return _SelectedWaferSize;
  173. }
  174. set
  175. {
  176. _SelectedWaferSize = value;
  177. switch (value)
  178. {
  179. case "Small":
  180. _sim.WaferSize = 3;
  181. break;
  182. case "Mid":
  183. _sim.WaferSize = 4;
  184. break;
  185. case "Big":
  186. _sim.WaferSize = 6;
  187. break;
  188. }
  189. }
  190. }
  191. }
  192. }