Example #1
0
        public RequestAsyncHandle ExecuteAsync(Action <HttpResponse, RequestAsyncHandle> callback)
        {
            var asyncHandle = new RequestAsyncHandle();

            Action <HttpResponse> response_cb = r => ProcessResponse(r, asyncHandle, callback);

#if !PocketPC
            if (UseSynchronizationContext && SynchronizationContext.Current != null)
            {
                var ctx = SynchronizationContext.Current;
                var cb  = response_cb;

                response_cb = resp => ctx.Post(s => cb(resp), null);
            }
#endif

            asyncHandle.WebRequest = AsAsync(Method, response_cb);
            return(asyncHandle);
        }
Example #2
0
        public RequestAsyncHandle ExecuteAsync(Action<HttpResponse, RequestAsyncHandle> callback)
        {
            var asyncHandle = new RequestAsyncHandle();

            Action<HttpResponse> response_cb = r => ProcessResponse(r, asyncHandle, callback);

#if !PocketPC
            if (UseSynchronizationContext && SynchronizationContext.Current != null)
            {
                var ctx = SynchronizationContext.Current;
                var cb = response_cb;

                response_cb = resp => ctx.Post(s => cb(resp), null);
            }
#endif

            asyncHandle.WebRequest = AsAsync(Method, response_cb);
            return asyncHandle;
        }
Example #3
0
 private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action <HttpResponse, RequestAsyncHandle> callback)
 {
     callback(httpResponse, asyncHandle);
 }
Example #4
0
 private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action<HttpResponse, RequestAsyncHandle> callback)
 {
     callback(httpResponse, asyncHandle);
 }