DMReservoirUIControl.xaml.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. using MECF.Framework.Common.OperationCenter;
  2. using OpenSEMI.ClientBase;
  3. using PunkHPX8_Core;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace PunkHPX8_Themes.UserControls
  20. {
  21. /// <summary>
  22. /// DMReservoirUIControl.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class DMReservoirUIControl : UserControl
  25. {
  26. public DMReservoirUIControl()
  27. {
  28. InitializeComponent();
  29. }
  30. public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
  31. "ModuleName", typeof(string), typeof(DMReservoirUIControl),
  32. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  33. /// <summary>
  34. /// 模块名称
  35. /// </summary>
  36. public string ModuleName
  37. {
  38. get
  39. {
  40. return (string)this.GetValue(ModuleNameProperty);
  41. }
  42. set
  43. {
  44. this.SetValue(ModuleNameProperty, value);
  45. }
  46. }
  47. public static readonly DependencyProperty ANIsolationValveProerty = DependencyProperty.Register(
  48. "ANIsolationValve", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  49. /// <summary>
  50. /// ANIsolationValve
  51. /// </summary>
  52. public bool ANIsolationValve
  53. {
  54. get
  55. {
  56. return (bool)this.GetValue(ANIsolationValveProerty);
  57. }
  58. set
  59. {
  60. this.SetValue(ANIsolationValveProerty, value);
  61. }
  62. }
  63. public static readonly DependencyProperty CAIsolationValveProerty = DependencyProperty.Register(
  64. "CAIsolationValve", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  65. /// <summary>
  66. /// CAIsolationValve
  67. /// </summary>
  68. public bool CAIsolationValve
  69. {
  70. get
  71. {
  72. return (bool)this.GetValue(CAIsolationValveProerty);
  73. }
  74. set
  75. {
  76. this.SetValue(CAIsolationValveProerty, value);
  77. }
  78. }
  79. public static readonly DependencyProperty ReturnFlowValveProerty = DependencyProperty.Register(
  80. "ReturnFlowValve", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  81. /// <summary>
  82. /// ReturnFlowValve
  83. /// </summary>
  84. public bool ReturnFlowValve
  85. {
  86. get
  87. {
  88. return (bool)this.GetValue(ReturnFlowValveProerty);
  89. }
  90. set
  91. {
  92. this.SetValue(ReturnFlowValveProerty, value);
  93. }
  94. }
  95. public static readonly DependencyProperty DegasValveProerty = DependencyProperty.Register(
  96. "DegasValve", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  97. /// <summary>
  98. /// DegasValve
  99. /// </summary>
  100. public bool DegasValve
  101. {
  102. get
  103. {
  104. return (bool)this.GetValue(DegasValveProerty);
  105. }
  106. set
  107. {
  108. this.SetValue(DegasValveProerty, value);
  109. }
  110. }
  111. public static readonly DependencyProperty SampleValveProerty = DependencyProperty.Register(
  112. "SampleValve", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  113. /// <summary>
  114. /// SampleValve
  115. /// </summary>
  116. public bool SampleValve
  117. {
  118. get
  119. {
  120. return (bool)this.GetValue(SampleValveProerty);
  121. }
  122. set
  123. {
  124. this.SetValue(SampleValveProerty, value);
  125. }
  126. }
  127. public static readonly DependencyProperty IsANPumpOpenProerty = DependencyProperty.Register(
  128. "IsANPumpOpen", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  129. /// <summary>
  130. /// IsANPumpOpen
  131. /// </summary>
  132. public bool IsANPumpOpen
  133. {
  134. get
  135. {
  136. return (bool)this.GetValue(IsANPumpOpenProerty);
  137. }
  138. set
  139. {
  140. this.SetValue(IsANPumpOpenProerty, value);
  141. }
  142. }
  143. public static readonly DependencyProperty IsCAPumpOpenProerty = DependencyProperty.Register(
  144. "IsCAPumpOpen", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  145. /// <summary>
  146. /// IsCAPumpOpen
  147. /// </summary>
  148. public bool IsCAPumpOpen
  149. {
  150. get
  151. {
  152. return (bool)this.GetValue(IsCAPumpOpenProerty);
  153. }
  154. set
  155. {
  156. this.SetValue(IsCAPumpOpenProerty, value);
  157. }
  158. }
  159. public static readonly DependencyProperty IsCALevelHighProerty = DependencyProperty.Register(
  160. "IsCALevelHigh", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  161. /// <summary>
  162. ///IsCALevelHigh
  163. /// </summary>
  164. public bool IsCALevelHigh
  165. {
  166. get
  167. {
  168. return (bool)this.GetValue(IsCALevelHighProerty);
  169. }
  170. set
  171. {
  172. this.SetValue(IsCALevelHighProerty, value);
  173. }
  174. }
  175. public static readonly DependencyProperty IsCALevelLowProerty = DependencyProperty.Register(
  176. "IsCALevelLow", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  177. /// <summary>
  178. ///IsCALevelLow
  179. /// </summary>
  180. public bool IsCALevelLow
  181. {
  182. get
  183. {
  184. return (bool)this.GetValue(IsCALevelLowProerty);
  185. }
  186. set
  187. {
  188. this.SetValue(IsCALevelLowProerty, value);
  189. }
  190. }
  191. public static readonly DependencyProperty IsANLevelHighProerty = DependencyProperty.Register(
  192. "IsANLevelHigh", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  193. /// <summary>
  194. ///IsANLevelHigh
  195. /// </summary>
  196. public bool IsANLevelHigh
  197. {
  198. get
  199. {
  200. return (bool)this.GetValue(IsANLevelHighProerty);
  201. }
  202. set
  203. {
  204. this.SetValue(IsANLevelHighProerty, value);
  205. }
  206. }
  207. public static readonly DependencyProperty IsANLevelLowProerty = DependencyProperty.Register(
  208. "IsANLevelLow", typeof(bool), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  209. /// <summary>
  210. ///IsANLevelLow
  211. /// </summary>
  212. public bool IsANLevelLow
  213. {
  214. get
  215. {
  216. return (bool)this.GetValue(IsANLevelLowProerty);
  217. }
  218. set
  219. {
  220. this.SetValue(IsANLevelLowProerty, value);
  221. }
  222. }
  223. public static readonly DependencyProperty ANFlowProperty = DependencyProperty.Register(
  224. "ANFlow", typeof(double), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  225. /// <summary>
  226. /// ANFlow
  227. /// </summary>
  228. public double ANFlow
  229. {
  230. get
  231. {
  232. return (double)this.GetValue(ANFlowProperty);
  233. }
  234. set
  235. {
  236. this.SetValue(ANFlowProperty, value);
  237. }
  238. }
  239. public static readonly DependencyProperty CAFlowProperty = DependencyProperty.Register(
  240. "CAFlow", typeof(double), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  241. /// <summary>
  242. /// CAFlow
  243. /// </summary>
  244. public double CAFlow
  245. {
  246. get
  247. {
  248. return (double)this.GetValue(CAFlowProperty);
  249. }
  250. set
  251. {
  252. this.SetValue(CAFlowProperty, value);
  253. }
  254. }
  255. public static readonly DependencyProperty CALevelProperty = DependencyProperty.Register(
  256. "CALevel", typeof(double), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  257. /// <summary>
  258. /// CALevel
  259. /// </summary>
  260. public double CALevel
  261. {
  262. get
  263. {
  264. return (double)this.GetValue(CALevelProperty);
  265. }
  266. set
  267. {
  268. this.SetValue(CALevelProperty, value);
  269. }
  270. }
  271. public static readonly DependencyProperty CALevelRawProperty = DependencyProperty.Register(
  272. "CALevelRaw", typeof(double), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  273. /// <summary>
  274. /// CALevelRaw
  275. /// </summary>
  276. public double CALevelRaw
  277. {
  278. get
  279. {
  280. return (double)this.GetValue(CALevelRawProperty);
  281. }
  282. set
  283. {
  284. this.SetValue(CALevelRawProperty, value);
  285. }
  286. }
  287. public static readonly DependencyProperty ReservoirTemperatureProperty = DependencyProperty.Register(
  288. "ReservoirTemperature", typeof(double), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  289. /// <summary>
  290. /// ReservoirTemperature
  291. /// </summary>
  292. public double ReservoirTemperature
  293. {
  294. get
  295. {
  296. return (double)this.GetValue(ReservoirTemperatureProperty);
  297. }
  298. set
  299. {
  300. this.SetValue(ReservoirTemperatureProperty, value);
  301. }
  302. }
  303. public static readonly DependencyProperty TCStatusProperty = DependencyProperty.Register(
  304. "TCStatus", typeof(string), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  305. /// <summary>
  306. /// TCStatus
  307. /// </summary>
  308. public string TCStatus
  309. {
  310. get
  311. {
  312. return (string)this.GetValue(TCStatusProperty);
  313. }
  314. set
  315. {
  316. this.SetValue(TCStatusProperty, value);
  317. }
  318. }
  319. public static readonly DependencyProperty TCEnableStatusProperty = DependencyProperty.Register(
  320. "TCEnableStatus", typeof(string), typeof(DMReservoirUIControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  321. /// <summary>
  322. /// TCEnableStatus
  323. /// </summary>
  324. public string TCEnableStatus
  325. {
  326. get
  327. {
  328. return (string)this.GetValue(TCEnableStatusProperty);
  329. }
  330. set
  331. {
  332. this.SetValue(TCEnableStatusProperty, value);
  333. }
  334. }
  335. private void OpenANIsolationValve_Click(object sender, RoutedEventArgs e)
  336. {
  337. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ANIsolationOn");
  338. }
  339. private void CloseANIsolationValve_Click(object sender, RoutedEventArgs e)
  340. {
  341. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ANIsolationOff");
  342. }
  343. private void OpenCAIsolationValve_Click(object sender, RoutedEventArgs e)
  344. {
  345. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CAIsolationOn");
  346. }
  347. private void CloseCAIsolationValve_Click(object sender, RoutedEventArgs e)
  348. {
  349. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CAIsolationOff");
  350. }
  351. private void OpenReturnFlowValve_Click(object sender, RoutedEventArgs e)
  352. {
  353. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReturnValveOn");
  354. }
  355. private void CloseReturnFlowValve_Click(object sender, RoutedEventArgs e)
  356. {
  357. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReturnValveOff");
  358. }
  359. private void OpenDegasValve_Click(object sender, RoutedEventArgs e)
  360. {
  361. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DegasValveOn");
  362. }
  363. private void CloseDegasValve_Click(object sender, RoutedEventArgs e)
  364. {
  365. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DegasValveOff");
  366. }
  367. private void OpenSampleValve_Click(object sender, RoutedEventArgs e)
  368. {
  369. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SampleOutValveOn");
  370. }
  371. private void CloseSampleValve_Click(object sender, RoutedEventArgs e)
  372. {
  373. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SampleOutValveOff");
  374. }
  375. private void JumpToTCAction(object sender, MouseButtonEventArgs e)
  376. {
  377. GlobalEvents.OnSwitchFixedTabItem("HardWare", "TemperatureController", "TC1");
  378. }
  379. }
  380. }