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 CyberX8_Themes.UserControls { /// /// WHClampControl.xaml 的交互逻辑 /// public partial class WHClampControl : UserControl { public WHClampControl() { InitializeComponent(); } public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register( "ModuleName", typeof(string), typeof(WHClampControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender)); /// /// 模块名称 /// 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)); /// /// IsWHClamp /// 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)); /// /// IsWHUnclamp /// 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)); /// /// IsButtonEnabled(WHDisconncect) /// 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))); /// /// ClampStatus /// 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; } } } /// /// WH Clamp /// /// /// private void WHClamp_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderClampOn"); } /// /// WH Clamp /// /// /// private void WHUnclamp_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderUnclampOn"); } /// /// WH Disconnect /// /// /// private void WHDisconnect_Click(object sender, RoutedEventArgs e) { InvokeClient.Instance.Service.DoOperation($"{ModuleName}.WaferHolderDisconnect"); } } }