PufMotionCommandControl.xaml.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. using MECF.Framework.Common.OperationCenter;
  2. using CyberX8_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 System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. namespace CyberX8_Themes.UserControls
  18. {
  19. /// <summary>
  20. /// PufMotionCommandControl.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class PufMotionCommandControl : UserControl
  23. {
  24. public PufMotionCommandControl()
  25. {
  26. InitializeComponent();
  27. }
  28. public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register("ModuleName", typeof(string), typeof(PufMotionCommandControl));
  29. /// <summary>
  30. /// ModuleName
  31. /// </summary>
  32. public string ModuleName
  33. {
  34. get
  35. {
  36. return (string)this.GetValue(ModuleNameProperty);
  37. }
  38. set
  39. {
  40. this.SetValue(ModuleNameProperty, value);
  41. }
  42. }
  43. public static readonly DependencyProperty VacuumAProperty = DependencyProperty.Register( "VacuumA", typeof(bool), typeof(PufMotionCommandControl));
  44. /// <summary>
  45. /// VacuumA
  46. /// </summary>
  47. public bool VacuumA
  48. {
  49. get
  50. {
  51. return (bool)this.GetValue(VacuumAProperty);
  52. }
  53. set
  54. {
  55. this.SetValue(VacuumAProperty, value);
  56. }
  57. }
  58. public static readonly DependencyProperty VacuumBProperty = DependencyProperty.Register("VacuumB", typeof(bool), typeof(PufMotionCommandControl));
  59. /// <summary>
  60. /// VacuumB
  61. /// </summary>
  62. public bool VacuumB
  63. {
  64. get
  65. {
  66. return (bool)this.GetValue(VacuumBProperty);
  67. }
  68. set
  69. {
  70. this.SetValue(VacuumBProperty, value);
  71. }
  72. }
  73. public static readonly DependencyProperty VacuumAValueProperty = DependencyProperty.Register("VacuumAValue", typeof(double), typeof(PufMotionCommandControl));
  74. /// <summary>
  75. /// VacuumAValue
  76. /// </summary>
  77. public double VacuumAValue
  78. {
  79. get
  80. {
  81. return (double)this.GetValue(VacuumAValueProperty);
  82. }
  83. set
  84. {
  85. this.SetValue(VacuumAValueProperty, value);
  86. }
  87. }
  88. public static readonly DependencyProperty VacuumBValueProperty = DependencyProperty.Register("VacuumBValue", typeof(double), typeof(PufMotionCommandControl));
  89. /// <summary>
  90. /// VacuumBValue
  91. /// </summary>
  92. public double VacuumBValue
  93. {
  94. get
  95. {
  96. return (double)this.GetValue(VacuumBValueProperty);
  97. }
  98. set
  99. {
  100. this.SetValue(VacuumBValueProperty, value);
  101. }
  102. }
  103. public static readonly DependencyProperty VacuumACheckedProperty = DependencyProperty.Register("VacuumAChecked", typeof(bool), typeof(PufMotionCommandControl));
  104. /// <summary>
  105. /// VacuumAChecked
  106. /// </summary>
  107. public bool VacuumAChecked
  108. {
  109. get
  110. {
  111. return (bool)this.GetValue(VacuumACheckedProperty);
  112. }
  113. set
  114. {
  115. this.SetValue(VacuumACheckedProperty, value);
  116. }
  117. }
  118. public static readonly DependencyProperty VacuumBCheckedProperty = DependencyProperty.Register("VacuumBChecked", typeof(bool), typeof(PufMotionCommandControl));
  119. /// <summary>
  120. /// VacuumBChecked
  121. /// </summary>
  122. public bool VacuumBChecked
  123. {
  124. get
  125. {
  126. return (bool)this.GetValue(VacuumBCheckedProperty);
  127. }
  128. set
  129. {
  130. this.SetValue(VacuumBCheckedProperty, value);
  131. }
  132. }
  133. #region button 事件
  134. private void AllMotorOn_Click(object sender, RoutedEventArgs e)
  135. {
  136. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.AllMotorOn");
  137. }
  138. private void AllMotorOff_Click(object sender, RoutedEventArgs e)
  139. {
  140. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.AllMotorOff");
  141. }
  142. private void HomePuf_Click(object sender, RoutedEventArgs e)
  143. {
  144. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Home");
  145. }
  146. private void VacuumA_Click(object sender, RoutedEventArgs e)
  147. {
  148. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumAOn", "VacuumAChecked", VacuumAChecked);
  149. }
  150. #endregion
  151. private void VacuumB_Click(object sender, RoutedEventArgs e)
  152. {
  153. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.VacuumBOn", "VacuumBChecked", VacuumBChecked);
  154. }
  155. }
  156. }