IoViewModel2LP.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows;
  7. using System.Windows.Input;
  8. using Aitex.Core.Common.DeviceData;
  9. using Aitex.Core.UI.MVVM;
  10. using Aitex.Core.Util;
  11. using Aitex.Sorter.UI.ViewModel;
  12. using MECF.Framework.Common.IOCore;
  13. namespace Aitex.Sorter.UI.ViewModel
  14. {
  15. public class IoViewModel2LP : UIViewModelBase
  16. {
  17. public ObservableCollection<NotifiableIoItem> Card1DiList { get; set; }
  18. public ObservableCollection<NotifiableIoItem> Card2DoList { get; set; }
  19. public ObservableCollection<NotifiableIoItem> Card3DiList { get; set; }
  20. public ObservableCollection<NotifiableIoItem> Card4DoList { get; set; }
  21. public ObservableCollection<NotifiableIoItem> IOAiList { get; set; }
  22. public ObservableCollection<NotifiableIoItem> IOAoList { get; set; }
  23. private List<NotifiableIoItem> _di1;
  24. [Subscription("System.dio000.DIList")]
  25. public List<NotifiableIoItem> DiListData1
  26. {
  27. get
  28. {
  29. return _di1;
  30. }
  31. set
  32. {
  33. _di1 = value;
  34. Application.Current.Dispatcher.Invoke(new Action(() =>
  35. {
  36. Card1DiList.Clear();
  37. _di1.ForEach(x =>
  38. {
  39. if (x.Provider.ToLower() == "system.dio000")
  40. Card1DiList.Add(x);
  41. });
  42. }));
  43. }
  44. }
  45. private List<NotifiableIoItem> _do2;
  46. [Subscription("System.dio001.DOList")]
  47. public List<NotifiableIoItem> DoListData2
  48. {
  49. get
  50. {
  51. return _do2;
  52. }
  53. set
  54. {
  55. _do2 = value;
  56. Application.Current.Dispatcher.Invoke(new Action(() =>
  57. {
  58. Card2DoList.Clear();
  59. _do2.ForEach(x =>
  60. {
  61. if (x.Provider.ToLower() == "system.dio001")
  62. Card2DoList.Add(x);
  63. });
  64. }));
  65. }
  66. }
  67. private List<NotifiableIoItem> _di3;
  68. [Subscription("System.dio002.DIList")]
  69. public List<NotifiableIoItem> DiListData3
  70. {
  71. get
  72. {
  73. return _di3;
  74. }
  75. set
  76. {
  77. _di3 = value;
  78. Application.Current.Dispatcher.Invoke(new Action(() =>
  79. {
  80. Card3DiList.Clear();
  81. _di3.ForEach(x =>
  82. {
  83. if (x.Provider.ToLower() == "system.dio002")
  84. Card3DiList.Add(x);
  85. });
  86. }));
  87. }
  88. }
  89. private List<NotifiableIoItem> _do4;
  90. [Subscription("System.dio003.DOList")]
  91. public List<NotifiableIoItem> DoListData4
  92. {
  93. get
  94. {
  95. return _do4;
  96. }
  97. set
  98. {
  99. _do4 = value;
  100. Application.Current.Dispatcher.Invoke(new Action(() =>
  101. {
  102. Card4DoList.Clear();
  103. _do4.ForEach(x =>
  104. {
  105. if (x.Provider.ToLower() == "system.dio003")
  106. Card4DoList.Add(x);
  107. });
  108. }));
  109. }
  110. }
  111. private List<NotifiableIoItem> _ai;
  112. [Subscription("System.MotionAxis.AIList")]
  113. public List<NotifiableIoItem> AiListData
  114. {
  115. get
  116. {
  117. return _ai;
  118. }
  119. set
  120. {
  121. _ai = value;
  122. Application.Current.Dispatcher.Invoke(new Action(() =>
  123. {
  124. IOAiList.Clear();
  125. _ai.ForEach(x =>
  126. {
  127. if (x.Provider.ToLower() == "system.motionaxis")
  128. IOAiList.Add(x);
  129. });
  130. }));
  131. }
  132. }
  133. private List<NotifiableIoItem> _ao;
  134. [Subscription("System.MotionAxis.AOList")]
  135. public List<NotifiableIoItem> AoListData
  136. {
  137. get
  138. {
  139. return _ao;
  140. }
  141. set
  142. {
  143. _ao = value;
  144. Application.Current.Dispatcher.Invoke(new Action(() =>
  145. {
  146. IOAoList.Clear();
  147. _ao.ForEach(x =>
  148. {
  149. if (x.Provider.ToLower() == "system.motionaxis")
  150. IOAoList.Add(x);
  151. });
  152. }));
  153. }
  154. }
  155. public ICommand SetDoCommand
  156. {
  157. get; set;
  158. }
  159. public IoViewModel2LP() : base("IoViewModel2LP")
  160. {
  161. Card1DiList = new ObservableCollection<NotifiableIoItem>();
  162. Card2DoList = new ObservableCollection<NotifiableIoItem>();
  163. Card3DiList = new ObservableCollection<NotifiableIoItem>();
  164. Card4DoList = new ObservableCollection<NotifiableIoItem>();
  165. IOAiList = new ObservableCollection<NotifiableIoItem>();
  166. IOAoList = new ObservableCollection<NotifiableIoItem>();
  167. SetDoCommand = new DelegateCommand<string>(PerformSetDo);
  168. }
  169. private void PerformSetDo(string ioName)
  170. {
  171. }
  172. private void SetDo()
  173. {
  174. }
  175. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  176. {
  177. //data[UIKey(UnitName.System.ToString(), ParamName.WaferInfoRobotAligner01)] = new WaferInfo("dummy", WaferStatus.Normal);
  178. }
  179. }
  180. }