public void Close() { if (_client == null) { return; } try { /*if (_client.ClientCredentials != null) * { * _client.ClientCredentials.UserName.UserName = "******"; * _client.ClientCredentials.UserName.Password = "******".Reverse().ToString(); * }*/ _client.UnsubscribeFromPasswordChange(); } catch (Exception exception) { _client?.Abort(); _client = null; Logger?.LogTextMessage($"UnsubscribeFromPasswordChange() - error: {exception.Message}"); return; } try { _client?.Close(); } catch (Exception) { } _client = null; }
public void Close() { if (_client == null) { return; } try { _client.UnsubscribeFromPasswordChange(); } catch (Exception exception) { _client.Abort(); _client = null; Logger?.LogTextMessage($"UnsubscribeFromPasswordChange() - error: {exception.Message}"); return; } try { _client.Close(); } catch (Exception) { } _client = null; }
void ProcessCancellationPending() { if (_client == null) { return; } if (Config.TaskCancellationToken.Token.IsCancellationRequested) { if (_client.State == CommunicationState.Faulted) { _client.Abort(); } else { _client.Close(); } _client = null; } }