using System.ComponentModel; using System.Runtime.CompilerServices; namespace DeviceCenter { public class Device : INotifyPropertyChanged { private string _name; private string _ip; private int _port; private string _username; private string _password; private DeviceType _type; private DeviceStatus _status; private Direction _direction; public long? areaId { get; set; } public long? buildingId { get; set; } public long? floorId { get; set; } private string _message; public Device() { } public string name { get { return _name; } set { _name = value; OnPropertyChanged(); } } public string ip { get { return _ip; } set { _ip = value; OnPropertyChanged("ip"); } } public int port { get { return _port; } set { _port = value; OnPropertyChanged("port"); } } public string username { get { return _username; } set { _username = value; OnPropertyChanged("username"); } } public string password { get { return _password; } set { _password = value; OnPropertyChanged("password"); } } public DeviceStatus status { get { return _status; } set { _status = value; OnPropertyChanged(); } } public DeviceType type { get { return _type; } set { _type = value; OnPropertyChanged(); } } public Direction direction { get { return _direction; } set { _direction = value; OnPropertyChanged(); } } public string message { get { return _message; } set { _message = value; OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; public virtual void Init() { } public virtual void dispose() { } protected void OnPropertyChanged([CallerMemberName] string name = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } } }