public static MqttClientService CreateInstance(string ipAddress) { if (_instance == null) { lock (lockObject) { if (_instance == null) { _instance = new MqttClientService(ipAddress); } } } return(_instance); }
private void Form1_Load(object sender, EventArgs e) { mqttClientService = MqttClientService.CreateInstance("127.0.0.1"); mqttClientService.OnMqttConnectNotify += MqttServerService_OnMqttConnectNotify; mqttClientService.OnMqttMessageNotify += MqttServerService_OnMqttMessageNotify; }