123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- using Aitex.Sorter.Common;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Globalization;
- 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;
- using MECF.Framework.Common.Equipment;
- using Aitex.Core.Common;
- namespace Aitex.Sorter.UI.Controls
- {
- /// <summary>
- /// Foup6.xaml 的交互逻辑
- /// </summary>
- public partial class FoupItemPro : UserControl
- {
- public FoupItemPro()
- {
- InitializeComponent();
- root.DataContext = this;
- Slot.DataContext = this;
- }
- public static readonly DependencyProperty SlotsProperty = DependencyProperty.Register(
- "Slots", typeof(IEnumerable), typeof(FoupItemPro),
- new FrameworkPropertyMetadata(null));
- public Visibility ShowSlotsIndex
- {
- get { return (Visibility)GetValue(ShowSlotsIndexProperty); }
- set { SetValue(ShowSlotsIndexProperty, value); }
- }
- public static readonly DependencyProperty ShowSlotsIndexProperty =
- DependencyProperty.Register("ShowSlotsIndex", typeof(Visibility), typeof(FoupItemPro), new PropertyMetadata(Visibility.Collapsed));
- public int FoupCount
- {
- get { return (int)GetValue(FoupCountProperty); }
- set { SetValue(FoupCountProperty, value); }
- }
- public static readonly DependencyProperty FoupCountProperty =
- DependencyProperty.Register("FoupCount", typeof(int), typeof(FoupItemPro), new PropertyMetadata(8));
- public bool ShowControl
- {
- get { return (bool)GetValue(ShowControlProperty); }
- set
- {
- SetValue(ShowControlProperty, value);
- }
- }
- public static readonly DependencyProperty ShowControlProperty =
- DependencyProperty.Register("ShowControl", typeof(bool), typeof(FoupItemPro), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.None));
- public IEnumerable Slots
- {
- get
- {
- return (IEnumerable)GetValue(SlotsProperty);
- }
- set
- {
- SetValue(SlotsProperty, value);
- }
- }
- public int SlotCount
- {
- get { return (int)GetValue(SlotCountProperty); }
- set { SetValue(SlotCountProperty, value); }
- }
- // Using a DependencyProperty as the backing store for SlotCount. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty SlotCountProperty =
- DependencyProperty.Register("SlotCount", typeof(int), typeof(FoupItemPro), new PropertyMetadata(25));
- public ModuleName Station
- {
- get { return (ModuleName)GetValue(StationProperty); }
- set { SetValue(StationProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Station. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty StationProperty =
- DependencyProperty.Register("Station", typeof(ModuleName), typeof(FoupItemPro), new PropertyMetadata(ModuleName.System));
- public string Title
- {
- get { return (string)GetValue(TitleProperty); }
- set { SetValue(TitleProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty TitleProperty =
- DependencyProperty.Register("Title", typeof(string), typeof(FoupItemPro), new PropertyMetadata(null));
- public ICommand WaferTransferCommand
- {
- get { return (ICommand)GetValue(WaferTransferCommandProperty); }
- set { SetValue(WaferTransferCommandProperty, value); }
- }
- // Using a DependencyProperty as the backing store for WaferMovementCommand. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty WaferTransferCommandProperty =
- DependencyProperty.Register("WaferTransferCommand", typeof(ICommand), typeof(FoupItemPro), new PropertyMetadata(null));
- public ICommand WaferTransferOptionCommand
- {
- get { return (ICommand)GetValue(WaferTransferOptionCommandProperty); }
- set { SetValue(WaferTransferOptionCommandProperty, value); }
- }
- // Using a DependencyProperty as the backing store for WaferTransferOptionCommand. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty WaferTransferOptionCommandProperty =
- DependencyProperty.Register("WaferTransferOptionCommand", typeof(ICommand), typeof(FoupItemPro), new PropertyMetadata(null));
- public LoadPortCarrierMode CarrierMode
- {
- get { return (LoadPortCarrierMode)GetValue(CarrierModeProperty); }
- set { SetValue(CarrierModeProperty, value); }
- }
- // Using a DependencyProperty as the backing store for CarrierMode. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty CarrierModeProperty =
- DependencyProperty.Register("CarrierMode", typeof(LoadPortCarrierMode), typeof(FoupItemPro), new PropertyMetadata(LoadPortCarrierMode.Both));
- public bool FristChick { get; set; } = true;
- private WaferPro fristwafer;
- private WaferPro endwafer;
- private void lbItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- //if (Keyboard.IsKeyDown(Key.LeftCtrl))
- //{
- var obj = (WaferPro)sender;
- if (obj.WaferItem.Status != Aitex.Core.Common.WaferStatus.Empty)
- {
- obj.WaferItem.IsChecked = !obj.WaferItem.IsChecked;
- }
- // }
- //if (Keyboard.IsKeyDown(Key.LeftShift))
- //{
- // if (FristChick)
- // {
- // FristChick = false;
- // fristwafer = (WaferPro)sender;
- // fristwafer.WaferItem.IsChecked = true;
- // }
- // else
- // {
- // FristChick = true;
- // endwafer = (WaferPro)sender;
- // var fristSlot = fristwafer.WaferItem.Slot < endwafer.WaferItem.Slot ? fristwafer.WaferItem.Slot : endwafer.WaferItem.Slot;
- // var endSlot = fristwafer.WaferItem.Slot > endwafer.WaferItem.Slot ? fristwafer.WaferItem.Slot : endwafer.WaferItem.Slot;
- // for (int i = fristSlot; i < endSlot + 1; i++)
- // {
- // if (((WaferInfo)this.Slot.Items[24 - i]).Status != Aitex.Core.Common.WaferStatus.Empty)
- // {
- // ((WaferInfo)this.Slot.Items[24 - i]).IsChecked = true;
- // }
- // }
- // }
- //}
- //if (!(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.LeftShift)))
- //{
- // foreach (var item in this.Slot.Items)
- // {
- // ((WaferInfo)item).IsChecked = false;
- // }
-
- //}
- }
- private void lbItem_PreviewMouseMove(object sender, MouseEventArgs e)
- {
- //if (e.LeftButton == MouseButtonState.Pressed && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.LeftShift)))
- //{
- // var data = new DataObject();
- // data.SetData("Station", Station);
- // data.SetData("Slots", Slots);
- // DragDrop.DoDragDrop(sender as DependencyObject,
- // data,
- // DragDropEffects.Copy | DragDropEffects.Move);
- // FristChick = true;
- //}
- }
- private void UserControl_PreviewKeyDown(object sender, KeyEventArgs e)
- {
- int keyValue = KeyInterop.VirtualKeyFromKey(e.Key);
- }
- private void Slot_Drop(object sender, DragEventArgs e)
- {
- //if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.LeftShift))
- //{
- // var dialog = new TransferSelectionDialog();
- // dialog.DestinationStation = ((WaferPro)e.Source).Station;
- // dialog.DestinationName = ((WaferPro)e.Source).Name;
- // dialog.FoupCount = FoupCount;
- // var sourceStation = (ModuleName)e.Data.GetData("Station");
- // var sourceSlots = (IEnumerable)e.Data.GetData("Slots");
- // List<WaferInfo> DestinationWaferInfos = new List<WaferInfo>();
- // dialog.OriginalFoupItem.Slots = sourceSlots;
- // dialog.DestinationFoupItem.Slots = this.Slots;
- // dialog.Closing += Dialog_Closing;
- // FristChick = true;
- // // dialog.Show();
- // dialog.TransferSelectionViewModel.OriginalSelectedValue = sourceStation.ToString();
- // dialog.TransferSelectionViewModel.DestinationSelectedValue = ((WaferPro)e.Source).Station.ToString();
- // ////对话框关闭后下指令
- // if (dialog.ShowDialog() == true)
- // {
- // //下命令
- // }
- //}
- }
- private void Dialog_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- var dialog = (TransferSelectionDialog)sender;
- foreach (var item in dialog.OriginalFoupItem.Slots)
- {
- ((WaferInfo)item).IsChecked = false;
- }
- foreach (var item in dialog.DestinationFoupItem.Slots)
- {
- ((WaferInfo)item).IsChecked = false;
- }
-
- }
- }
- }
|