123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- using Aitex.Core.Common;
- using Aitex.Sorter.Common;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Input;
- using MECF.Framework.Common.Equipment;
- namespace Aitex.Sorter.UI.Controls
- {
- /// <summary>
- /// Foup.xaml 的交互逻辑
- /// </summary>
- public partial class Foup : UserControl
- {
- public Foup()
- {
- InitializeComponent();
- root.DataContext = this;
- Slot.DataContext = this;
- }
- public static readonly DependencyProperty SlotsProperty = DependencyProperty.Register(
- "Slots", typeof(IEnumerable), typeof(Foup),
- new FrameworkPropertyMetadata(null));
- public IEnumerable Slots
- {
- get
- {
- return (IEnumerable)GetValue(SlotsProperty);
- }
- set
- {
- SetValue(SlotsProperty, value);
- }
- }
- public int SlotCount
- {
- get;
- set;
- }
- public CheckedItem[] SlotIndexes
- {
- get
- {
- var indexes = new CheckedItem[SlotCount];
- for (int i = 0; i < SlotCount; i++)
- {
- indexes[i] = new CheckedItem { ItemIndex = SlotCount - i - 1 };
- }
- return indexes;
- }
- }
- 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(Foup), 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(Foup), 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(Foup), new PropertyMetadata(null));
- public SlotTransferInfo[] SlotTransferInfo
- {
- get { return (SlotTransferInfo[])GetValue(SlotTransferInfoProperty); }
- set { SetValue(SlotTransferInfoProperty, value); }
- }
- // Using a DependencyProperty as the backing store for SlotTransferInfo. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty SlotTransferInfoProperty =
- DependencyProperty.Register("SlotTransferInfo", typeof(SlotTransferInfo[]), typeof(Foup), 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(Foup), new PropertyMetadata(null));
- }
- public class CheckedItem : INotifyPropertyChanged
- {
- private int itemIndex;
- private bool isChecked;
- public int ItemIndex
- {
- get
- {
- return itemIndex;
- }
- set
- {
- itemIndex = value;
- Notify("ItemIndex");
- }
- }
- public bool IsChecked
- {
- get
- {
- return isChecked;
- }
- set
- {
- isChecked = value;
- Notify("IsChecked");
- }
- }
- private void Notify(string property)
- {
- if (PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(property));
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- }
- public class TransferInfoConverter : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- var slot = (int)values[0];
- var slotTransferInfos = (SlotTransferInfo[])values[1];
- if (slotTransferInfos != null)
- {
- return slotTransferInfos[slot];
- }
- return null;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|