Ejemplo n.º 1
0
 private void btnSubscribe_Click(object sender, EventArgs e)
 {
     try
     {
         _service.Subscribe();
     }
     catch (Exception ex)
     {
         MessageBox.Show(@"Ошибка взаимодействия с сервисом");
         _service.Abort();
         _service = _factory.CreateChannel();
     }
 }
Ejemplo n.º 2
0
        private void OnClosed(object sender, EventArgs eventArgs)
        {
            if (_service?.State == CommunicationState.Faulted)
            {
                _service?.Abort();
            }
            else
            {
                _service?.Close();
            }

            if (_factory?.State == CommunicationState.Faulted)
            {
                _factory?.Abort();
            }
            else
            {
                _factory?.Close();
            }
        }