IoViewModelOnly1Card.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 IoViewModelOnly1Card : UIViewModelBase
  16. {
  17. public ObservableCollection<NotifiableIoItem> Card1DiList { get; set; }
  18. public ObservableCollection<NotifiableIoItem> Card1DoList { get; set; }
  19. private List<NotifiableIoItem> _di;
  20. [Subscription("System.dio000.DIList")]
  21. public List<NotifiableIoItem> DiListData
  22. {
  23. get
  24. {
  25. return _di;
  26. }
  27. set
  28. {
  29. _di = value;
  30. Application.Current.Dispatcher.Invoke(new Action(() =>
  31. {
  32. Card1DiList.Clear();
  33. _di.ForEach(x =>
  34. {
  35. if (x.Provider.ToLower() == "system.dio000")
  36. Card1DiList.Add(x);
  37. });
  38. }));
  39. }
  40. }
  41. private List<NotifiableIoItem> _do;
  42. [Subscription("System.dio000.DOList")]
  43. public List<NotifiableIoItem> DoListData
  44. {
  45. get
  46. {
  47. return _do;
  48. }
  49. set
  50. {
  51. _do = value;
  52. Application.Current.Dispatcher.Invoke(new Action(() =>
  53. {
  54. Card1DoList.Clear();
  55. _do.ForEach(x =>
  56. {
  57. if (x.Provider.ToLower() == "system.dio000")
  58. Card1DoList.Add(x);
  59. });
  60. }));
  61. }
  62. }
  63. public ICommand SetDoCommand
  64. {
  65. get; set;
  66. }
  67. public IoViewModelOnly1Card() : base("IoViewModelOnly1Card")
  68. {
  69. Card1DiList = new ObservableCollection<NotifiableIoItem>();
  70. Card1DoList = new ObservableCollection<NotifiableIoItem>();
  71. SetDoCommand = new DelegateCommand<string>(PerformSetDo);
  72. }
  73. private void PerformSetDo(string ioName)
  74. {
  75. }
  76. private void SetDo()
  77. {
  78. }
  79. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  80. {
  81. //data[UIKey(UnitName.System.ToString(), ParamName.WaferInfoRobotAligner01)] = new WaferInfo("dummy", WaferStatus.Normal);
  82. }
  83. }
  84. }