using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Input; using Aitex.Core.UI.MVVM; using Aitex.Core.Util; using Aitex.Sorter.UI.ViewModel; using MECF.Framework.Common.IOCore; namespace EfemUI.ViewModels { public class IoViewModelRSW : UIViewModelBase { private List _di1; private List _do2; private List _di3; private List _do4; private List _plcDi; private List _plcDo; private List _ai5; private List _ai6; private List _ai7; private List _motionAi; private List _motionAo; public IoViewModelRSW() : base("IoViewModelRSW") { Card1DiList = new ObservableCollection(); Card2DoList = new ObservableCollection(); Card3DiList = new ObservableCollection(); Card4DoList = new ObservableCollection(); PlcDiList = new ObservableCollection(); PlcDoList = new ObservableCollection(); Card5AiList = new ObservableCollection(); Card6AiList = new ObservableCollection(); Card7AiList = new ObservableCollection(); MotionAiList = new ObservableCollection(); MotionAoList = new ObservableCollection(); SetDoCommand = new DelegateCommand(PerformSetDo); } public ObservableCollection Card1DiList { get; set; } public ObservableCollection Card2DoList { get; set; } public ObservableCollection Card3DiList { get; set; } public ObservableCollection Card4DoList { get; set; } public ObservableCollection Card5AiList { get; set; } public ObservableCollection Card6AiList { get; set; } public ObservableCollection Card7AiList { get; set; } public ObservableCollection MotionAiList { get; set; } public ObservableCollection MotionAoList { get; set; } public ObservableCollection PlcDiList { get; set; } public ObservableCollection PlcDoList { get; set; } [Subscription("System.dio000.DIList")] public List DiListData1 { get => _di1; set { _di1 = value; Application.Current.Dispatcher.Invoke(() => { Card1DiList.Clear(); _di1.ForEach(x => { if (x.Provider.ToLower() == "system.dio000") Card1DiList.Add(x); }); }); } } [Subscription("System.dio001.DOList")] public List DoListData2 { get => _do2; set { _do2 = value; Application.Current.Dispatcher.Invoke(() => { Card2DoList.Clear(); _do2.ForEach(x => { if (x.Provider.ToLower() == "system.dio001") Card2DoList.Add(x); }); }); } } [Subscription("System.dio002.DIList")] public List DiListData3 { get => _di3; set { _di3 = value; Application.Current.Dispatcher.Invoke(() => { Card3DiList.Clear(); _di3.ForEach(x => { if (x.Provider.ToLower() == "system.dio002") Card3DiList.Add(x); }); }); } } [Subscription("System.dio003.DOList")] public List DoListData4 { get => _do4; set { _do4 = value; Application.Current.Dispatcher.Invoke(() => { Card4DoList.Clear(); _do4.ForEach(x => { if (x.Provider.ToLower() == "system.dio003") Card4DoList.Add(x); }); }); } } [Subscription("System.dio004.AIList")] public List AiListData5 { get => _ai5; set { _ai5 = value; Application.Current.Dispatcher.Invoke(() => { Card5AiList.Clear(); _ai5.ForEach(x => { if (x.Provider.ToLower() == "system.dio004") Card5AiList.Add(x); }); }); } } [Subscription("System.dio005.AIList")] public List AiListData6 { get => _ai6; set { _ai6 = value; Application.Current.Dispatcher.Invoke(() => { Card6AiList.Clear(); _ai6.ForEach(x => { if (x.Provider.ToLower() == "system.dio005") Card6AiList.Add(x); }); }); } } [Subscription("System.dio006.AIList")] public List AiListData7 { get => _ai7; set { _ai7 = value; Application.Current.Dispatcher.Invoke(() => { Card7AiList.Clear(); _ai7.ForEach(x => { if (x.Provider.ToLower() == "system.dio006") Card7AiList.Add(x); }); }); } } [Subscription("System.MotionAxis.AIList")] public List AiListData { get => _motionAi; set { _motionAi = value; Application.Current.Dispatcher.Invoke(() => { MotionAiList.Clear(); _motionAi.ForEach(x => { if (x.Provider.ToLower() == "system.motionaxis") MotionAiList.Add(x); }); }); } } [Subscription("System.MotionAxis.AOList")] public List AoListData { get => _motionAo; set { _motionAo = value; Application.Current.Dispatcher.Invoke(() => { MotionAoList.Clear(); _motionAo.ForEach(x => { if (x.Provider.ToLower() == "system.motionaxis") MotionAoList.Add(x); }); }); } } [Subscription("System.MainPlc.DIList")] public List DiListData9 { get => _plcDi; set { _plcDi = value; Application.Current.Dispatcher.Invoke(() => { PlcDiList.Clear(); _plcDi.ForEach(x => { if (x.Provider.ToLower() == "system.mainplc") PlcDiList.Add(x); }); }); } } [Subscription("System.MainPlc.DOList")] public List DoListData10 { get => _plcDo; set { _plcDo = value; Application.Current.Dispatcher.Invoke(() => { PlcDoList.Clear(); _plcDo.ForEach(x => { if (x.Provider.ToLower() == "system.mainplc") PlcDoList.Add(x); }); }); } } public ICommand SetDoCommand { get; set; } private void PerformSetDo(string ioName) { } private void SetDo() { } protected override void InvokeBeforeUpdateProperty(Dictionary data) { //data[UIKey(UnitName.System.ToString(), ParamName.WaferInfoRobotAligner01)] = new WaferInfo("dummy", WaferStatus.Normal); } } }