using Aitex.Core.RT.IOCore;
using Aitex.Core.UI.MVVM;
using MECF.Framework.Simulator.Core.Commons;
using System;
using System.Collections.Generic;
using System.Configuration;
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 Venus_Core;
using Venus_Simulator.Devices;
namespace Venus_Simulator.Views
{
///
/// Simu_VCEView.xaml 的交互逻辑
///
public partial class Simu_VCEView : UserControl
{
public Simu_VCEView()
{
InitializeComponent();
DataContext = new VceViewModel("COM161","VCEA");
}
}
class VceViewModel : SerialPortDeviceViewModel
{
public ICommand CassArrive { get; set; }
public ICommand CassLeave { get; set; }
public ICommand AllExist { get; set; }
public ICommand AllEmpty { get; set; }
public string Title
{
get { return "VCE simulator"; }
}
private VceSimulator _vce;
private string chamber;
private ConfigType type;
public VceViewModel(string port,string _chamber) : base(_chamber)
{
chamber = _chamber;
Init(_vce = new VceSimulator(port));
CassArrive = new DelegateCommand(cassArrive);
CassLeave = new DelegateCommand(cassLeave);
AllExist = new DelegateCommand(allExist);
AllEmpty = new DelegateCommand(allEmpty);
var section = ConfigurationManager.GetSection("customSettings") as System.Collections.Specialized.NameValueCollection;
type = (ConfigType)Convert.ToInt32(section["SimulatorType"]);
}
private void cassArrive(string obj)
{
if(type == ConfigType.VenusSE)
IO.DI[$"SETM.DI_{chamber}_Cassette_Present"].Value = true;
if (type == ConfigType.VenusDE)
IO.DI[$"DETM.DI_{chamber}_Cassette_Present"].Value = true;
}
private void cassLeave(string obj)
{
if (type == ConfigType.VenusSE)
IO.DI[$"SETM.DI_{chamber.ToString()}_Cassette_Present"].Value = false;
if (type == ConfigType.VenusDE)
IO.DI[$"DETM.DI_{chamber.ToString()}_Cassette_Present"].Value = false;
}
private void allExist(string obj)
{
_vce.Wafermap(false);
}
private void allEmpty(string obj)
{
_vce.Wafermap(true);
}
}
}