private void btnSubscribe_Click(object sender, EventArgs e) { try { _service.Subscribe(); } catch (Exception ex) { MessageBox.Show(@"Ошибка взаимодействия с сервисом"); _service.Abort(); _service = _factory.CreateChannel(); } }
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(); } }