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); }
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; }
private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action <HttpResponse, RequestAsyncHandle> callback) { callback(httpResponse, asyncHandle); }
private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action<HttpResponse, RequestAsyncHandle> callback) { callback(httpResponse, asyncHandle); }