Beispiel #1
0
 static async Task<List<Stock>> GetStocks()
 {
     var http = new StockHTTP();
     var queries = await http.DownloadCompaniesFromCSVAsync();
     List<Stock> stocks = new List<Stock>();
     decimal i = 1.0M;
     decimal totals = queries.Count;
     foreach (var query in queries)
     {
         List<Stock> results = await http.DownloadStocksFromYQL(query);
         results.ForEach(r => stocks.Add(r));
         Console.WriteLine(string.Format("{0:p} Complete", (i / totals)));
         i += 1;
     }
     return stocks;
 }
Beispiel #2
0
 public async Task<List<Stock>> GetStocks()
 {
     var http = new StockHTTP();
     var queries = await http.DownloadCompaniesFromCSVAsync();
     List<Stock> stocks = new List<Stock>();
     decimal i = 1.0M;
     decimal totals = queries.Count;
     foreach (var query in queries)
     {
         List<Stock> results = await http.DownloadStocksFromYQL(query);
         results.ForEach(r => stocks.Add(r));
         OnProgressChanged?.Invoke(this, (i / totals));
         i += 1;
     }
     OnProgressChanged?.Invoke(this, 1);
     OnDownloadComplete?.Invoke(this, EventArgs.Empty);
     return stocks;
 }
Beispiel #3
0
 public async Task<List<Stock>> GetStocks()
 {
     List<Stock> stocks = new List<Stock>();
     try
     {
         var http = new StockHTTP();
         var queries = await http.DownloadCompaniesFromCSVAsync();
         decimal i = 1.0M;
         decimal totals = queries.Count;
         foreach (var query in queries)
         {
             List<Stock> results = await http.DownloadStocksFromYQL(query);
             results.ForEach(r => stocks.Add(r));
             i += 1;
         }
     }
     catch { throw; }
     return stocks;
 }