Ejemplo n.º 1
0
        /// <summary>
        /// Receive message from AsyncTcpManager
        /// </summary>
        /// <param name="message"></param>
        public void ReceiveMessage(object message)
        {
            if (QueryEvent != null)
            {
                //Asyncronized query
                if (message is QueryResult)
                {
                    _QueryResult = message as QueryResult;
                }
                else if (message is InnerServerException)
                {
                    _AsyncException = new ServerException(message as InnerServerException);
                }
                else if (message is TcpRemoteCloseException)
                {
                    _AsyncException = message as TcpRemoteCloseException;
                }
                else if (message is Exception)
                {
                    _AsyncException = message as Exception;
                }

                this.EndAsyncQuery();
                QueryEvent.Set();
                return;
            }

            //Syncronized query
            if (OnReceiveAsyncMessage != null)
            {
                OnReceiveAsyncMessage(message);
            }
        }