| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 | 
							- using MECF.Framework.Common.Equipment;
 
- 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 CyberX8_Themes.UserControls
 
- {
 
-     /// <summary>
 
-     /// PrewetMotionPanel.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class PrewetMotionPanel : UserControl
 
-     {
 
-         public PrewetMotionPanel()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         #region 属性
 
-         public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
 
-             "ModuleName", typeof(string), typeof(PrewetMotionPanel),
 
-                 new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// 模块名称
 
-         /// </summary>
 
-         public string ModuleName
 
-         {
 
-             get
 
-             {
 
-                 return (string)this.GetValue(ModuleNameProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(ModuleNameProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty LinmotNameProperty = DependencyProperty.Register(
 
-             "LinmotName", typeof(string), typeof(PrewetMotionPanel),
 
-                 new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// LinmotName
 
-         /// </summary>
 
-         public string LinmotName
 
-         {
 
-             get
 
-             {
 
-                 return (string)this.GetValue(LinmotNameProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(LinmotNameProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty InputScanTimesProperty = DependencyProperty.Register(
 
-           "InputScanTimes", typeof(int), typeof(PrewetMotionPanel), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// InputScanTimes
 
-         /// </summary>
 
-         public int InputScanTimes
 
-         {
 
-             get
 
-             {
 
-                 return (int)this.GetValue(InputScanTimesProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(InputScanTimesProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty CurrentScanedTimesProperty = DependencyProperty.Register(
 
-             "CurrentScanedTimes", typeof(int), typeof(PrewetMotionPanel), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         /// ScanedTimes
 
-         /// </summary>
 
-         public int CurrentScanedTimes
 
-         {
 
-             get
 
-             {
 
-                 return (int)this.GetValue(CurrentScanedTimesProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(CurrentScanedTimesProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty ScanSpeedProperty = DependencyProperty.Register(
 
-             "ScanSpeed", typeof(double), typeof(PrewetMotionPanel), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         ///  ScanSpeed
 
-         /// </summary>
 
-         public double ScanSpeed
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(ScanSpeedProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(ScanSpeedProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty LinMotErrorProperty = DependencyProperty.Register(
 
-            " LinMotError", typeof(double), typeof(PrewetMotionPanel), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         ///  LinMotError
 
-         /// </summary>
 
-         public double LinMotError
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(LinMotErrorProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(LinMotErrorProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty LinmotWarningProperty = DependencyProperty.Register(
 
-            " LinmotWarning", typeof(double), typeof(PrewetMotionPanel), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         /// <summary>
 
-         ///  LinmotWarning
 
-         /// </summary>
 
-         public double LinmotWarning
 
-         {
 
-             get
 
-             {
 
-                 return (double)this.GetValue(LinmotWarningProperty);
 
-             }
 
-             set
 
-             {
 
-                 this.SetValue(LinmotWarningProperty, value);
 
-             }
 
-         }
 
-         public static readonly DependencyProperty StatusWordProperty = DependencyProperty.Register("StatusWord", typeof(short), typeof(PrewetMotionPanel),
 
-          new FrameworkPropertyMetadata((short)0, new PropertyChangedCallback(StatusWordPropertyChangedCallBack)));
 
-         /// <summary>
 
-         /// 状态字
 
-         /// </summary>
 
-         public short StatusWord
 
-         {
 
-             get { return (short)this.GetValue(StatusWordProperty); }
 
-             set
 
-             {
 
-                 this.SetValue(StatusWordProperty, value);
 
-             }
 
-         }
 
-         private static void StatusWordPropertyChangedCallBack(DependencyObject d, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             short statusWord = (short)e.NewValue;
 
-             d.SetValue(ReadyProperty, (statusWord & 0x01) == 1);
 
-             d.SetValue(DisableProperty, (statusWord & 0b0100) >> 2 == 0);
 
-             d.SetValue(ErrorProperty, ((statusWord & 0b01000) >> 3 == 1) || ((statusWord & 0b01000000000000) >> 12 == 1));
 
-             d.SetValue(InitProperty, (statusWord & 0b0100000000000) >> 11 == 1);
 
-             d.SetValue(RunProperty, (statusWord & 0b010000000000000) >> 13 == 1);
 
-         }
 
-         public static readonly DependencyProperty ReadyProperty = DependencyProperty.Register("Ready", typeof(bool), typeof(PrewetMotionPanel),
 
- new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         public bool Ready
 
-         {
 
-             get { return (bool)this.GetValue(ReadyProperty); }
 
-             set { SetValue(ReadyProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty DisableProperty = DependencyProperty.Register("Disable", typeof(bool), typeof(PrewetMotionPanel),
 
-         new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         public bool Disable
 
-         {
 
-             get { return (bool)this.GetValue(DisableProperty); }
 
-             set { SetValue(DisableProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty RunProperty = DependencyProperty.Register("Run", typeof(bool), typeof(PrewetMotionPanel),
 
-         new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         public bool Run
 
-         {
 
-             get { return (bool)this.GetValue(RunProperty); }
 
-             set { SetValue(RunProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty ErrorProperty = DependencyProperty.Register("Error", typeof(bool), typeof(PrewetMotionPanel),
 
-         new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         public bool Error
 
-         {
 
-             get { return (bool)this.GetValue(ErrorProperty); }
 
-             set { SetValue(ErrorProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty InitProperty = DependencyProperty.Register("Init", typeof(bool), typeof(PrewetMotionPanel),
 
-         new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
 
-         public bool Init
 
-         {
 
-             get { return (bool)this.GetValue(InitProperty); }
 
-             set { SetValue(InitProperty, value); }
 
-         }
 
-         #endregion
 
-         private void Start_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             if (InputScanTimes <= 0)
 
-             {
 
-                 MessageBox.Show("Current ScanTimes Error!", $"Current ScanTimes is {InputScanTimes}", MessageBoxButton.OK, MessageBoxImage.Error);
 
-             }
 
-             else
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation($"{LinmotName}.StartPosition", InputScanTimes);
 
-             }
 
-         }
 
-         private void Stop_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             InvokeClient.Instance.Service.DoOperation($"{LinmotName}.Stop");
 
-         }
 
-     }
 
- }
 
 
  |