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

            foreach (var site in websites)
            {
                WebSiteDataModel results = DownloadWebSite(site);
                ReportWebSiteInfo(results);
            }
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        private async Task RunDownloadAsync()
        {
            List <string> websites = PrepData();

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

                ReportWebSiteInfo(results);
            }
        }
Ejemplo n.º 4
0
 private void ReportWebSiteInfo(WebSiteDataModel data)
 {
     resultsWindow.Text += $"{ data.WebSiteUrl } downloaded: { data.WebSiteData.Length } characters long. { Environment.NewLine }";
 }