Exemplo n.º 1
0
        private void RunDownloadSync()
        {
            List <string> webSites = PrepData();

            foreach (string site in webSites)
            {
                WebsiteDataModel results = DownloadWebsite(site);
                ReportWebsiteInfo(results);
            }
        }
Exemplo n.º 2
0
        private WebsiteDataModel DownloadWebsite(string site)
        {
            WebsiteDataModel output = new WebsiteDataModel();
            WebClient        client = new WebClient();

            output.WebsiteURL  = site;
            output.WebsiteData = client.DownloadString(site);

            return(output);
        }
Exemplo n.º 3
0
        private async Task RunDownloadAsync()
        {
            List <string> webSites = PrepData();

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

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