using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Windows; using System.Windows.Input; using Aitex.Core.Common.DeviceData; using Aitex.Core.UI.MVVM; using Aitex.Core.Util; using MECF.Framework.Common.IOCore; using Xceed.Wpf.Toolkit; namespace Aitex.Sorter.UI.ViewModel { public class IoViewModel : UIViewModelBase { public ObservableCollection Card1DiList { get; set; } public ObservableCollection Card2DiList { get; set; } public ObservableCollection Card1DoList { get; set; } public ObservableCollection Card2DoList { get; set; } private List _di; [Subscription("DI", SystemStateModule)] public List DiListData { get { return _di; } set { _di = value; Application.Current.Dispatcher.Invoke(new Action(() => { Card1DiList.Clear(); Card2DiList.Clear(); _di.ForEach(x=> { if (x.Provider.ToLower()=="system.dio000") Card1DiList.Add(x); if (x.Provider.ToLower() == "system.dio001") Card2DiList.Add(x); }); })); } } private List _do; [Subscription("DO", SystemStateModule)] public List DoListData { get { return _do; } set { _do = value; Application.Current.Dispatcher.Invoke(new Action(() => { Card1DoList.Clear(); Card2DoList.Clear(); _do.ForEach(x=> { if (x.Provider.ToLower()== "system.dio000") Card1DoList.Add(x); if (x.Provider.ToLower() == "system.dio001") Card2DoList.Add(x); }); })); } } public ICommand SetDoCommand { get; set; } public IoViewModel() : base("IoViewModel") { Card1DiList = new ObservableCollection(); Card2DiList = new ObservableCollection(); Card1DoList = new ObservableCollection(); Card2DoList = new ObservableCollection(); SetDoCommand = new DelegateCommand(PerformSetDo); } private void PerformSetDo(string ioName) { } protected override void InvokeBeforeUpdateProperty(Dictionary data) { //data[UIKey(UnitName.System.ToString(), ParamName.WaferInfoRobotAligner01)] = new WaferInfo("dummy", WaferStatus.Normal); } } }