ReservoirPump.xaml.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using MECF.Framework.Common.Equipment;
  2. using MECF.Framework.Common.OperationCenter;
  3. using CyberX8_Themes.CustomControls;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics.Eventing.Reader;
  7. using System.Linq;
  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 CyberX8_Themes.UserControls
  20. {
  21. /// <summary>
  22. /// Pump1.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class ReservoirPump : UserControl
  25. {
  26. public ReservoirPump()
  27. {
  28. InitializeComponent();
  29. }
  30. public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
  31. "ModuleName", typeof(string), typeof(ReservoirPump),
  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 PumpTypeProperty = DependencyProperty.Register(
  48. "PumpType", typeof(string), typeof(ReservoirPump),
  49. new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  50. /// <summary>
  51. /// Pump类型
  52. /// </summary>
  53. public string PumpType
  54. {
  55. get
  56. {
  57. return (string)this.GetValue(PumpTypeProperty);
  58. }
  59. set
  60. {
  61. this.SetValue(PumpTypeProperty, value);
  62. }
  63. }
  64. public static readonly DependencyProperty IsOpenPumpProperty = DependencyProperty.Register(
  65. "IsOpenPump", typeof(bool), typeof(ReservoirPump), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
  66. public bool IsOpenPump
  67. {
  68. get { return (bool)this.GetValue(IsOpenPumpProperty); }
  69. set { SetValue(IsOpenPumpProperty, value); }
  70. }
  71. public static readonly DependencyProperty RotateTransformValueProperty = DependencyProperty.Register(
  72. "RotateTransformValue", typeof(int), typeof(ReservoirPump));
  73. public int RotateTransformValue
  74. {
  75. get { return (int)this.GetValue(RotateTransformValueProperty); }
  76. set { this.SetValue(RotateTransformValueProperty, value); }
  77. }
  78. private void OpenClick(object sender, RoutedEventArgs e)
  79. {
  80. //IsOpenPump = true;
  81. if (PumpType.Contains("Replen"))
  82. {
  83. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReplenPumpOn", PumpType);
  84. }
  85. else
  86. {
  87. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{PumpType}On");
  88. }
  89. }
  90. private void CloseClick(object sender, RoutedEventArgs e)
  91. {
  92. //IsOpenPump = false;
  93. if (PumpType.Contains("Replen"))
  94. {
  95. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReplenPumpOff", PumpType);
  96. }
  97. else
  98. {
  99. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{PumpType}Off");
  100. }
  101. }
  102. }
  103. }