示例#1
0
        private HTTPClientResponse ResponseCallback(HTTPClientEventHandler handler, string html, string error)
        {
            HTTPClientResponse response = new HTTPClientResponse();

            response.raw = html;
            return(response);
        }
示例#2
0
        private void RequestResponseCallback(Object sender, DownloadStringCompletedEventArgs e)
        {
            HTTPClientEventHandler handler = e.UserState as HTTPClientEventHandler;

            handler(ResponseCallback(handler, e.Result, null));
            WebClient client = sender as WebClient;

            client.Dispose();
        }
示例#3
0
        private HTTPClientResponse ResponseCallback(HTTPClientEventHandler handler, string html, string error)
        {
            HTTPClientResponse response = new HTTPClientResponse();

            response.raw  = html;
            response.html = new HtmlDocument();
            response.html.LoadHtml(html);
            response.node = response.html.DocumentNode;
            return(response);
        }
示例#4
0
        public void RequestGet(string url, HTTPClientEventHandler handler, DownloadStringCompletedEventHandler callback)
        {
            if (client.IsBusy)
            {
                client.CancelAsync();
            }
            string u = url;

            client.DownloadStringCompleted -= callback;
            client.DownloadStringCompleted += callback;
            client.DownloadStringAsync(new Uri(u), handler);
        }
示例#5
0
 public void RequestGetAsync(string url, HTTPClientEventHandler handler)
 {
     Instance.RequestGet(url, handler, new DownloadStringCompletedEventHandler(RequestResponseCallback));
 }