/// <summary> /// Disposes client and json client (if it was created inside this class) /// Updates are stopped from being sent to updates handler /// </summary> public void Dispose() { if (_disposeJsonClient) { CloseSynchronously(); } _receiver.Stop(); _receiver.Received -= OnReceived; _receiver.Dispose(); _receiver = null; if (_disposeJsonClient) { _tdJsonClient.Dispose(); } }
/// <summary> /// Disposes client and json client /// Updates are stopped from being sent to updates handler /// </summary> public void Dispose() { lock (_disposeLock) { if (_receiver == null || _tdJsonClient == null) { return; } CloseSynchronously(); _receiver.Dispose(); _receiver.Received -= OnReceived; _receiver.AuthorizationStateChanged -= OnAuthorizationStateChanged; _receiver = null; _tdJsonClient.Dispose(); _tdJsonClient = null; } }