private void RunDownloadSync() { List <string> webSites = PrepData(); foreach (string site in webSites) { WebsiteDataModel results = DownloadWebsite(site); ReportWebsiteInfo(results); } }
private WebsiteDataModel DownloadWebsite(string site) { WebsiteDataModel output = new WebsiteDataModel(); WebClient client = new WebClient(); output.WebsiteURL = site; output.WebsiteData = client.DownloadString(site); return(output); }
private async Task RunDownloadAsync() { List <string> webSites = PrepData(); foreach (string site in webSites) { WebsiteDataModel results = await Task.Run(() => DownloadWebsite(site)); ReportWebsiteInfo(results); } }
private void ReportWebsiteInfo(WebsiteDataModel data) { resultWindow.Text += $"{data.WebsiteURL} downloaded: {data.WebsiteData.Length} charecters long. {Environment.NewLine}"; }