123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using Aitex.Sorter.Common;
- using MECF.Framework.Common.Equipment;
- using System;
- 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;
- namespace VirgoUI.Controls.Parts
- {
- /// <summary>
- /// LoadPort.xaml 的交互逻辑
- /// </summary>
- public partial class LoadPort : UserControl
- {
- public string Label
- {
- get { return (string)GetValue(LabelProperty); }
- set { SetValue(LabelProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Label. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty LabelProperty =
- DependencyProperty.Register("Label", typeof(string), typeof(LoadPort), new PropertyMetadata(null));
- public ICommand Command
- {
- get { return (ICommand)GetValue(CommandProperty); }
- set { SetValue(CommandProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Command. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty CommandProperty =
- DependencyProperty.Register("Command", typeof(ICommand), typeof(LoadPort), new PropertyMetadata(null));
- public LoadportCassetteState CassetteState
- {
- get { return (LoadportCassetteState)GetValue(CassetteStateProperty); }
- set { SetValue(CassetteStateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Present. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty CassetteStateProperty =
- DependencyProperty.Register("CassetteState", typeof(LoadportCassetteState), typeof(LoadPort), new FrameworkPropertyMetadata(LoadportCassetteState.Unknown));
- public FoupDoorState DoorState
- {
- get { return (FoupDoorState)GetValue(DoorStateProperty); }
- set { SetValue(DoorStateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Open. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty DoorStateProperty =
- DependencyProperty.Register("DoorState", typeof(FoupDoorState), typeof(LoadPort), new FrameworkPropertyMetadata(FoupDoorState.Unknown, FrameworkPropertyMetadataOptions.AffectsRender));
- 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(LoadPort), new PropertyMetadata(ModuleName.System));
- public int RotateAngel
- {
- get { return (int)GetValue(RotateAngelProperty); }
- set { SetValue(RotateAngelProperty, value); }
- }
- // Using a DependencyProperty as the backing store for RotateAngel. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty RotateAngelProperty =
- DependencyProperty.Register("RotateAngel", typeof(int), typeof(LoadPort), new PropertyMetadata(0));
- public LoadPort()
- {
- InitializeComponent();
- root.DataContext = this;
- }
- private void MenuItem_Click(object sender, RoutedEventArgs e)
- {
- var cmd = ((MenuItem)sender).Tag;
- Command.Execute(new[] { Station.ToString(), cmd });
- }
- protected override void OnRender(DrawingContext drawingContext)
- {
- base.OnRender(drawingContext);
- if (DoorState == FoupDoorState.Open)
- {
- cassette.VerticalAlignment = VerticalAlignment.Top;
- }
- else if (DoorState == FoupDoorState.Close)
- {
- cassette.VerticalAlignment = VerticalAlignment.Bottom;
- }
- }
- }
- public class LoadportCassetteStateConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var state = (LoadportCassetteState)value;
- return state == LoadportCassetteState.Normal ? Visibility.Visible : Visibility.Hidden;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class FoupDoorStateConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var state = (FoupDoorState)value;
- return state == FoupDoorState.Open ? Visibility.Visible : Visibility.Hidden;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|