void _ClientMessageHandlerProxy_CommunicationStateChanged(object sender, CommunicationStateChangedEventArgs e)
        {
            IClientMessageHandlerProxy clientMessageHandlerProxy = sender as IClientMessageHandlerProxy;

            switch (e.CommunicationStatus)
            {
            case CommunicationStatus.Opened:
                // we have a connection, subscribe to web application events
                clientMessageHandlerProxy.Subscribe(WEB_APPLICATION_MESSAGE_ROUTING_KEY);

                if (this.CommunicationStateChanged != null)
                {
                    this.CommunicationStateChanged(this, e);
                }

                break;
            }
        }
Esempio n. 2
0
        private void CommunicationChannel_StateChanged(ICommunicationChannel sender, CommunicationStateChangedEventArgs e)
        {
            //Process only Closed event
            if (sender.State != CommunicationStates.Closed)
            {
                return;
            }

            //Pulse waiting threads for incoming messages, because disconnected to the server, and can not receive message anymore.
            lock (_waitingMessages)
            {
                foreach (var waitingMessage in _waitingMessages.Values)
                {
                    waitingMessage.WaitEvent.Set();
                }

                _waitingMessages.Clear();
            }
        }
Esempio n. 3
0
 void applicationMessageHandler_CommunicationStateChanged(object sender, CommunicationStateChangedEventArgs e)
 {
     // we have successfully connected to the application server
 }