Ejemplo n.º 1
0
 public void Stop()
 {
     _logger.Info("开始停止Exchange服务");
     try
     {
         if (_retryTimer != null)
         {
             _retryTimer.Change(Timeout.Infinite, Timeout.Infinite);
         }
         _pingTimer.Change(Timeout.Infinite, Timeout.Infinite);
         if (_client != null)
         {
             _client.Unsubscribe(ClientId);
             _client.Close();
         }
         _logger.Info("停止Exchange服务 成功");
     }
     catch (Exception ex)
     {
         _logger.Error("停止Exchange服务 失败, 出现异常", ex);
         _client.Abort();
     }
     finally
     {
         _serviceThread.Abort();
         _serviceThread = null;
     }
 }
Ejemplo n.º 2
0
 private void btnOperate_Click(object sender, EventArgs e)
 {
     if (_isRunning)
     {
         _client.Unsubscribe(_clientId);
         _client.Close();
     }
     else
     {
         if (string.IsNullOrEmpty(txtClientId.Text))
         {
             MessageBox.Show("请填写ClientId");
             return;
         }
         _clientId = txtClientId.Text;
         _client   = new Proxy.MessageServiceClient(new System.ServiceModel.InstanceContext(this));
         _client.Subscribe(_clientId);
     }
     _isRunning = !_isRunning;
     RefreshStatus();
 }