Пример #1
0
        private void RunDownloadSync()
        {
            List <string> websites = PrepData();

            foreach (var site in websites)
            {
                WebSiteDataModel results = DownloadWebSite(site);
                ReportWebSiteInfo(results);
            }
        }
Пример #2
0
        private WebSiteDataModel DownloadWebSite(string webSiteUrl)
        {
            WebSiteDataModel output = new WebSiteDataModel();
            WebClient        client = new WebClient();

            output.WebSiteUrl  = webSiteUrl;
            output.WebSiteData = client.DownloadString(webSiteUrl);

            return(output);
        }
Пример #3
0
        private async Task RunDownloadAsync()
        {
            List <string> websites = PrepData();

            foreach (var site in websites)
            {
                WebSiteDataModel results = await Task.Run(() => DownloadWebSite(site));

                ReportWebSiteInfo(results);
            }
        }
Пример #4
0
 private void ReportWebSiteInfo(WebSiteDataModel data)
 {
     resultsWindow.Text += $"{ data.WebSiteUrl } downloaded: { data.WebSiteData.Length } characters long. { Environment.NewLine }";
 }