VPWMainStateControl.xaml.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using MECF.Framework.Common.OperationCenter;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace PunkHPX8_Themes.UserControls
  17. {
  18. /// <summary>
  19. /// VPWMainStateControl.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class VPWMainStateControl : UserControl
  22. {
  23. public VPWMainStateControl()
  24. {
  25. InitializeComponent();
  26. }
  27. public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
  28. "ModuleName", typeof(string), typeof(VPWMainStateControl),
  29. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  30. /// <summary>
  31. /// 模块名称
  32. /// </summary>
  33. public string ModuleName
  34. {
  35. get
  36. {
  37. return (string)this.GetValue(ModuleNameProperty);
  38. }
  39. set
  40. {
  41. this.SetValue(ModuleNameProperty, value);
  42. }
  43. }
  44. public static readonly DependencyProperty MachineStateProperty = DependencyProperty.Register(
  45. "MachineState", typeof(string), typeof(VPWMainStateControl),
  46. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  47. /// <summary>
  48. /// MachineState
  49. /// </summary>
  50. public string MachineState
  51. {
  52. get
  53. {
  54. return (string)this.GetValue(MachineStateProperty);
  55. }
  56. set
  57. {
  58. this.SetValue(MachineStateProperty, value);
  59. }
  60. }
  61. public static readonly DependencyProperty FluidInContainmentProperty = DependencyProperty.Register(
  62. "FluidInContainment", typeof(bool), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  63. /// <summary>
  64. /// FluidInContainment
  65. /// </summary>
  66. public bool FluidInContainment
  67. {
  68. get
  69. {
  70. return (bool)this.GetValue(FluidInContainmentProperty);
  71. }
  72. set
  73. {
  74. this.SetValue(FluidInContainmentProperty, value);
  75. }
  76. }
  77. public static readonly DependencyProperty WaterPressureProperty = DependencyProperty.Register(
  78. "WaterPressure", typeof(double), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  79. /// <summary>
  80. /// WaterPressure
  81. /// </summary>
  82. public double WaterPressure
  83. {
  84. get
  85. {
  86. return (double)this.GetValue(WaterPressureProperty);
  87. }
  88. set
  89. {
  90. this.SetValue(WaterPressureProperty, value);
  91. }
  92. }
  93. public static readonly DependencyProperty PressureTargetProperty = DependencyProperty.Register(
  94. "PressureTarget", typeof(double), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
  95. /// <summary>
  96. /// PressureTarget
  97. /// </summary>
  98. public double PressureTarget
  99. {
  100. get
  101. {
  102. return (double)this.GetValue(PressureTargetProperty);
  103. }
  104. set
  105. {
  106. this.SetValue(PressureTargetProperty, value);
  107. }
  108. }
  109. public static readonly DependencyProperty DIWInletValveOpenProperty = DependencyProperty.Register(
  110. "DIWInletValveOpen", typeof(bool), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  111. /// <summary>
  112. /// DIWInletValveOpen
  113. /// </summary>
  114. public bool DIWInletValveOpen
  115. {
  116. get
  117. {
  118. return (bool)this.GetValue(DIWInletValveOpenProperty);
  119. }
  120. set
  121. {
  122. this.SetValue(DIWInletValveOpenProperty, value);
  123. }
  124. }
  125. public static readonly DependencyProperty ChamberOpenProperty = DependencyProperty.Register(
  126. "ChamberOpen", typeof(bool), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  127. /// <summary>
  128. /// ChamberOpen
  129. /// </summary>
  130. public bool ChamberOpen
  131. {
  132. get
  133. {
  134. return (bool)this.GetValue(ChamberOpenProperty);
  135. }
  136. set
  137. {
  138. this.SetValue(ChamberOpenProperty, value);
  139. }
  140. }
  141. public static readonly DependencyProperty ChamberCloseProperty = DependencyProperty.Register(
  142. "ChamberClose", typeof(bool), typeof(VPWMainStateControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
  143. /// <summary>
  144. /// ChamberClose
  145. /// </summary>
  146. public bool ChamberClose
  147. {
  148. get
  149. {
  150. return (bool)this.GetValue(ChamberCloseProperty);
  151. }
  152. set
  153. {
  154. this.SetValue(ChamberCloseProperty, value);
  155. }
  156. }
  157. private void DIWInletValveOpen_Click(object sender, RoutedEventArgs e)
  158. {
  159. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DIWInletValveOn");
  160. }
  161. private void DIWInletValveClose_Click(object sender, RoutedEventArgs e)
  162. {
  163. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.DIWInletValveOff");
  164. }
  165. private void ChamberOpen_Click(object sender, RoutedEventArgs e)
  166. {
  167. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ChamberUp");
  168. }
  169. private void ChamberClose_Click(object sender, RoutedEventArgs e)
  170. {
  171. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ChamberDown");
  172. }
  173. }
  174. }