Device.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Runtime.CompilerServices;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace DeviceCenter
  9. {
  10. abstract class Device : INotifyPropertyChanged
  11. {
  12. private string _name;
  13. private string _ip;
  14. private Device.Type _type;
  15. private Device.Status _status;
  16. public enum Type
  17. {
  18. [Description("车牌识别")]
  19. CAR_CAM,
  20. [Description("门禁")]
  21. ACS
  22. }
  23. public enum Status
  24. {
  25. IDEL,
  26. CONNECTING,
  27. CONNECTED,
  28. FAIL
  29. }
  30. public string name
  31. {
  32. get { return _name; }
  33. set
  34. {
  35. _name = value;
  36. OnPropertyChanged();
  37. }
  38. }
  39. public string ip
  40. {
  41. get
  42. {
  43. return _ip;
  44. }
  45. set
  46. {
  47. _ip = value;
  48. OnPropertyChanged("ip");
  49. }
  50. }
  51. public Status status
  52. {
  53. get
  54. {
  55. return _status;
  56. }
  57. set
  58. {
  59. _status = value;
  60. OnPropertyChanged();
  61. }
  62. }
  63. public Type type
  64. {
  65. get {
  66. return _type;
  67. }
  68. set
  69. {
  70. _type = value;
  71. OnPropertyChanged();
  72. }
  73. }
  74. public event PropertyChangedEventHandler PropertyChanged;
  75. abstract public void Init();
  76. abstract public void dispose();
  77. protected void OnPropertyChanged([CallerMemberName] string name = null)
  78. {
  79. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
  80. }
  81. }
  82. }