AITAlignerData.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Runtime.Serialization;
  7. using System.Text;
  8. using System.Windows.Input;
  9. using Aitex.Core.UI.MVVM;
  10. namespace Aitex.Core.Common.DeviceData
  11. {
  12. [DataContract]
  13. [Serializable]
  14. public class AITAlignerData : INotifyPropertyChanged, IDeviceData
  15. {
  16. public event PropertyChangedEventHandler PropertyChanged;
  17. public void InvokePropertyChanged(string propertyName)
  18. {
  19. if (PropertyChanged != null)
  20. {
  21. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  22. }
  23. }
  24. public void InvokePropertyChanged()
  25. {
  26. PropertyInfo[] ps = this.GetType().GetProperties();
  27. foreach (PropertyInfo p in ps)
  28. {
  29. InvokePropertyChanged(p.Name);
  30. if (p.PropertyType == typeof (ICommand))
  31. {
  32. DelegateCommand<string> cmd = p.GetValue(this, null) as DelegateCommand<string>;
  33. if (cmd != null)
  34. cmd.RaiseCanExecuteChanged();
  35. }
  36. }
  37. FieldInfo[] fi = this.GetType().GetFields();
  38. foreach (FieldInfo p in fi)
  39. {
  40. InvokePropertyChanged(p.Name);
  41. if (p.FieldType == typeof (ICommand))
  42. {
  43. DelegateCommand<string> cmd = p.GetValue(this) as DelegateCommand<string>;
  44. if (cmd != null)
  45. cmd.RaiseCanExecuteChanged();
  46. }
  47. }
  48. }
  49. /// <summary>
  50. /// 阀的唯一名称,UI与RT交互的ID
  51. /// </summary>
  52. [DataMember]
  53. public string DeviceName { get; set; }
  54. /// <summary>
  55. /// 显示在界面上的名称
  56. /// </summary>
  57. [DataMember]
  58. public string DisplayName { get; set; }
  59. /// <summary>
  60. /// IO 表中定义的物理编号,物理追溯使用 比如: V122
  61. /// </summary>
  62. [DataMember]
  63. public string DeviceSchematicId { get; set; }
  64. [DataMember]
  65. public bool IsInitalized { get; set; }
  66. [DataMember]
  67. public bool IsBusy { get; set; }
  68. [DataMember]
  69. public bool IsCommunicationError { get; set; }
  70. [DataMember]
  71. public int State { get; set; }
  72. [DataMember]
  73. public int ErrorCode { get; set; }
  74. [DataMember]
  75. public int ElapseTime { get; set; }
  76. [DataMember]
  77. public int Notch { get; set; }
  78. public bool IsError
  79. {
  80. get { return ErrorCode > 0 || IsCommunicationError; }
  81. }
  82. public AITAlignerData()
  83. {
  84. DisplayName = "Undefined";
  85. }
  86. public void Update(IDeviceData data)
  87. {
  88. }
  89. }
  90. public class AITAlignerOperation
  91. {
  92. public const string Home = "Home";
  93. public const string Align = "Align";
  94. public const string Reset = "Reset";
  95. public const string Stop = "Stop";
  96. }
  97. public class AITAlignerPropertyName
  98. {
  99. }
  100. }