Ejemplo n.º 1
0
        private void RunDownloadWebSync()
        {
            List <String> websiteCollection = getWebSite();

            foreach (var ws in websiteCollection)
            {
                WebSiteDataModel wsd = getWebSiteData(ws);
                ReportWebSiteInfo(wsd);
            }
        }
Ejemplo n.º 2
0
        private WebSiteDataModel getWebSiteData(String ws)
        {
            WebSiteDataModel wdsm = new WebSiteDataModel();

            WebClient wc = new WebClient();

            wdsm.WebSiteUri  = ws;
            wdsm.WebSiteData = wc.DownloadString(new Uri(ws));

            return(wdsm);
        }
Ejemplo n.º 3
0
        private async Task <WebSiteDataModel> getWebSiteDataAsync(String ws)
        {
            WebSiteDataModel wdsm = new WebSiteDataModel();

            WebClient wc = new WebClient();

            wdsm.WebSiteUri  = ws;
            wdsm.WebSiteData = await wc.DownloadStringTaskAsync(new Uri(ws));

            return(wdsm);
        }
Ejemplo n.º 4
0
 public void ReportWebSiteInfo(WebSiteDataModel wsd)
 {
     ViewData["timer3"] += $"{wsd.WebSiteUri} downloaded :{wsd.WebSiteData.Length} characters long.{Environment.NewLine}";
 }