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; namespace Aitex.Sorter.UI.Controls { /// /// Foup6.xaml 的交互逻辑 /// public partial class FoupItem : UserControl { public FoupItem() { InitializeComponent(); root.DataContext = this; Slot.DataContext = this; } public static readonly DependencyProperty SlotsProperty = DependencyProperty.Register( "Slots", typeof(IEnumerable), typeof(FoupItem), new FrameworkPropertyMetadata(null)); public IEnumerable Slots { get { return (IEnumerable)GetValue(SlotsProperty); } set { SetValue(SlotsProperty, value); } } public bool ShowControl { get { return (bool)GetValue(ShowControlProperty); } set { SetValue(ShowControlProperty, value); } } public static readonly DependencyProperty ShowControlProperty = DependencyProperty.Register("ShowControl", typeof(bool), typeof(FoupItem), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.None)); 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(FoupItem), 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(FoupItem), 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(FoupItem), 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(FoupItem), 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(FoupItem), 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(FoupItem), new PropertyMetadata(LoadPortCarrierMode.Both)); } public class FoupModeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mode = (LoadPortCarrierMode)value; var brush = Brushes.Gray; switch (mode) { case LoadPortCarrierMode.Loader: brush = Brushes.Cyan; break; case LoadPortCarrierMode.Unloader: brush = Brushes.DodgerBlue; break; case LoadPortCarrierMode.Both: brush = Brushes.LightBlue; break; default: break; } return brush; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ItemIndexConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var index = (int)values[0]; var count = (int)values[1]; return count - index-1; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ItemIndexConverter2 : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var index = (int)values[0]; var count = 25; return count - index - 1; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ShowSlotItemConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var index = (int)values[0]; var count = (int)values[1]; return 25-index - 1 < count?true: false; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }