| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 | using MECF.Framework.Common.OperationCenter;using MECF.Framework.Common.SubstrateTrackings;using MECF.Framework.UI.Client.Annotations;using System;using System.ComponentModel;using System.Runtime.CompilerServices;using System.Windows;using System.Windows.Controls;using System.Windows.Media;using System.Windows.Media.Animation;namespace FurnaceUI.Controls.Parts{    /// <summary>    /// CassetteView.xaml 的交互逻辑    /// </summary>    public partial class CassetteViewV2 : UserControl, INotifyPropertyChanged    {        public bool DiSensorValue        {            get { return (bool)GetValue(DiSensorValueProperty); }            set { SetValue(DiSensorValueProperty, value); }        }        public static readonly DependencyProperty DiSensorValueProperty =            DependencyProperty.Register("DiSensorValue", typeof(bool), typeof(CassetteViewV2), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));        public string CarrierModule        {            get { return (string)GetValue(CarrierModuleProperty); }            set            {                SetValue(CarrierModuleProperty, value);            }        }        public static readonly DependencyProperty CarrierModuleProperty =            DependencyProperty.Register("CarrierModule", typeof(string), typeof(CassetteViewV2), new PropertyMetadata("System"));        public int CarrierSlot        {            get { return (int)GetValue(CarrierSlotProperty); }            set            {                SetValue(CarrierSlotProperty, value);            }        }        public static readonly DependencyProperty CarrierSlotProperty =            DependencyProperty.Register("CarrierSlot", typeof(int), typeof(CassetteViewV2), new PropertyMetadata(0));        public CarrierInfo CarrierData        {            get { return (CarrierInfo)GetValue(CarrierDataProperty); }            set            {                SetValue(CarrierDataProperty, value);            }        }        public static readonly DependencyProperty CarrierDataProperty =            DependencyProperty.Register("CarrierData", typeof(CarrierInfo), typeof(CassetteViewV2), new PropertyMetadata(new CarrierInfo(1), CarrierDataChangedCallback));        public string CassetteType        {            get { return (string)GetValue(CassetteTypeProperty); }            set            {                SetValue(CassetteTypeProperty, value);            }        }        // Using a DependencyProperty as the backing store for CassetteType.  This enables animation, styling, binding, etc...        public static readonly DependencyProperty CassetteTypeProperty =            DependencyProperty.Register("CassetteType", typeof(string), typeof(CassetteViewV2), new PropertyMetadata(""));        public int WaferCount        {            get { return (int)GetValue(WaferCountProperty); }            set            {                SetValue(WaferCountProperty, value);            }        }        // Using a DependencyProperty as the backing store for WaferCount.  This enables animation, styling, binding, etc...        public static readonly DependencyProperty WaferCountProperty =            DependencyProperty.Register("WaferCount", typeof(int), typeof(CassetteViewV2), new PropertyMetadata(0));        public bool  IsEnableOperating        {            get { return (bool )GetValue(IsEnableOperatingProperty); }            set { SetValue(IsEnableOperatingProperty, value); }        }        // Using a DependencyProperty as the backing store for IsEnableOperating.  This enables animation, styling, binding, etc...        public static readonly DependencyProperty IsEnableOperatingProperty =            DependencyProperty.Register("IsEnableOperating", typeof(bool ), typeof(CassetteViewV2), new PropertyMetadata(true));        private string _cassetteStatus;        /// <summary>        /// Foup的状态,如果在Processing中会显示绿色        /// 其他状态根据waferType定义显示颜色        /// </summary>        public string CassetteStatus        {            get { return _cassetteStatus; }            set            {                if (_cassetteStatus != value)                {                    _cassetteStatus = value;                    OnPropertyChanged();                }            }        }        //P(P1,P2),M1(M,M1),M2,SD,ED,V,R(R1,R2),Process        public double oldScale = 0;        public static void CarrierDataChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)        {            var selfView = (CassetteViewV2)d;            var carrierInfo = (CarrierInfo)e.NewValue;            var moduleName = selfView.CarrierModule;        }        public CassetteViewV2()        {            InitializeComponent();        }        public event PropertyChangedEventHandler PropertyChanged;        [NotifyPropertyChangedInvocator]        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)        {            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));        }        public void Filp(int filp, int angle, bool absolute = true, int ms = 0, double accelerationRatio = 0, double decelerationRatio = 0, Action onComplete = null)        {            var storyboard = new Storyboard();            storyboard.Completed += (s, e) => onComplete?.Invoke();            if (Filp(storyboard, filp, angle, absolute, ms, accelerationRatio, decelerationRatio, onComplete))            {                storyboard.Begin();            }            else            {                onComplete?.Invoke();            }        }        public bool Filp(Storyboard storyboard, int filp, int angle, bool absolute = true, int ms = 0, double accelerationRatio = 0, double decelerationRatio = 0, Action onComplete = null)        {            var newScale = 0.5;            if (newScale == oldScale)            {                return false;            }            ScaleTransform scaleTransform = new ScaleTransform();            if (filp == 180)            {                scaleTransform.ScaleX = -1;            }            else            {                scaleTransform.ScaleX = 1;            }            TransformGroup Group = new TransformGroup();            Group.Children.Add(scaleTransform);            tbWaferCount.RenderTransform = Group;            tbWaferCount.RenderTransformOrigin = new Point(0.5, 0.5);            var animation = new DoubleAnimation(oldScale, angle, TimeSpan.FromMilliseconds(ms));            animation.AccelerationRatio = accelerationRatio;            animation.DecelerationRatio = decelerationRatio;            storyboard.Children.Add(animation);            Storyboard.SetTarget(animation, tbWaferCount);            Storyboard.SetTargetProperty(animation, new PropertyPath("RenderTransform.(TransformGroup.Children)[0].(TranslateTransform.X)"));            oldScale = angle;            return true;        }        private void CreateCassette(object sender, RoutedEventArgs e)        {            InvokeClient.Instance.Service.DoOperation("System.CreateCarrier", CarrierModule, 0);        }        private void DeleteCassette(object sender, RoutedEventArgs e)        {            InvokeClient.Instance.Service.DoOperation("System.DeleteCarrier", CarrierModule, 0);        }    }}
 |