using Configuration.Annotations; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Configuration { public class MQTT : INotifyPropertyChanged { private int _reconnectDelayMilliseconds = 5000; private string _clientId = Guid.NewGuid().ToString(); private string _host = string.Empty; private int _port = 1883; private string _subscribeTopic = string.Empty; private string _publishTopic = string.Empty; private string _password = string.Empty; private string _username = string.Empty; private bool _enabled = false; public bool Enabled { get => _enabled; set { if (value == _enabled) return; _enabled = value; OnPropertyChanged(); } } public int ReconnectDelayMilliseconds { get => _reconnectDelayMilliseconds; set { if (value == _reconnectDelayMilliseconds) return; _reconnectDelayMilliseconds = value; OnPropertyChanged(); } } public string ClientId { get => _clientId; set { if (value == _clientId) return; _clientId = value; OnPropertyChanged(); } } public string Host { get => _host; set { if (value == _host) return; _host = value; OnPropertyChanged(); } } public int Port { get => _port; set { if (value == _port) return; _port = value; OnPropertyChanged(); } } public string SubscribeTopic { get => _subscribeTopic; set { if (value == _subscribeTopic) return; _subscribeTopic = value; OnPropertyChanged(); } } public string PublishTopic { get => _publishTopic; set { if (value == _publishTopic) return; _publishTopic = value; OnPropertyChanged(); } } public string Username { get => _username; set { if (value == _username) return; _username = value; OnPropertyChanged(); } } public string Password { get => _password; set { if (value == _password) return; _password = value; OnPropertyChanged(); } } [UsedImplicitly] public MQTT() { } public event PropertyChangedEventHandler PropertyChanged; [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }