RecipeRFPressureSettingViewModel.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. using Caliburn.Micro;
  2. using Caliburn.Micro.Core;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using FurnaceUI.Models;
  10. namespace FurnaceUI.Views.Editors
  11. {
  12. public class RecipeRFPressureSettingViewModel : FurnaceUIViewModelBase
  13. {
  14. private string _rfSwitch = "0";
  15. public string RFSwitch
  16. {
  17. get
  18. {
  19. return _rfSwitch;
  20. }
  21. set
  22. {
  23. _rfSwitch = value;
  24. NotifyOfPropertyChange("RFSwitch");
  25. }
  26. }
  27. private string _rfSetPointValue = "0";
  28. public string RFSetPointValue
  29. {
  30. get
  31. {
  32. return _rfSetPointValue;
  33. }
  34. set
  35. {
  36. _rfSetPointValue = value;
  37. NotifyOfPropertyChange("RFSetPointValue");
  38. }
  39. }
  40. private string _c1SetPointValue = "0";
  41. public string C1SetPointValue
  42. {
  43. get
  44. {
  45. return _c1SetPointValue;
  46. }
  47. set
  48. {
  49. _c1SetPointValue = value;
  50. NotifyOfPropertyChange("C1SetPointValue");
  51. }
  52. }
  53. private string _c2SetPointValue = "0";
  54. public string C2SetPointValue
  55. {
  56. get
  57. {
  58. return _c2SetPointValue;
  59. }
  60. set
  61. {
  62. _c2SetPointValue = value;
  63. NotifyOfPropertyChange("C2SetPointValue");
  64. }
  65. }
  66. private string _c1AlarmWatchSetPointValue = "None";
  67. public string C1AlarmWatchSetPointValue
  68. {
  69. get
  70. {
  71. return _c1AlarmWatchSetPointValue;
  72. }
  73. set
  74. {
  75. _c1AlarmWatchSetPointValue = value;
  76. NotifyOfPropertyChange("C1AlarmWatchSetPointValue");
  77. }
  78. }
  79. private string _c2AlarmWatchSetPointValue = "None";
  80. public string C2AlarmWatchSetPointValue
  81. {
  82. get
  83. {
  84. return _c2AlarmWatchSetPointValue;
  85. }
  86. set
  87. {
  88. _c2AlarmWatchSetPointValue = value;
  89. NotifyOfPropertyChange("C2AlarmWatchSetPointValue");
  90. }
  91. }
  92. private string _forwardPowerAlarmWatchSetPointValue = "None";
  93. public string ForwardPowerAlarmWatchSetPointValue
  94. {
  95. get
  96. {
  97. return _forwardPowerAlarmWatchSetPointValue;
  98. }
  99. set
  100. {
  101. _forwardPowerAlarmWatchSetPointValue = value;
  102. NotifyOfPropertyChange("ForwardPowerAlarmWatchSetPointValue");
  103. }
  104. }
  105. private string _prAlarmWatchSetPointValue = "None";
  106. public string PrAlarmWatchSetPointValue
  107. {
  108. get
  109. {
  110. return _prAlarmWatchSetPointValue;
  111. }
  112. set
  113. {
  114. _prAlarmWatchSetPointValue = value;
  115. NotifyOfPropertyChange("PrAlarmWatchSetPointValue");
  116. }
  117. }
  118. private string _pIAlarmWatchSetPointValue = "None";
  119. public string PIAlarmWatchSetPointValue
  120. {
  121. get
  122. {
  123. return _pIAlarmWatchSetPointValue;
  124. }
  125. set
  126. {
  127. _pIAlarmWatchSetPointValue = value;
  128. NotifyOfPropertyChange("PIAlarmWatchSetPointValue");
  129. }
  130. }
  131. private string _vppAlarmWatchWatchSetPointValue = "None";
  132. public string VppAlarmWatchSetPointValue
  133. {
  134. get
  135. {
  136. return _vppAlarmWatchWatchSetPointValue;
  137. }
  138. set
  139. {
  140. _vppAlarmWatchWatchSetPointValue = value;
  141. NotifyOfPropertyChange("VppAlarmWatchSetPointValue");
  142. }
  143. }
  144. private string _vdcAlarmWatchSetPointValue = "None";
  145. public string VdcAlarmWatchSetPointValue
  146. {
  147. get
  148. {
  149. return _vdcAlarmWatchSetPointValue;
  150. }
  151. set
  152. {
  153. _vdcAlarmWatchSetPointValue = value;
  154. NotifyOfPropertyChange("VdcAlarmWatchSetPointValue");
  155. }
  156. }
  157. public string SetPointValue { get; set; }
  158. public string AlarmWatchTableValue { get; set; }
  159. public string RecipeSetPointValue { get; set; }
  160. public bool IsSwitchOnCheck { get; set; }
  161. public bool IsSwitchOffCheck { get; set; }
  162. protected override void OnActivate()
  163. {
  164. base.OnActivate();
  165. IsSwitchOnCheck = RFSwitch == "On" ? true : false;
  166. IsSwitchOffCheck = !IsSwitchOnCheck;
  167. }
  168. public void RFSwitchCmd(string value)
  169. {
  170. IsSwitchOnCheck = value == "On" ? true : false;
  171. IsSwitchOffCheck = !IsSwitchOnCheck;
  172. RFSwitch = value == "On" ? "On" : "Off";
  173. }
  174. public void RFSettingCmd(string value)
  175. {
  176. var windowManager = IoC.Get<IWindowManager>();
  177. RecipeRFPressureSettingValueViewModel recipeRFPressureSettingValueViewModel = new RecipeRFPressureSettingValueViewModel();
  178. recipeRFPressureSettingValueViewModel.SelectPressureValue = RFSetPointValue;
  179. switch (value)
  180. {
  181. case "RF":
  182. recipeRFPressureSettingValueViewModel.SetPointName = "RFPower";
  183. break;
  184. case "C1":
  185. recipeRFPressureSettingValueViewModel.SetPointName = "MatchC1";
  186. break;
  187. case "C2":
  188. recipeRFPressureSettingValueViewModel.SetPointName = "MatchC2";
  189. break;
  190. }
  191. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFPressureSettingValueViewModel, null, "SetPoint Setting"))
  192. {
  193. switch (value)
  194. {
  195. case "RF":
  196. RFSetPointValue = recipeRFPressureSettingValueViewModel.SelectPressureValue;
  197. break;
  198. case "C1":
  199. C1SetPointValue = recipeRFPressureSettingValueViewModel.SelectC1Value;
  200. break;
  201. case "C2":
  202. C2SetPointValue = recipeRFPressureSettingValueViewModel.SelectC2Value;
  203. break;
  204. }
  205. }
  206. }
  207. public void RFAlarmSettingCmd(string value)
  208. {
  209. var windowManager = IoC.Get<IWindowManager>();
  210. RecipeRFAlarmTableSettingViewModel recipeRFAlarmTableSettingViewModel = new RecipeRFAlarmTableSettingViewModel();
  211. switch (value)
  212. {
  213. case "C1 Alarm":
  214. recipeRFAlarmTableSettingViewModel.SetPointName = "C1AlarmWatch";
  215. break;
  216. case "Vpp Alarm":
  217. recipeRFAlarmTableSettingViewModel.SetPointName = "VppAlarmWatch";
  218. break;
  219. case "ForWardPower Alarm":
  220. recipeRFAlarmTableSettingViewModel.SetPointName = "ForwardPowerAlarmWatch";
  221. break;
  222. case "Pr Alarm":
  223. recipeRFAlarmTableSettingViewModel.SetPointName = "PrAlarmWatch";
  224. break;
  225. case "PI Alarm":
  226. recipeRFAlarmTableSettingViewModel.SetPointName = "PIAlarmWatch";
  227. break;
  228. case "C2 Alarm":
  229. recipeRFAlarmTableSettingViewModel.SetPointName = "C2AlarmWatch";
  230. break;
  231. case "Vdc Alarm":
  232. recipeRFAlarmTableSettingViewModel.SetPointName = "VdcAlarmWatch";
  233. break;
  234. }
  235. if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeRFAlarmTableSettingViewModel, null, "SetPoint Setting"))
  236. {
  237. switch (value)
  238. {
  239. case "ForWardPower Alarm":
  240. ForwardPowerAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectForwardPowerValue;
  241. break;
  242. case "Pr Alarm":
  243. PrAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectPrAlarmWatchValue;
  244. break;
  245. case "PI Alarm":
  246. PIAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectPIAlarmWatchValue;
  247. break;
  248. case "C1 Alarm":
  249. C1AlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectC1AlarmValue;
  250. break;
  251. case "C2 Alarm":
  252. C2AlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectC2AlarmValue;
  253. break;
  254. case "Vpp Alarm":
  255. VppAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectVppAlarmWatchValue;
  256. break;
  257. case "Vdc Alarm":
  258. VdcAlarmWatchSetPointValue = recipeRFAlarmTableSettingViewModel.SelectVdcAlarmWatchValue;
  259. break;
  260. }
  261. }
  262. }
  263. public void SaveCmd()
  264. {
  265. ((Window)GetView()).DialogResult = true;
  266. }
  267. public void CloseCmd()
  268. {
  269. ((Window)GetView()).DialogResult = false;
  270. }
  271. }
  272. }