| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 | 
							- using MECF.Framework.Common.CommonData.Reservoir;
 
- using MECF.Framework.Common.OperationCenter;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Text.RegularExpressions;
 
- 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;
 
- using static System.Net.Mime.MediaTypeNames;
 
- namespace PunkHPX8_Themes.UserControls
 
- {
 
-     /// <summary>
 
-     /// CrossDoseControl.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class CrossDoseControl : UserControl
 
-     {
 
-         public CrossDoseControl()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         #region 属性       
 
-         public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
 
-               "ModuleName", typeof(string), typeof(CrossDoseControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// ModuleName
 
-         /// </summary>
 
-         public string ModuleName
 
-         {
 
-             get
 
-             {
 
-                 return (string)this.GetValue(ModuleNameProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(ModuleNameProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty ANTransferFlowProperty = DependencyProperty.Register(
 
-               "ANTransferFlow", typeof(double), typeof(CrossDoseControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// ANTransferFlow
 
-         /// </summary>
 
-         public double ANTransferFlow
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(ANTransferFlowProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(ANTransferFlowProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty RemainingFlowProperty = DependencyProperty.Register(
 
-               "RemainingFlow", typeof(double), typeof(CrossDoseControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// RemainingFlow
 
-         /// </summary>
 
-         public double RemainingFlow
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(RemainingFlowProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(RemainingFlowProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty ReservoirDataProperty = DependencyProperty.Register(
 
-               "ReservoirData", typeof(CompactMembranReservoirData), typeof(CrossDoseControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// ReservoirData
 
-         /// </summary>
 
-         public CompactMembranReservoirData ReservoirData
 
-         {
 
-             get
 
-             {
 
-                 return (CompactMembranReservoirData)this.GetValue(ReservoirDataProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(ReservoirDataProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty PumpFactorProperty = DependencyProperty.Register(
 
-               "PumpFactor", typeof(double), typeof(CrossDoseControl), new FrameworkPropertyMetadata(0.000, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// PumpFactor
 
-         /// </summary>
 
-         public double PumpFactor
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(PumpFactorProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(PumpFactorProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty IsCalibrateEnableProperty = DependencyProperty.Register(
 
-               "IsCalibrateEnable", typeof(bool), typeof(CrossDoseControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// IsCalibrateEnable
 
-         /// </summary>
 
-         public bool IsCalibrateEnable
 
-         {
 
-             get
 
-             {
 
-                 return (bool)this.GetValue(IsCalibrateEnableProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(IsCalibrateEnableProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty TargetDosingVolumeProperty = DependencyProperty.Register(
 
-               "TargetDosingVolume", typeof(double), typeof(CrossDoseControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// TargetDosingVolume
 
-         /// </summary>
 
-         public double TargetDosingVolume
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(TargetDosingVolumeProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(TargetDosingVolumeProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty IsAutoModeProperty = DependencyProperty.Register(
 
-               "IsAutoMode", typeof(bool), typeof(CrossDoseControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// IsAutoMode
 
-         /// </summary>
 
-         public bool IsAutoMode
 
-         {
 
-             get
 
-             {
 
-                 return (bool)this.GetValue(IsAutoModeProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(IsAutoModeProperty, value);
 
-             }
 
-         }
 
-         #endregion
 
-         /// <summary>
 
-         /// 手动Dosing开始
 
-         /// </summary>
 
-         /// <param name="sender"></param>
 
-         /// <param name="e"></param>
 
-         private void Start_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             if (requestVolume.Text != "")
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation($"{ModuleName}.StartDosing", double.Parse(requestVolume.Text));
 
-             }
 
-             
 
-         }
 
-         /// <summary>
 
-         /// 手动Dosing停止
 
-         /// </summary>
 
-         /// <param name="sender"></param>
 
-         /// <param name="e"></param>
 
-         private void Halt_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             InvokeClient.Instance.Service.DoOperation($"{ModuleName}.HaltDosing");
 
-         }
 
-         /// <summary>
 
-         /// 计算Pump Factor
 
-         /// </summary>
 
-         /// <param name="sender"></param>
 
-         /// <param name="e"></param>
 
-         private void Calibrate_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             if (!string.IsNullOrEmpty(counterVolume.Text) && !string.IsNullOrEmpty(requestVolume.Text))
 
-             {
 
-                 double request = double.Parse(requestVolume.Text);
 
-                 if (request == 0) return;
 
-                 double pumpFactor = double.Parse(counterVolume.Text) / request;
 
-                 InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPumpFactor", Math.Round(pumpFactor, 3));
 
-             }
 
-             
 
-         }
 
-         /// <summary>
 
-         /// Reset电机
 
-         /// </summary>
 
-         /// <param name="sender"></param>
 
-         /// <param name="e"></param>
 
-         private void Reset_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ResetCrossDose");
 
-         }
 
-         /// <summary>
 
-         /// 输入限制
 
-         /// </summary>
 
-         /// <param name="key"></param>
 
-         /// <param name="text"></param>
 
-         /// <returns></returns>
 
-         private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
 
-         {
 
-             e.Handled = !IsTextAllowed(e.Text, ((TextBox) sender).Text);
 
-         }
 
-         private bool IsTextAllowed(string key, string text)
 
-         {
 
-             Regex regex = new Regex(@"^[0-9\.]+$");
 
-             return regex.IsMatch(key);
 
-         }
 
-        
 
-     }
 
- }
 
 
  |