using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Collections.Generic; using Aitex.Core.UI.MVVM; using Aitex.Core.Utilities; using EfemDualSimulator.Devices; using MECF.Framework.Simulator.Core.Commons; namespace EfemDualSimulator.Views { /// /// Interaction logic for Simu_EfemView.xaml /// public partial class Simu_EfemView : UserControl { public Simu_EfemView() { InitializeComponent(); this.DataContext = new EfemSimulatorViewModel(); this.Loaded += OnViewLoaded; } private void OnViewLoaded(object sender, RoutedEventArgs e) { (DataContext as TimerViewModelBase)?.Start(); } } class EfemSimulatorViewModel : SocketDeviceViewModel { public string Title { get { return "EFEM Simulator"; } } public string WaferMap { get { return _sim.SlotMap; } } private bool _doorOpen; [IgnorePropertyChange] public bool DoorOpen { get { return _doorOpen; } set { _doorOpen = value; _sim.SetCassetteDoor(_doorOpen); } } private bool _Maintain; [IgnorePropertyChange] public bool Maintain { get { return _Maintain; } set { _Maintain = value; _sim.SetMaintain(_Maintain); } } private bool _Protrude1; [IgnorePropertyChange] public bool Protrude1 { get { return _Protrude1; } set { _Protrude1 = value; _sim.SetProtrude1(_Protrude1); } } private bool _Protrude2; [IgnorePropertyChange] public bool Protrude2 { get { return _Protrude2; } set { _Protrude2 = value; _sim.SetProtrude2(_Protrude2); } } private EfemSimulatorServer _sim; public ICommand Place1Command { get; set; } public ICommand Remove1Command { get; set; } public ICommand Place2Command { get; set; } public ICommand Remove2Command { get; set; } public ICommand ClearCommand { get; set; } public ICommand SetAllCommand { get; set; } public ICommand RandomCommand { get; set; } public EfemSimulatorViewModel() : base("EfemSimuViewModel") { Place1Command = new DelegateCommand(Place1); Remove1Command = new DelegateCommand(Remove1); Place2Command = new DelegateCommand(Place2); Remove2Command = new DelegateCommand(Remove2); ClearCommand = new DelegateCommand(Clear); SetAllCommand = new DelegateCommand(SetAll); RandomCommand = new DelegateCommand(RandomGenerateWafer); _sim = new EfemSimulatorServer(); Init(_sim); } private void RandomGenerateWafer(string obj) { _sim.RandomWafer(); } private void SetAll(string obj) { _sim.SetAllWafer(); } private void Clear(string obj) { _sim.ClearWafer(); } private void Remove1(string obj) { _sim.RemoveCarrier1(); } private void Place1(string obj) { _sim.PlaceCarrier1(); } private void Remove2(string obj) { _sim.RemoveCarrier2(); } private void Place2(string obj) { _sim.PlaceCarrier2(); } private List _WaferSizeItems = new List() { "Small", "Mid", "Big"}; public List WaferSizeItems { get { return _WaferSizeItems; } } private string _SelectedWaferSize; public string SelectedWaferSize { get { return _SelectedWaferSize; } set { _SelectedWaferSize = value; switch (value) { case "Small": _sim.WaferSize = 3; break; case "Mid": _sim.WaferSize = 4; break; case "Big": _sim.WaferSize = 6; break; } } } } }