コード例 #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);
        }
コード例 #2
0
ファイル: Http.cs プロジェクト: smartandcoolbear/BmobSharp
        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;
        }
コード例 #3
0
 private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action <HttpResponse, RequestAsyncHandle> callback)
 {
     callback(httpResponse, asyncHandle);
 }
コード例 #4
0
ファイル: Http.cs プロジェクト: smartandcoolbear/BmobSharp
 private void ProcessResponse(HttpResponse httpResponse, RequestAsyncHandle asyncHandle, Action<HttpResponse, RequestAsyncHandle> callback)
 {
     callback(httpResponse, asyncHandle);
 }