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 { /// /// Foup6.xaml 的交互逻辑 /// 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 DestinationWaferInfos = new List(); // 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; } } } }