123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- using CyberX8_Core;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading;
- 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 System.Windows.Threading;
- namespace CyberX8_Themes.UserControls
- {
- /// <summary>
- /// TransPorterControl.xaml 的交互逻辑
- /// </summary>
- public partial class TransPorterControl : UserControl
- {
- #region 常量
- private const int HEIGHT = 93;
- private const int WAFER_HOLDER_TOP= 60;
- #endregion
- public TransPorterControl()
- {
- InitializeComponent();
- }
- public static readonly DependencyProperty TransPorterNameProperty = DependencyProperty.Register(
- "TransPorterName", typeof(string), typeof(TransPorterControl), new FrameworkPropertyMetadata("Loader TransPorter", FrameworkPropertyMetadataOptions.AffectsRender));
- public string TransPorterName
- {
- get { return this.GetValue(TransPorterNameProperty).ToString(); }
- set { this.SetValue(TransPorterNameProperty, value); }
- }
- public static readonly DependencyProperty WaferHolderVisibleProperty = DependencyProperty.Register(
- "WaferHolderVisible", typeof(bool), typeof(TransPorterControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- public bool WaferHolderVisible
- {
- get { return (bool)this.GetValue(WaferHolderVisibleProperty); }
- set { this.SetValue(WaferHolderVisibleProperty, value); }
- }
- public static readonly DependencyProperty VerticalPositionProperty = DependencyProperty.Register("VerticalPosition", typeof(double),
- typeof(TransPorterControl), new PropertyMetadata((double)93,new PropertyChangedCallback(VerticalPositionPropertyChanged)));
- public double VerticalPosition
- {
- get { return (double)this.GetValue(VerticalPositionProperty); }
- set
- {
- this.SetValue(VerticalPositionProperty, value);
- }
- }
- public static readonly DependencyProperty LiftHolderPositionProperty = DependencyProperty.Register("LiftHolderPosition", typeof(double), typeof(TransPorterControl), new PropertyMetadata((double)93));
- public double LiftHolderPosition
- {
- get { return (double)this.GetValue(LiftHolderPositionProperty); }
- set
- {
- this.SetValue(LiftHolderPositionProperty, value);
- }
- }
- public static readonly DependencyProperty WaferHolderPositionProperty = DependencyProperty.Register("WaferHolderPosition", typeof(double), typeof(TransPorterControl), new PropertyMetadata((double)93));
- public double WaferHolderPosition
- {
- get { return (double)this.GetValue(WaferHolderPositionProperty); }
- set
- {
- this.SetValue(WaferHolderPositionProperty, value);
- }
- }
- public static readonly DependencyProperty IsLoaderTransporterProperty = DependencyProperty.Register(
- "IsLoaderTransporter", typeof(bool), typeof(TransPorterControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- public bool IsLoaderTransporter
- {
- get { return (bool)this.GetValue(IsLoaderTransporterProperty); }
- set { this.SetValue(IsLoaderTransporterProperty, value); }
- }
- public static readonly DependencyProperty IsProcessTransporterProperty = DependencyProperty.Register(
- "IsProcessTransporter", typeof(bool), typeof(TransPorterControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- public bool IsProcessTransporter
- {
- get { return (bool)this.GetValue(IsProcessTransporterProperty); }
- set { this.SetValue(IsProcessTransporterProperty, value); }
- }
- public static readonly DependencyProperty IsWHEnableProperty = DependencyProperty.Register(
- "IsWHEnable", typeof(bool), typeof(TransPorterControl),
- new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// 模块名称
- /// </summary>
- public bool IsWHEnable
- {
- get
- {
- return (bool)this.GetValue(IsWHEnableProperty);
- }
- set
- {
- this.SetValue(IsWHEnableProperty, value);
- }
- }
- /// <summary>
- /// 垂直水平发生变化
- /// </summary>
- /// <param name="d"></param>
- /// <param name="e"></param>
- private static void VerticalPositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if(e.NewValue!=null)
- {
- double newValue = (double)e.NewValue;
- d.SetValue(LiftHolderPositionProperty, newValue - HEIGHT);
- d.SetValue(WaferHolderPositionProperty, newValue + WAFER_HOLDER_TOP);
- }
- }
- private void Canvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- string name = "";
- if("Loader Transporter".Equals(TransPorterName))
- {
- name = "Transporter2Teach";
- }
- if ("Process Transporter".Equals(TransPorterName))
- {
- name = "Transporter1Teach";
- }
- GlobalEvents.OnSwitchFixedTabItem("HardWare", "Transpoters", $"{name}");
- }
- }
- }
|