AITConfigData.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 AITConfigData : 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. [DataMember]
  50. public string SystemType { get; set; }
  51. [DataMember]
  52. public string SectionName { get; set; }
  53. [DataMember]
  54. public string EntryName { get; set; }
  55. [DataMember]
  56. public string Description { get; set; }
  57. [DataMember]
  58. public string Description_zh { get; set; }
  59. [DataMember]
  60. public string Description_en { get; set; }
  61. [DataMember]
  62. public string Type { get; set; }
  63. [DataMember]
  64. public string Unit { get; set; }
  65. [DataMember]
  66. public string Value { get; set; }
  67. [DataMember]
  68. public string Default { get; set; }
  69. [DataMember]
  70. public string RangeLowLimit { get; set; }
  71. [DataMember]
  72. public string RangeUpLimit { get; set; }
  73. [DataMember]
  74. public string XPath { get; set; }
  75. public AITConfigData()
  76. {
  77. }
  78. public void Update(IDeviceData data)
  79. {
  80. throw new NotImplementedException();
  81. }
  82. }
  83. }