public void Enable() { if (_isEnabled) { return; } _isEnabled = true; _dispatcher.Delay(_intervalMS, Tick); }
private void OnDisconnected(object sender, MqttClientDisconnectedEventArgs args) { if (Disconnected != null) { _dispatcher.Post(() => Disconnected.Invoke(_id, sender, args)); } if (_manualDisconnect) { _manualDisconnect = false; return; } if (!_retry) { return; } _dispatcher.Delay(RETRY_DELAY_MS, () => { try { if (_client != null) { _client.ConnectAsync(_options); } } catch { FizzLogger.E("Unable to reconnect to Fizz event service."); } }); }
private void OnDisconnected(bool clientConnected, Exception ex) { if (Disconnected != null) { _dispatcher.Post(() => Disconnected.Invoke(this, new FizzMqttDisconnectedArgs(clientConnected, ex))); } if (_manualDisconnect) { return; } if (!_retry) { return; } _dispatcher.Delay(RETRY_DELAY_MS, () => { try { if (_client != null && !_manualDisconnect) { ConnectInternal(); } } catch { FizzLogger.E("Unable to reconnect to Fizz event service."); } }); }
public FizzTimer(int delayMS, IFizzActionDispatcher dispatcher, Action onTimeout) { dispatcher.Delay(delayMS, () => { lock (_synclock) { if (!_aborted) { _timeout = true; onTimeout(); } } }); }