Exemplo n.º 1
0
        // ###############################################################################################
        //  (GET) list of coins
        internal async static Task GetCoinList()
        {
            string URL = "https://min-api.cryptocompare.com/data/top/totalvol?limit=100&tsym=" + coin
                         + "&api_key=569e637087fe54f3c739de6f8618187f805fb0a5f662f9179add6c027809c286";
            Uri uri = new Uri(URL);

            try {
                var data = await GetJSONAsync(uri);

                JSONcoins.HandleJSON(data);

                // Get coins ranked 101-200
                uri  = new Uri(URL + "&page=1");
                data = await GetJSONAsync(uri);

                JSONcoins.HandleJSON(data);

                // Get coins ranked 201-300
                uri  = new Uri(URL + "&page=2");
                data = await GetJSONAsync(uri);

                JSONcoins.HandleJSON(data);
            } catch (Exception ex) {
                await new MessageDialog(ex.Message).ShowAsync();
            }
        }
Exemplo n.º 2
0
        private async void InitValues()
        {
            JSONcoins coin = App.coinList.Find(x => x.Name == crypto);

            cdw.cd = await API_CoinGecko.GetCoin(coin.FullName);

            TimeSpan period = TimeSpan.FromSeconds(30);

            PeriodicTimer = ThreadPoolTimer.CreatePeriodicTimer(async(source) => {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                    RadioButton r = new RadioButton {
                        Content = timeSpan
                    };
                    if (timeSpan == "hour" && this.Frame.SourcePageType.Name == "CoinDetails")
                    {
                        TimerangeButton_Click(r, null);
                    }
                });
            }, period);

            try {
                RadioButton r = new RadioButton {
                    Content = timeSpan
                };
                TimerangeButton_Click(r, null);
            } catch (Exception) {
                LoadingControl.IsLoading = false;
                //var dontWait = new MessageDialog(ex.ToString()).ShowAsync();
            }
        }