コード例 #1
0
        public IAsyncResult BeginGetResponse <TBody>(string url, AsyncCallback asyncCallback, object state)
        {
            var asyncResult    = new HttpClientAsyncResult <TBody>(asyncCallback, state);
            var descriptorDict = new Dictionary <string, object>()
            {
                { "url", url },
                { "asyncResultAddress", ManagedGCHandle.FromObject((IMarkCompleted)asyncResult).Address }
            };

            BeginFetch(MiniJSON.Json.Serialize(descriptorDict));
            return(asyncResult);
        }
コード例 #2
0
ファイル: HttpClient.cs プロジェクト: ebekker/Blazor-Legacy
        private IAsyncResult BeginGetResponse(string url, AsyncCallback asyncCallback, object state)
        {
            var asyncResult    = new HttpClientAsyncResult(asyncCallback, state);
            var gcHandle       = GCHandle.Alloc(asyncResult, GCHandleType.Pinned);
            var descriptorDict = new Dictionary <string, object>()
            {
                { "url", url },
                { "asyncResultAddress", gcHandle.AddrOfPinnedObject().ToInt32() }
            };

            BeginFetch(Json.Serialize(descriptorDict));
            return(asyncResult);
        }
コード例 #3
0
        private IAsyncResult BeginResponse(string method, string url, string body, string mediaType, AsyncCallback asyncCallback, object state)
        {
            Console.WriteLine($"CALLED BeginResponse({method}, {url}, {body}, {mediaType}, ...)");
            var asyncResult    = new HttpClientAsyncResult(asyncCallback, state);
            var gcHandle       = GCHandle.Alloc(asyncResult, GCHandleType.Pinned);
            var descriptorDict = new Dictionary <string, object>()
            {
                { "method", method },
                { "body", body },
                { "mediaType", mediaType },
                { "url", url },
                { "asyncResultAddress", gcHandle.AddrOfPinnedObject().ToInt32() }
            };

            BeginFetch(Json.Serialize(descriptorDict));
            Console.WriteLine($"RETURNING BeginResponse({method}, {url}, {body}, {mediaType}, ...)");
            return(asyncResult);
        }