123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Utilities;
- using MECF.Framework.Common.CommonData.PUF;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.Common.Persistent.SRD;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.InteropServices;
- 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>
- /// WaferPresenceControl.xaml 的交互逻辑
- /// </summary>
- public partial class WaferPresenceControl : UserControl
- {
- /// <summary>
- /// 构造函数
- /// </summary>
- public WaferPresenceControl()
- {
- KeyDownCommand = new DelegateCommand<object[]>(KeyDownAction);
- InitializeComponent();
- }
- #region 属性
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
- "ModuleName", typeof(string), typeof(WaferPresenceControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// 模块名称
- /// </summary>
- public string ModuleName
- {
- get
- {
- return (string)this.GetValue(ModuleNameProperty);
- }
- set
- {
- this.SetValue(ModuleNameProperty, value);
- }
- }
- public static readonly DependencyProperty InputLowThresholdProperty = DependencyProperty.Register(
- "InputLowThreshold", typeof(double), typeof(WaferPresenceControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// InputLowThreshold
- /// </summary>
- public double InputLowThreshold
- {
- get
- {
- return (double)this.GetValue(InputLowThresholdProperty);
- }
- set
- {
- this.SetValue(InputLowThresholdProperty, value);
- }
- }
- public static readonly DependencyProperty InputHighThresholdProperty = DependencyProperty.Register(
- "InputHighThreshold", typeof(double), typeof(WaferPresenceControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// InputHighThreshold
- /// </summary>
- public double InputHighThreshold
- {
- get
- {
- return (double)this.GetValue(InputHighThresholdProperty);
- }
- set
- {
- this.SetValue(InputHighThresholdProperty, value);
- }
- }
- public static readonly DependencyProperty InputEmptyThresholdProperty = DependencyProperty.Register(
- "InputEmptyThreshold", typeof(double), typeof(WaferPresenceControl), new FrameworkPropertyMetadata(0.00, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// InputEmptyThreshold
- /// </summary>
- public double InputEmptyThreshold
- {
- get
- {
- return (double)this.GetValue(InputEmptyThresholdProperty);
- }
- set
- {
- this.SetValue(InputEmptyThresholdProperty, value);
- }
- }
- public static readonly DependencyProperty PersistentValueProperty = DependencyProperty.Register(
- "PersistentValue", typeof(SRDPersistentValue), typeof(WaferPresenceControl), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnItemsSourceChanged)));
- /// <summary>
- /// PersistentValue
- /// </summary>
- public SRDPersistentValue PersistentValue
- {
- get
- {
- return (SRDPersistentValue)this.GetValue(PersistentValueProperty);
- }
- set
- {
- this.SetValue(PersistentValueProperty, value);
- }
- }
- public static readonly DependencyProperty IsWaferPresenceProperty = DependencyProperty.Register(
- "IsWaferPresence", typeof(bool), typeof(WaferPresenceControl), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(OnIsWaferPresenceChanged)));
- /// <summary>
- /// IsWaferPresence
- /// </summary>
- public bool IsWaferPresence
- {
- get
- {
- return (bool)this.GetValue(IsWaferPresenceProperty);
- }
- set
- {
- this.SetValue(IsWaferPresenceProperty, value);
- }
- }
- private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null)
- {
- SRDPersistentValue data = (SRDPersistentValue)e.NewValue;
- d.SetValue(InputHighThresholdProperty, data.WellPlacedHighThreshold);
- d.SetValue(InputLowThresholdProperty, data.WellPlacedLowThreshold);
- d.SetValue(InputEmptyThresholdProperty, data.EmptyThreshold);
- }
- }
- private static void OnIsWaferPresenceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- WaferPresenceControl waferPresenceControl = (WaferPresenceControl)d;
- if (e.NewValue != null)
- {
- bool data = (bool)e.NewValue;
- waferPresenceControl.checkbox1.IsChecked = !data;
- }
- }
- //private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- //{
- // if (e.NewValue != null)
- // {
- // bool data = (bool)e.NewValue;
- // d.SetValue(IsWaferPresenceProperty, data);
- // }
- //}
- #endregion
- [IgnorePropertyChange]
- public ICommand KeyDownCommand
- {
- get;
- private set;
- }
- private void KeyDownAction(object[] param)
- {
- if (param.Length >= 2)
- {
- if (double.TryParse(param[1].ToString(), out double paramValue))
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.KeyDown", param[0].ToString(), paramValue);
- }
- }
- }
- private void CheckBox_Click(object sender, RoutedEventArgs e)
- {
- CheckBox checkBox = (sender as CheckBox);
- if (string.IsNullOrEmpty(ModuleName)) return;
- if ((bool)checkBox.IsChecked)
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.UpdateIsWaferPresenceAction", false);
- }
- else
- {
- InvokeClient.Instance.Service.DoOperation($"{ModuleName}.UpdateIsWaferPresenceAction", true);
- }
-
- }
- }
- }
|