Exemple #1
0
        /// <summary>
        /// Begins executing this async request.
        /// </summary>
        /// <param name="callback">The AsyncCallback delegate.</param>
        /// <param name="state">An object that contains state information for this request.</param>
        /// <returns>An IAsyncResult that references the asynchronous request.</returns>
        internal IAsyncResult BeginExecute(AsyncCallback callback, object state)
        {
            this.Validate();

            IEwsHttpWebRequest request = this.BuildEwsHttpWebRequest();

            WebAsyncCallStateAnchor wrappedState = new WebAsyncCallStateAnchor(this, request, callback /* user callback */, state /* user state */);

            // BeginGetResponse() does not throw interesting exceptions
            IAsyncResult webAsyncResult = request.BeginGetResponse(SimpleServiceRequestBase.WebRequestAsyncCallback, wrappedState);

            return(new AsyncRequestResult(this, request, webAsyncResult, state /* user state */));
        }