| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 | using MECF.Framework.Common.Equipment;using MECF.Framework.Common.OperationCenter;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>    /// WHClampControl.xaml 的交互逻辑    /// </summary>    public partial class WHClampControl : UserControl    {        public WHClampControl()        {            InitializeComponent();        }        public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(          "ModuleName", typeof(string), typeof(WHClampControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// 模块名称        /// </summary>        public string ModuleName        {            get            {                return (string)this.GetValue(ModuleNameProperty);            }            set            {                this.SetValue(ModuleNameProperty, value);            }        }        public static readonly DependencyProperty IsWHClampProperty = DependencyProperty.Register(            "IsWHClamp", typeof(bool), typeof(WHClampControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// IsWHClamp        /// </summary>        public bool IsWHClamp        {            get            {                return (bool)this.GetValue(IsWHClampProperty);            }            set            {                this.SetValue(IsWHClampProperty, value);            }        }        public static readonly DependencyProperty IsWHUnclampProperty = DependencyProperty.Register(            "IsWHUnclamp", typeof(bool), typeof(WHClampControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// IsWHUnclamp        /// </summary>        public bool IsWHUnclamp        {            get            {                return (bool)this.GetValue(IsWHUnclampProperty);            }            set            {                this.SetValue(IsWHUnclampProperty, value);            }        }        public static readonly DependencyProperty IsButtonEnabledProperty = DependencyProperty.Register(            "IsButtonEnabled", typeof(bool), typeof(WHClampControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// IsButtonEnabled(WHDisconncect)        /// </summary>        public bool IsButtonEnabled        {            get            {                return (bool)this.GetValue(IsButtonEnabledProperty);            }            set            {                this.SetValue(IsButtonEnabledProperty, value);            }        }        public static readonly DependencyProperty ClampStatusProperty = DependencyProperty.Register(           "ClampStatus", typeof(string), typeof(WHClampControl), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnItemsSourceChanged)));        /// <summary>        /// ClampStatus        /// </summary>        public string ClampStatus        {            get            {                return (string)this.GetValue(ClampStatusProperty);            }            set            {                this.SetValue(ClampStatusProperty, value);            }        }        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)        {            if (e.NewValue != null)            {                string currentMode = (string)e.NewValue;                switch (currentMode)                {                    case "Clamped":                        d.SetValue(IsWHClampProperty, true);                        d.SetValue(IsWHUnclampProperty, false); break;                    case "Unclamped":                        d.SetValue(IsWHClampProperty, false);                        d.SetValue(IsWHUnclampProperty, true); break;                    case "Disconnect":                        d.SetValue(IsWHClampProperty, false);                        d.SetValue(IsWHUnclampProperty, false); break;                    default:                        break;                }            }        }        /// <summary>        /// WH Clamp        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void WHClamp_Click(object sender, RoutedEventArgs e)        {            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderClampOn");        }        /// <summary>        /// WH Clamp        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void WHUnclamp_Click(object sender, RoutedEventArgs e)        {            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderUnclampOn");        }        /// <summary>        /// WH Disconnect        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void WHDisconnect_Click(object sender, RoutedEventArgs e)        {            InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderDisconnect");        }    }}
 |