| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 | 
							- using OpenSEMI.ClientBase;
 
- 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.Animation;
 
- using System.Windows.Media.Imaging;
 
- using System.Windows.Navigation;
 
- using System.Windows.Shapes;
 
- using Venus_Core;
 
- using OpenSEMI.Ctrlib.Controls;
 
- using System.Diagnostics;
 
- using System.IO;
 
- namespace Venus_Themes.UserControls
 
- {
 
-     /// <summary>
 
-     /// VceControl.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class VceControl : UserControl
 
-     {
 
-         public VceControl()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         //Wafer信息
 
-         public double TransformData
 
-         {
 
-             get { return (double)GetValue(TransformDataProperty); }
 
-             set { SetValue(TransformDataProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty TransformDataProperty =
 
-         DependencyProperty.Register("TransformData", typeof(double), typeof(VceControl), new UIPropertyMetadata(null));
 
-         public List<WaferInfo> UnitData2
 
-         {
 
-             get { return (List<WaferInfo>)GetValue(UnitData2Property); }
 
-             set { SetValue(UnitData2Property, value); }
 
-         }
 
-         public static readonly DependencyProperty UnitData2Property =
 
-             DependencyProperty.Register("UnitData2", typeof(List<WaferInfo>), typeof(VceControl), new PropertyMetadata(null,FoupWafer));
 
-         public static void FoupWafer(DependencyObject d, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             if (d is VceControl vceControl)
 
-             {
 
-                 List<WaferInfo> UnitData = ((List<WaferInfo>)e.NewValue);
 
-                 foreach (WaferInfo item in UnitData)
 
-                 {
 
-                     if (item.WaferStatus == 1)
 
-                     {
 
-                         vceControl.vceFoupAndWafer.Children.Add(VceWaferNames[item.SlotID]);
 
-                     }
 
-                     else
 
-                     {
 
-                         vceControl.vceFoupAndWafer.Children.Remove(VceWaferNames[item.SlotID]);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         public bool ShowTitle1
 
-         {
 
-             get { return (bool)GetValue(ShowTitle1Property); }
 
-             set { SetValue(ShowTitle1Property, value); }
 
-         }
 
-         public static readonly DependencyProperty ShowTitle1Property =
 
-             DependencyProperty.Register("ShowTitle1", typeof(bool), typeof(VceControl), new UIPropertyMetadata(true));
 
-         private void Slot_SlotMouseButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             VenusGlobalEvents.OnSlotRightClickChanged(sender as Slot);
 
-         }
 
-         private void Slot_WaferTransferStarted(object sender, DragDropEventArgs e)
 
-         {
 
-             try
 
-             {
 
-                 VenusGlobalEvents.OnSlotWaferTransfer(e);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 Trace.WriteLine(ex);
 
-             }
 
-         }
 
-         //画Foup
 
-         private void foup_Loaded(object sender, RoutedEventArgs e)
 
-         {
 
-             if (UnitData2 != null)
 
-             {
 
-                 DrawFoup();
 
-             }
 
-         }
 
-         //支撑底柱高度
 
-         public static readonly DependencyProperty PositionZProperty = DependencyProperty.Register(
 
-         "PositionZ", typeof(double), typeof(VceControl));
 
-         public double PositionZ
 
-         {
 
-             get { return (double)GetValue(PositionZProperty); }
 
-             set
 
-             {
 
-                 SetValue(PositionZProperty, value);
 
-             }
 
-         }
 
-         //是否开门
 
-         public static readonly DependencyProperty VceDoorIsOpenProperty = DependencyProperty.Register(
 
-             "VceDoorIsOpen", typeof(bool), typeof(VceControl));
 
-         public bool VceDoorIsOpen
 
-         {
 
-             get { return (bool)this.GetValue(VceDoorIsOpenProperty); }
 
-             set { SetValue(VceDoorIsOpenProperty, value); }
 
-         }
 
-         //槽口位置
 
-         public int CurrentSlot
 
-         {
 
-             get { return (int)GetValue(CurrentSlotProperty); }
 
-             set { SetValue(CurrentSlotProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty CurrentSlotProperty =
 
-             DependencyProperty.Register("CurrentSlot", typeof(int), typeof(VceControl), new PropertyMetadata(SelectWafer));
 
-         //通过监听Slot值的变化改变wafer样式与Foup移动
 
-         private static Image[] VceWaferNames = new Image[25];
 
-         public static void SelectWafer(DependencyObject d, DependencyPropertyChangedEventArgs e)
 
-         {
 
-             if (d is VceControl vceControl)
 
-             {
 
-                 if (Convert.ToInt32(e.NewValue) >= 0 && Convert.ToInt32(e.OldValue) >= 0)
 
-                 {
 
-                     VceWaferNames[(int)e.NewValue].Source = new BitmapImage(new Uri(@"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/WaferSelected.png", UriKind.RelativeOrAbsolute));
 
-                     VceWaferNames[(int)e.OldValue].Source = new BitmapImage(new Uri(@"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/Wafer.png", UriKind.RelativeOrAbsolute));
 
-                     DoubleAnimation floatY = new DoubleAnimation(
 
-                     430 - 7 * (25 - (int)e.NewValue),
 
-                     TimeSpan.FromSeconds(3)
 
-                     );
 
-                     vceControl.Foup.BeginAnimation(Canvas.TopProperty, floatY);
 
-                 }
 
-                 else if (Convert.ToInt32(e.NewValue) >= 0 && Convert.ToInt32(e.OldValue) < 0)
 
-                 {
 
-                     VceWaferNames[(int)e.NewValue].Source = new BitmapImage(new Uri(@"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/WaferSelected.png", UriKind.RelativeOrAbsolute));
 
-                     DoubleAnimation floatY = new DoubleAnimation(
 
-                         430 - 7 * (25 - (int)e.NewValue),
 
-                         TimeSpan.FromSeconds(3)
 
-                         );
 
-                     vceControl.Foup.BeginAnimation(Canvas.TopProperty, floatY);
 
-                 }
 
-                 else if (Convert.ToInt32(e.NewValue) < 0 && Convert.ToInt32(e.OldValue) > 0)
 
-                 {
 
-                     VceWaferNames[(int)e.OldValue].Source = new BitmapImage(new Uri(@"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/Wafer.png", UriKind.RelativeOrAbsolute));
 
-                     DoubleAnimation floatY = new DoubleAnimation(
 
-                         430,
 
-                         TimeSpan.FromSeconds(3)
 
-                     );
 
-                     vceControl.Foup.BeginAnimation(Canvas.TopProperty, floatY);
 
-                 }
 
-             }
 
-         }
 
-         private Image CreateImage(string ImagePath, int ImageHeight)
 
-         {
 
-             Image VceImage = new Image();
 
-             VceImage.Height = ImageHeight;
 
-             //BitmapImage myBitmapImage = new BitmapImage();
 
-             //myBitmapImage.BeginInit();
 
-             //myBitmapImage.BaseUri = new Uri(ImagePath);
 
-             //myBitmapImage.DecodePixelHeight = ImageHeight;
 
-             //myBitmapImage.EndInit();
 
-             //set image source
 
-             VceImage.Source = new BitmapImage(new Uri(ImagePath)); ;
 
-             return VceImage;
 
-         }
 
-         private void DrawFoup()
 
-         {
 
-             double CanvasTop1 = -7;
 
-             double CanvasTop2 = 0;
 
-             double CanvasTop3 = -2;
 
-             int ZIndex = 98;
 
-             foreach (WaferInfo item in UnitData2)
 
-             {
 
-                 //Console.WriteLine(item);
 
-                 //text
 
-                 TextBlock SlotIndex = new TextBlock()
 
-                 {
 
-                     Background = new SolidColorBrush(Colors.Black),
 
-                     FontSize = 10,
 
-                     Width = 10,
 
-                     Foreground = new SolidColorBrush(Colors.White),
 
-                     TextWrapping = TextWrapping.Wrap,
 
-                     HorizontalAlignment = HorizontalAlignment.Center,
 
-                     TextAlignment = TextAlignment.Center,
 
-                     Padding = new Thickness(5),
 
-                     LineHeight = 5
 
-                 };
 
-                 SlotIndex.Text = item.SlotIndex + "";
 
-                 Canvas.SetLeft(SlotIndex, -50);
 
-                 Canvas.SetTop(SlotIndex, CanvasTop3);
 
-                 CanvasTop3 = CanvasTop3 + 5;
 
-                 Canvas.SetZIndex(SlotIndex, 98);//显示层级
 
-                 //Fuop pack://application:,,,/
 
-                 string ImagePath1 = "pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/Foup1.png";
 
-                 Image VceControl = CreateImage(ImagePath1, 49);
 
-                 Canvas canvas1 = new Canvas();
 
-                 CanvasTop1 = CanvasTop1 + 7;
 
-                 canvas1.Children.Add(VceControl);
 
-                 Canvas.SetZIndex(canvas1, ZIndex--);//显示层级
 
-                 Canvas.SetLeft(canvas1, -25);
 
-                 Canvas.SetTop(canvas1, CanvasTop1);
 
-                 canvas1.Opacity = 0.7;
 
-                 vceFoupAndWafer.Children.Add(canvas1);
 
-                 //Boder
 
-                 Border border = new Border()
 
-                 {
 
-                     Width = 7.5,
 
-                     Height = 7.5,
 
-                     BorderThickness = new Thickness(1),
 
-                     BorderBrush = new SolidColorBrush(Colors.Blue),
 
-                     Background = new SolidColorBrush(Colors.White),
 
-                     HorizontalAlignment = HorizontalAlignment.Center,
 
-                     VerticalAlignment = VerticalAlignment.Center
 
-                 };
 
-                 Canvas.SetZIndex(border, ZIndex--);//显示层级
 
-                 Canvas.SetLeft(border, -25);
 
-                 Canvas.SetTop(border, CanvasTop3);
 
-                 CanvasTop3 = CanvasTop3 + 7.5;
 
-                 //Wafer
 
-                 string ImagePath2 = @"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/Wafer.png";
 
-                 VceWaferNames[item.SlotID] = (CreateImage(ImagePath2, 40));
 
-                 Canvas.SetTop(VceWaferNames[item.SlotID], CanvasTop2);
 
-                 CanvasTop2 = CanvasTop1+5;
 
-                 Canvas.SetZIndex(VceWaferNames[item.SlotID], ZIndex + 2);//显示层级
 
-                 Canvas.SetLeft(VceWaferNames[item.SlotID], -7);
 
-                 if (item.WaferStatus > 0 )
 
-                 {
 
-                     vceFoupAndWafer.Children.Add(VceWaferNames[item.SlotID]);
 
-                 }
 
-                 else
 
-                 {
 
-                     vceFoupAndWafer.Children.Remove(VceWaferNames[item.SlotID]);
 
-                 }
 
-             }
 
-             //FoupCover
 
-             string ImagePath3 = @"pack://application:,,,/Venus_Themes;component/Themes/Images/parts/vce/Foup2.png";
 
-             System.Windows.Controls.Image FoupCover = CreateImage(ImagePath3, 49);
 
-             Canvas canvas2 = new Canvas();
 
-             canvas2.Children.Add(FoupCover);
 
-             Canvas.SetZIndex(canvas2, 99);//显示层级
 
-             Canvas.SetLeft(canvas2, -25);
 
-             Canvas.SetTop(canvas2, -17);
 
-             canvas2.Opacity = .5;
 
-             vceFoupAndWafer.Children.Add(canvas2);
 
-         }
 
-         private string getimageURI(string directoryPath)
 
-         {
 
-             var startupPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
 
-             string dir = System.IO.Path.GetDirectoryName(startupPath);
 
-             var ret = System.IO.Path.Combine(dir, directoryPath);
 
-             if (!ret.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
 
-                 ret = ret + System.IO.Path.DirectorySeparatorChar;
 
-             if (!Directory.Exists(ret))
 
-                 Directory.CreateDirectory(ret);
 
-             return ret;
 
-         }
 
-     }
 
- }
 
 
  |