示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
 void ProcessCancellationPending()
 {
     if (_client == null)
     {
         return;
     }
     if (Config.TaskCancellationToken.Token.IsCancellationRequested)
     {
         if (_client.State == CommunicationState.Faulted)
         {
             _client.Abort();
         }
         else
         {
             _client.Close();
         }
         _client = null;
     }
 }