Sic.Framework-Nanjing-Baishi/SimulatorCore/Aligners/HPA48/HPA48View.xaml.cs

96 lines
2.6 KiB
C#

using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.UI.MVVM;
using Aitex.Core.Utilities;
using MECF.Framework.Simulator.Core.Aligners.HPA48;
using MECF.Framework.Simulator.Core.Commons;
namespace MECF.Framework.Simulator.Core.LoadPorts
{
//public class WaferItem
//{
// public int index { get; set; }
// public string Display { get; set; }
// public int State { get; set; }
//}
/// <summary>
/// TazmoAligner.xaml 的交互逻辑
/// </summary>
public partial class HPA48View : UserControl
{
public static readonly DependencyProperty PortNameProperty = DependencyProperty.Register(
"PortName", typeof(string), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata("COM10", FrameworkPropertyMetadataOptions.AffectsRender));
public string PortName
{
get => (string)this.GetValue(PortNameProperty);
set => this.SetValue(PortNameProperty, value);
}
public static readonly DependencyProperty PortNumberProperty = DependencyProperty.Register(
"PortNumber", typeof(int), typeof(TazmoAlignerView),
new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
public int PortNumber
{
get => (int)this.GetValue(PortNumberProperty);
set => this.SetValue(PortNumberProperty, value);
}
public HPA48View()
{
InitializeComponent();
this.Loaded += OnViewLoaded;
}
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
if (DataContext == null)
{
DataContext = new HPA48ViewModel(PortName, PortNumber);
(DataContext as TimerViewModelBase).Start();
}
}
}
class HPA48ViewModel : SerialPortDeviceViewModel
{
public string Title => "HiWin HPA48 Aligner Simulator";
public bool IsGenBALError
{
set
{
_sim.IsGenerateBALError = value;
}
}
public ObservableCollection<WaferItem> WaferList { get; set; }
private HPA48Simulator _sim;
public HPA48ViewModel(string port, int index) : base("HPA48ViewModel")
{
_sim = new HPA48Simulator(port);
Init(_sim);
WaferList = new ObservableCollection<WaferItem>()
{
new WaferItem {Display = "1", Index = 2, State = 3}
};
}
}
}