123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- using Aitex.Core.UI.MVVM;
- using Aitex.Core.Utilities;
- using CyberX8_Simulator.Devices;
- using MECF.Framework.Simulator.Core.Commons;
- using MECF.Framework.Simulator.Core.Driver;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- 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 CyberX8_Simulator.Views
- {
- /// <summary>
- /// WagoView.xaml 的交互逻辑
- /// </summary>
- public partial class WagoView : UserControl
- {
- public WagoView()
- {
- InitializeComponent();
- this.Loaded += OnViewLoaded;
- }
- private void OnViewLoaded(object sender, RoutedEventArgs e)
- {
- (DataContext as TimerViewModelBase)?.Start();
- }
- }
- class WagoViewModel : SocketDeviceViewModel
- {
- #region 属性
- public string Title
- {
- get { return "Wago Simulator"; }
- }
- private string _DOSelectedItem;
- [IgnorePropertyChange]
- public string DOSelectedItem
- {
- get
- {
- return _DOSelectedItem;
- }
- set
- {
- _DOSelectedItem = value;
- }
- }
- private int _DOInputValue;
- [IgnorePropertyChange]
- public int DOInputValue
- {
- get
- {
- return _DOInputValue;
- }
- set
- {
- _DOInputValue = value;
- }
- }
- private string _DISelectedItem;
- [IgnorePropertyChange]
- public string DISelectedItem
- {
- get
- {
- return _DISelectedItem;
- }
- set
- {
- _DISelectedItem = value;
- }
- }
- private int _DIInputValue;
- [IgnorePropertyChange]
- public int DIInputValue
- {
- get
- {
- return _DIInputValue;
- }
- set
- {
- _DIInputValue = value;
- }
- }
- private string _AOSelectedItem;
- [IgnorePropertyChange]
- public string AOSelectedItem
- {
- get
- {
- return _AOSelectedItem;
- }
- set
- {
- _AOSelectedItem = value;
- }
- }
- private short _AOInputValue;
- [IgnorePropertyChange]
- public short AOInputValue
- {
- get
- {
- return _AOInputValue;
- }
- set
- {
- _AOInputValue = value;
- }
- }
- private string _AISelectedItem;
- [IgnorePropertyChange]
- public string AISelectedItem
- {
- get
- {
- return _AISelectedItem;
- }
- set
- {
- _AISelectedItem = value;
- }
- }
- private short _AIInputValue;
- [IgnorePropertyChange]
- public short AIInputValue
- {
- get
- {
- return _AIInputValue;
- }
- set
- {
- _AIInputValue = value;
- }
- }
- #endregion
- public ObservableCollection<string> DONameItems { get; set; }
- public ObservableCollection<string> DINameItems { get; set; }
- public ObservableCollection<string> AONameItems { get; set; }
- public ObservableCollection<string> AINameItems { get; set; }
- public ObservableCollection<int> DigitalInputSelected { get; set; }
-
-
- private WagoSocketSimulator _sim;
- public ICommand SetDICommand { get; set; }
- public ICommand SetDOCommand { get; set; }
- public ICommand SetAICommand { get; set; }
- public ICommand SetAOCommand { get; set; }
- public WagoViewModel(string str) : base("WagoViewModel")
- {
-
-
- SetDICommand = new DelegateCommand<object>(SetDIAction);
- SetDOCommand = new DelegateCommand<object>(SetDOAction);
- SetAICommand = new DelegateCommand<object>(SetAIAction);
- SetAOCommand = new DelegateCommand<object>(SetAOAction);
-
- int.TryParse(str, out int port);
- _sim = new WagoSocketSimulator(port);
- Init(_sim);
- InitData(port);
- }
- private void SetDIAction(object obj)
- {
- _sim.UpdataDIBytes(DISelectedItem, DIInputValue);
- }
- private void SetDOAction(object obj)
- {
- _sim.UpdataDOBytes(DOSelectedItem, DOInputValue);
- }
- private void SetAIAction(object obj)
- {
- _sim.UpdataAIShorts(AISelectedItem, AIInputValue);
- }
- private void SetAOAction(object obj)
- {
- _sim.UpdataAOShorts(AOSelectedItem, AOInputValue);
- }
- private void InitData(int port)
- {
- DigitalInputSelected = new ObservableCollection<int> { 0, 1 };
- DONameItems = new ObservableCollection<string>
- { "c_System_Alarm",
- "c_Pole_Red",
- "c_Pole_Amber",
- "c_Pole_Green",
- "c_Pole_Blue",
- "c_System_Alarm2",
- "c_BACKSIDE_PRESSURE_TEST",
- "c_VACUUM_TEST",
- "DO8",
- "DO9",
- "DO10",
- "DO11",
- "DO12",
- "DO13",
- "DO14",
- "DO15",
- "DO16",
- "DO17",
- "DO18",
- "DO19",
- "DO20",
- "DO21"};
-
- DINameItems = new ObservableCollection<string>
- { "r_Cassette_1_150",
- "r_Cassette_1_100",
- "r_Cassette_1_200",
- "r_Cassette_2_150",
- "r_Cassette_2_100",
- "r_Cassette_2_200",
- "r_Cassette_3_150",
- "r_Cassette_3_100",
- "r_Cassette_3_200",
- "r_Dummy_1_150",
- "r_Dummy_1_100",
- "r_Dummy_1_200",
- "r_Dummy_2_150",
- "r_Dummy_2_100",
- "r_Dummy_2_100",
- "D15",
- "r_LoaderA_Wafer_Present",
- "r_LoaderB_Wafer_Present",
- "r_Cathode_Present",
- "DI19",
- "DI20",
- "DI21",
- "DI22",
- "DI23",
- "DI24",
- "DI25",
- "r_LOADERA_CRS_CURTAIN_1",
- "r_LOADERA_CRS_CURTAIN_2",
- "r_LOADERA_CRS_CURTAIN_3",
- "r_LOADERA_CRS_CURTAIN_4",
- "r_LOADERA_CRS_CURTAIN_5",
- "r_LOADERA_CRS_CURTAIN_6",};
- AONameItems = new ObservableCollection<string>
- { "AO1",
- "AO2",
- "AO3",
- "AO4",
- "AO5",
- "AO6",
- "AO7",
- "AO8",
- "AO9",
- "AO10",
- "AO11",
- "AO12",
- "AO13",
- "AO14",
- "AO15",
- "AO16"};
- AINameItems = new ObservableCollection<string>
- { "AI1",
- "AI2",
- "AI3",
- "r_LoaderA_LS_Vacuum_anlg",
- "r_LoaderB_LS_Vacuum_anlg",
- "AI6",
- "r_LOADER_GasFlowSensor_FLOW",
- "r_LOADERA_BERNOULLI_PRESSURE",
- "r_LOADERB_BERNOULLI_PRESSURE",
- "r_LOADERA_CHUCK_BLADDER",
- "r_LOADERB_CHUCK_BLADDER",
- "r_LOADERA_WS_BLADDER_PRESSURE",
- "r_LOADERB_WS_BLADDER_PRESSURE",
- "r_SPUF_VAC",
- "r_LOADER_GasFlowSensor_VACUUM",};
- }
- }
- }
|