Example #1
0
        /// <summary>
        /// Begins an asynchronous operation to transmit a request message to the reply-side
        /// of a request-reply message exchange
        /// </summary>
        /// <param name="message">The request System.ServiceModel.Channels.Message to be transmitted</param>
        /// <param name="timeout">The System.TimeSpan that specifies the interval of time within which a response
        /// must be received</param>
        /// <param name="callback">The System.AsyncCallback delegate that receives the notification of the completion
        /// of the asynchronous operation transmitting a request message</param>
        /// <param name="state"></param>
        /// <returns></returns>
        public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
        {
            AsyncRequest req    = new AsyncRequest(Request);
            IAsyncResult result = req.BeginInvoke(message, timeout, callback, state);

            _asyncRequests.Add(result.AsyncWaitHandle, req);
            _asyncResults.Add(result.AsyncWaitHandle, result);
            return(result);
        }
Example #2
0
        /// <summary>
        /// Begins an asynchronous operation to transmit a request message to the reply-side
        /// of a request-reply message exchange
        /// </summary>
        /// <param name="message">The request System.ServiceModel.Channels.Message to be transmitted</param>
        /// <param name="callback">The System.AsyncCallback delegate that receives the notification of the completion
        /// of the asynchronous operation transmitting a request message</param>
        /// <param name="state">An object, specified by the application, that contains state information
        /// associated with the asynchronous operation transmitting a request message</param>
        /// <returns>The System.IAsyncResult that references the asynchronous message transmission</returns>
        public IAsyncResult BeginRequest(Message message, AsyncCallback callback, object state)
        {
            AsyncRequest req    = new AsyncRequest(Request);
            IAsyncResult result = req.BeginInvoke(message, TimeSpan.MaxValue, callback, state);

            lock (_asyncRequests) {
                _asyncRequests.Add(result.AsyncWaitHandle, req);
                _asyncResults.Add(result.AsyncWaitHandle, result);
            }
            return(result);
        }
 public void Execute()
 {
     m_invokeRequest.BeginInvoke(m_request, this.Callback, null);
 }