Mercurial > silverbladetech
diff Stocks/Stocks.Service/StocksService.cs @ 4:57f20ba55884
Fix for webClientShim to use downloadString instead of downloadData
Refactoring and introduction of static TimedDelegates.Execute() helper method
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Mon, 20 Feb 2012 23:04:58 +0700 |
parents | 29ed98d659e9 |
children | c812bca7b1ac |
line wrap: on
line diff
--- a/Stocks/Stocks.Service/StocksService.cs Mon Feb 20 22:29:44 2012 +0700 +++ b/Stocks/Stocks.Service/StocksService.cs Mon Feb 20 23:04:58 2012 +0700 @@ -7,6 +7,7 @@ using Stocks.Common; using Stocks.Common.Events; using Stocks.Common.Models; +using Stocks.Common.Core; namespace Stocks.Service { @@ -79,13 +80,14 @@ { try { - Stopwatch timeToDownload = new Stopwatch(); + Stopwatch timeToDownload; while (IsActive) { - timeToDownload.Restart(); - string webResponse = _webClient.DownloadString(_serviceUrl); - timeToDownload.Stop(); + string webResponse = TimedDelegates.Execute<string>( + _webClient.DownloadString, + _serviceUrl, + out timeToDownload); PopulatePricesFromWebResponse(webResponse); UpdateStats(timeToDownload, webResponse);