private IEnumerator OnReceiveCoinList(WWW req) { yield return(req); CoinListResponse resp = CoinListResponse.FromJson(req.text); foreach (Datum d in resp.Data.Values) { CoinManager.AddCoin(d); } FindObjectOfType <PortfolioScene>().Init(); }
private IEnumerator OnReceiveCoinList(WWW req) { yield return(req); CoinListResponse resp = CoinListResponse.FromJson(req.text); foreach (Datum d in resp.Data.Values) { AddCoin(d); } CoinListBuilt(); }
/// <summary> /// Gets the available assets of the API and fires the OnAvailableAssetsReceived event if successful. /// Fires the OnApiError event if something has gone wrong. /// </summary> private async Task GetAvailableAssetsAsync() { bool callFailed = false; List <Asset> availableAssets = new List <Asset>(); do { callFailed = false; try { CoinListResponse response = await this.client.Coins.ListAsync(); this.ApiData.IncreaseCounter(1); this.FireOnAppDataChanged(); foreach (KeyValuePair <string, CoinInfo> coin in response.Coins) { this.availableAssets.Add( new Asset { AssetId = coin.Value.Id, Name = coin.Value.Name, Symbol = coin.Value.Symbol }); } this.availableAssets = this.availableAssets.OrderBy(ass => ass.SymbolName).ToList(); this.FireOnAvailableAssetsReceived(); } catch (HttpRequestException) { callFailed = true; Thread.Sleep(retryDelay); } }while (callFailed); }