Esempio n. 1
0
        private void RunDownloadSync()
        {
            List <string> websites = GetWebsites();

            foreach (string site in websites)
            {
                WebsiteDataModel results = DownloadWebsite(site);
                ReportWebsiteInfo(results);
            }
        }
Esempio n. 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);
        }
Esempio n. 3
0
        private async Task RunDownloadAsync()
        {
            List <string> websites = GetWebsites();

            foreach (string site in websites)
            {
                WebsiteDataModel results = await Task.Run(() => DownloadWebsite(site));

                ReportWebsiteInfo(results);
            }
        }
Esempio n. 4
0
 private void ReportWebsiteInfo(WebsiteDataModel data)
 {
     resultWindow.Text += $"{ data.WebsiteUrl } downloaded: { data.WebsiteData.Length } characters long. { Environment.NewLine }";
 }