Simu_SunWayEfemView.xaml.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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_SunWayEfemView : UserControl
  15. {
  16. public Simu_SunWayEfemView()
  17. {
  18. InitializeComponent();
  19. this.DataContext = new Simu_SunWayEfemViewModel();
  20. this.Loaded += OnViewLoaded;
  21. }
  22. private void OnViewLoaded(object sender, RoutedEventArgs e)
  23. {
  24. (DataContext as TimerViewModelBase)?.Start();
  25. }
  26. }
  27. class Simu_SunWayEfemViewModel : 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 bool _VAC;
  94. [IgnorePropertyChange]
  95. public bool VAC
  96. {
  97. get
  98. {
  99. return _VAC;
  100. }
  101. set
  102. {
  103. _VAC = value;
  104. _sim.SetVAC(_VAC);
  105. }
  106. }
  107. private bool _AIR;
  108. [IgnorePropertyChange]
  109. public bool AIR
  110. {
  111. get
  112. {
  113. return _AIR;
  114. }
  115. set
  116. {
  117. _AIR = value;
  118. _sim.SetAIR(_AIR);
  119. }
  120. }
  121. private bool _doorOpen1;
  122. public bool DoorOpen1
  123. {
  124. get
  125. {
  126. return _doorOpen1;
  127. }
  128. set
  129. {
  130. _doorOpen1 = value;
  131. _sim.IsDoorOpen1=value;
  132. }
  133. }
  134. private bool _doorOpen2;
  135. public bool DoorOpen2
  136. {
  137. get
  138. {
  139. return _doorOpen2;
  140. }
  141. set
  142. {
  143. _doorOpen2 = value;
  144. _sim.IsDoorOpen2 = value;
  145. }
  146. }
  147. private bool _doorOpen3;
  148. public bool DoorOpen3
  149. {
  150. get
  151. {
  152. return _doorOpen3;
  153. }
  154. set
  155. {
  156. _doorOpen3 = value;
  157. _sim.IsDoorOpen3 = value;
  158. }
  159. }
  160. private SunWayEfemSimulator _sim;
  161. public ICommand ClearCommand { get; set; }
  162. public ICommand SetAllCommand { get; set; }
  163. public ICommand RandomCommand { get; set; }
  164. public ICommand RandomDummyCommand { get; set; }
  165. public Simu_SunWayEfemViewModel() : base("SunWayEfemSimuViewModel")
  166. {
  167. ClearCommand = new DelegateCommand<string>(Clear);
  168. SetAllCommand = new DelegateCommand<string>(SetAll);
  169. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  170. RandomDummyCommand = new DelegateCommand<string>(RandomDummyGenerateWafer);
  171. _sim = new SunWayEfemSimulator();
  172. Init(_sim);
  173. }
  174. private void RandomGenerateWafer(string obj)
  175. {
  176. _sim.RandomWafer();
  177. }
  178. private void RandomDummyGenerateWafer(string obj)
  179. {
  180. _sim.RandomDummyWafer();
  181. }
  182. private void SetAll(string obj)
  183. {
  184. _sim.SetAllWafer();
  185. }
  186. private void Clear(string obj)
  187. {
  188. _sim.ClearWafer();
  189. }
  190. private List<string> _WaferSizeItems = new List<string>() { "200", "300"};
  191. public List<string> WaferSizeItems
  192. {
  193. get
  194. {
  195. return _WaferSizeItems;
  196. }
  197. }
  198. private string _SelectedWaferSize;
  199. public string SelectedWaferSize
  200. {
  201. get
  202. {
  203. return _SelectedWaferSize;
  204. }
  205. set
  206. {
  207. _SelectedWaferSize = value;
  208. _sim.WaferSize =int.Parse(value);
  209. }
  210. }
  211. }
  212. }