public void DownloadCryptoData() { if (_savedCrypto == null) { return; } var downloadedCrypto = new List <CryptoDataModel>(); var cryptoDownloadTaskList = new List <Task <BasicCryptoModel> >(); for (int i = 0; i < _savedCrypto.Count; i++) { cryptoDownloadTaskList.Add(_compareService.GetBasicCrypto(_savedCrypto[i].Symbol)); } //Wait all one by one while (cryptoDownloadTaskList.Count > 0) { var index = Task.WaitAny(cryptoDownloadTaskList.ToArray()); downloadedCrypto.Add(new CryptoDataModel { Data = cryptoDownloadTaskList[index].Result, Conditions = CryptoModelConverter.GetUnserializedRequestParameters(_savedCrypto.Single(s => s.Symbol == cryptoDownloadTaskList[index].Result.Symbol)) }); cryptoDownloadTaskList.Remove(cryptoDownloadTaskList[index]); } _cryptoDataModels = downloadedCrypto; }
private async void OnAddToTracker() { if (AppliedToTracker == null) { return; } var cryptoDataModel = new CryptoDataModel { Data = await _compareService.GetBasicCrypto(SelectedCryptoName), Conditions = FilterDictionary.Values.ToList() }; AppliedToTracker(this, new ApplyToTrackerEventArgs(cryptoDataModel, true)); }