示例#1
0
            public void DownloadHtmlStringWithEvent(string url)
            {
                var html = MyWebClient.DownloadString(url);

                EventHandler <HtmlReceivedEventArgs> handler = HtmlStringReceived;
                var args = new HtmlReceivedEventArgs {
                    Html = html
                };

                if (null != handler)
                {
                    handler(this, args);
                }
            }
示例#2
0
            public async Task <string> DownloadHtmlString(string url)
            {
                var task   = MyWebClient.DownloadStringTaskAsync(url);
                var result = await task;

                EventHandler <HtmlReceivedEventArgs> handler = HtmlStringReceived;
                var args = new HtmlReceivedEventArgs {
                    Html = result
                };

                if (null != handler)
                {
                    handler(this, args);
                }

                return(result);
            }