public bool EndWaitForMessage(IAsyncResult result)
        {
            DoneReceivingAsyncResult doneRecevingResult = result as DoneReceivingAsyncResult;

            if (doneRecevingResult != null)
            {
                DoneReceivingAsyncResult.End(doneRecevingResult);
                return(true);
            }

            return(this.receiveQueue.EndWaitForItem(result));
        }
        public bool EndTryReceive(IAsyncResult result, out Message message)
        {
            DoneReceivingAsyncResult doneReceivingResult = result as DoneReceivingAsyncResult;

            if (doneReceivingResult != null)
            {
                DoneReceivingAsyncResult.End(doneReceivingResult, out message);
                return(true);
            }

            bool success = this.receiveQueue.EndDequeue(result, out message);

            if (success)
            {
                ProcessReceivedMessage(message);
            }

            return(success);
        }
 public static void End(DoneReceivingAsyncResult result)
 {
     AsyncResult.End <DoneReceivingAsyncResult>(result);
 }
 public static void End(DoneReceivingAsyncResult result, out Message message)
 {
     message = null;
     AsyncResult.End <DoneReceivingAsyncResult>(result);
 }