123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Utilities;
- using MECF.Framework.Common.CommonData.Prewet;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.Common.Persistent.Prewet;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PunkHPX8_Themes.UserControls
- {
- /// <summary>
- /// VPWBoosterPumpControl.xaml 的交互逻辑
- /// </summary>
- public partial class VPWBoosterPumpControl : UserControl
- {
- public VPWBoosterPumpControl()
- {
- KeyDownCommand = new DelegateCommand<object[]>(KeyDownAction);
- InitializeComponent();
- }
- #region 属性
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
- "ModuleName", typeof(string), typeof(VPWBoosterPumpControl),
- new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// 模块名称
- /// </summary>
- public string ModuleName
- {
- get
- {
- return (string)this.GetValue(ModuleNameProperty);
- }
- set
- {
- this.SetValue(ModuleNameProperty, value);
- }
- }
- public static readonly DependencyProperty StatusValueProperty = DependencyProperty.Register(
- "StatusValue", typeof(string), typeof(VPWBoosterPumpControl),
- new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// StatusValue
- /// </summary>
- public string StatusValue
- {
- get
- {
- return (string)this.GetValue(StatusValueProperty);
- }
- set
- {
- this.SetValue(StatusValueProperty, value);
- }
- }
- public static readonly DependencyProperty InputPumpSpeedProperty = DependencyProperty.Register(
- "InputPumpSpeed", typeof(short), typeof(VPWBoosterPumpControl), new FrameworkPropertyMetadata((short)300, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// InputLowThreshold
- /// </summary>
- public short InputPumpSpeed
- {
- get
- {
- return (short)this.GetValue(InputPumpSpeedProperty);
- }
- set
- {
- this.SetValue(InputPumpSpeedProperty, value);
- }
- }
- public static readonly DependencyProperty PumpEnableProperty = DependencyProperty.Register(
- "PumpEnable", typeof(bool), typeof(VPWBoosterPumpControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// PumpEnable
- /// </summary>
- public bool PumpEnable
- {
- get
- {
- return (bool)this.GetValue(PumpEnableProperty);
- }
- set
- {
- this.SetValue(PumpEnableProperty, value);
- }
- }
- public static readonly DependencyProperty PumpSpeedAutoProperty = DependencyProperty.Register(
- "PumpSpeedAuto", typeof(bool), typeof(VPWBoosterPumpControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// PumpSpeedAuto
- /// </summary>
- public bool PumpSpeedAuto
- {
- get
- {
- return (bool)this.GetValue(PumpSpeedAutoProperty);
- }
- set
- {
- this.SetValue(PumpSpeedAutoProperty, value);
- }
- }
- public static readonly DependencyProperty PressureCurrentProperty = DependencyProperty.Register(
- "PressureCurrent", typeof(double), typeof(VPWBoosterPumpControl), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// "PressureCurrent
- /// </summary>
- public double PressureCurrent
- {
- get
- {
- return (double)this.GetValue(PressureCurrentProperty);
- }
- set
- {
- this.SetValue(PressureCurrentProperty, value);
- }
- }
- #endregion
- [IgnorePropertyChange]
- public ICommand KeyDownCommand
- {
- get;
- private set;
- }
- private void KeyDownAction(object[] param)
- {
- if (param.Length >= 1)
- {
- if (short.TryParse(param[1].ToString(), out short paramValue))
- {
- if (paramValue < 300 || paramValue > 7300)
- {
- MessageBox.Show("qualified values 300 ~ 7300", "Invalid Speed Input", MessageBoxButton.OK, MessageBoxImage.Error);
- }
- else
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.BoosterPumpSpeed", paramValue);
- }
- }
- }
- }
- #region 按钮事件
- private void PumpOff_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.BoosterPumpDisable");
- }
- private void PumpOn_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.BoosterPumpEnable");
- }
- private void Auto_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.BoosterPumpSpeedAuto");
- }
- private void Manual_Click(object sender, RoutedEventArgs e)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.BoosterPumpSpeedManual");
- }
- #endregion
- }
- }
|