123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- using Aitex.Core.UI.MVVM;
- using Aitex.Sorter.UI.Controls;
- using Aitex.Sorter.UI.ViewModel;
- 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;
- using System.Windows.Threading;
- namespace Aitex.Sorter.UI.Views
- {
- /// <summary>
- /// OperationViewSub.xaml 的交互逻辑
- /// </summary>
-
- public partial class OperationViewSub : UserControl
- {
- private static int loadPortCount = 8;
- private OperationMultiLPViewModel operationViewModel;
- private readonly DispatcherTimer _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
- public OperationViewSub()
- {
- InitializeComponent();
- operationViewModel = new OperationViewSubModel();
- ChangedFoupListSize();
- DataContext = operationViewModel;
- IsVisibleChanged += OperationView_IsVisibleChanged;
- _timer.Start();
- _timer.Tick += TimerOnTick;
- }
- private void ChangedFoupListSize()
- {
- switch (loadPortCount)
- {
- case 1:
- case 2:
- this.foupList.Width = 200;
- this.FoupListViewbox.Width = 250;
- break;
- case 3:
- case 4:
- this.foupList.Width = 400;
- this.FoupListViewbox.Width = 500;
- break;
- case 5:
- case 6:
- this.foupList.Width = 600;
- this.FoupListViewbox.Width = 600;
- break;
- case 7:
- case 8:
- this.foupList.Width = 800;
- this.FoupListViewbox.Width = 800;
- break;
- case 9:
- case 10:
- this.foupList.Width = 900;
- this.FoupListViewbox.Width = 900;
- break;
- default:
- break;
- }
- }
- private void TimerOnTick(object sender, EventArgs e)
- {
- if (IsVisible)
- {
- operationViewModel.UpdateAllConfig();
- }
- }
- private void OperationView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- ((OperationMultiLPViewModel)DataContext).EnableTimer(IsVisible);
- }
- private void CreateWafer_Click(object sender, RoutedEventArgs e)
- {
- }
- // private void BatchID_Click(object sender, RoutedEventArgs e)
- // {
- // string value = InputBatchID.Text.Trim();
- // string origin = value;
- //
- // InputBatchID.Text = origin;
- // InputBatchID.CaretIndex = InputBatchID.Text.Length;
- //
- //
- // InvokeClient.Instance.Service.DoOperation("System.SetBatchId", value);
- // }
- }
- public class FoupListConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var type = (string)value;
- var image = string.Format("EFEMbg{0}.png", type);
- string packUri = "pack://application:,,,/AitexSorterUI;component/Resources/images/" + image;
- var source = new BitmapImage(new Uri(packUri));
- return source;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class EFEMControlConverter : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- var root = values[1] as FrameworkElement;
- if (values[0] != null)
- {
- var type = (string)values[0];
- switch (type)
- {
- case "41":
- var efem41 = root.FindResource("EFEM41");
- ((ViewModelControl)efem41).SubscribeKeys((SubscriptionViewModelBase)(root.DataContext));
- return efem41;
- case "4":
- var efem4 = root.FindResource("EFEM4H");
- ((ViewModelControl)efem4).SubscribeKeys((SubscriptionViewModelBase)(root.DataContext));
- return efem4;
- case "6":
- var efem6 = root.FindResource("EFEM4");
- ((ViewModelControl)efem6).SubscribeKeys((SubscriptionViewModelBase)(root.DataContext));
- return efem6;
- default:
- var image = string.Format("EFEMbg{0}.png", type);
- string packUri = "pack://application:,,,/AitexSorterUI;component/Resources/images/" + image;
- var source = new BitmapImage(new Uri(packUri));
- var content = new Image() { Source = source };
- return content;
- }
- }
- return null;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|