示例#1
0
 public void Dispose()
 {
     Request          = null;
     RequestCallbacks = null;
     Response         = null;
     Content          = null;
 }
示例#2
0
        CilHttpRequest(
            IHttpMessageHandlerRequestCallbacks requestCallbacks,
            string method, string url)
        {
            Request = new HttpRequest(url)
            {
                Method = method
            };
            RequestCallbacks = requestCallbacks;

            Request.OnHeadersReceived =
                webResponse => CilHttpMessageHandler.AddEvent(() =>
            {
                Response = new HttpResponse(webResponse);
                RequestCallbacks.OnHeadersReceived();
            });

            Request.OnProgress =
                (current, total) => CilHttpMessageHandler.AddEvent(() =>
            {
                RequestCallbacks.OnProgress(current, total, (total > 0));
            });

            Request.OnDoneCallback =
                content => CilHttpMessageHandler.AddEvent(() =>
            {
                Content = content;
                RequestCallbacks.OnDone();
            });

            Request.OnExeptionCallback =
                x => CilHttpMessageHandler.AddEvent(() =>
            {
                RequestCallbacks.OnError(x.Message);
            });
        }
示例#3
0
 public static CilHttpRequest Create(
     IHttpMessageHandlerRequestCallbacks requestCallbacks,
     string method, string url)
 {
     return(new CilHttpRequest(requestCallbacks, method, url));
 }