Device.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.ComponentModel;
  2. using System.Runtime.CompilerServices;
  3. namespace DeviceCenter
  4. {
  5. public class Device : INotifyPropertyChanged
  6. {
  7. private string _name;
  8. private string _ip;
  9. private int _port;
  10. private string _username;
  11. private string _password;
  12. private DeviceType _type;
  13. private DeviceStatus _status;
  14. private Direction _direction;
  15. public long? areaId { get; set; }
  16. public long? buildingId { get; set; }
  17. public long? floorId { get; set; }
  18. private string _message;
  19. public Device() { }
  20. public string name
  21. {
  22. get { return _name; }
  23. set
  24. {
  25. _name = value;
  26. OnPropertyChanged();
  27. }
  28. }
  29. public string ip
  30. {
  31. get
  32. {
  33. return _ip;
  34. }
  35. set
  36. {
  37. _ip = value;
  38. OnPropertyChanged("ip");
  39. }
  40. }
  41. public int port
  42. {
  43. get
  44. {
  45. return _port;
  46. }
  47. set
  48. {
  49. _port = value;
  50. OnPropertyChanged("port");
  51. }
  52. }
  53. public string username
  54. {
  55. get
  56. {
  57. return _username;
  58. }
  59. set
  60. {
  61. _username = value;
  62. OnPropertyChanged("username");
  63. }
  64. }
  65. public string password
  66. {
  67. get
  68. {
  69. return _password;
  70. }
  71. set
  72. {
  73. _password = value;
  74. OnPropertyChanged("password");
  75. }
  76. }
  77. public DeviceStatus status
  78. {
  79. get
  80. {
  81. return _status;
  82. }
  83. set
  84. {
  85. _status = value;
  86. OnPropertyChanged();
  87. }
  88. }
  89. public DeviceType type
  90. {
  91. get
  92. {
  93. return _type;
  94. }
  95. set
  96. {
  97. _type = value;
  98. OnPropertyChanged();
  99. }
  100. }
  101. public Direction direction
  102. {
  103. get
  104. {
  105. return _direction;
  106. }
  107. set
  108. {
  109. _direction = value;
  110. OnPropertyChanged();
  111. }
  112. }
  113. public string message
  114. {
  115. get
  116. {
  117. return _message;
  118. }
  119. set
  120. {
  121. _message = value;
  122. OnPropertyChanged();
  123. }
  124. }
  125. public event PropertyChangedEventHandler PropertyChanged;
  126. public virtual void Init() { }
  127. public virtual void dispose() { }
  128. protected void OnPropertyChanged([CallerMemberName] string name = null)
  129. {
  130. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  131. }
  132. }
  133. }