private void TryToEstablishPipeConnection() { try { var connection = StorageServicePipeAccessPoint.GetConnection(); serviceConnection = connection.CreateChannel(); StorageServicePipeButton.IsEnabled = (connection.State != CommunicationState.Faulted && connection.State != CommunicationState.Closed); StorageServicePipeTextBlock.Text = connection.State.ToString(); } catch (Exception error) { MessageBox.Show(error.Message); } }
private void PushMessage(MasevaMessage message) { try { serviceChannel.SendStorageMessage(message); if (notPushedNotifications.Count > 0) { ResendNotPuched(); } } catch (System.Exception ex) { _serviceChannel = null; notPushedNotifications.Enqueue(message); var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Error(ex.ToString()); } }
private void OnConnectionFall(Object sender, EventArgs e) { _serviceChannel = null; }
private void InitializeNetwork() { connection = StorageServicePipeAccessPoint.GetConnection(); connection.Faulted += OnConnectionFall; _serviceChannel = null; }