コード例 #1
0
        async void HandleRacePicker_SelectedItemChanged(object sender, EventArgs e)
        {
            if (raceCollection?.races != null)
            {
                if (RacePicker.SelectedIndex >= 0 && RacePicker.SelectedIndex < raceCollection.races.Length)
                {
                    Models.Race race = raceCollection.races[RacePicker.SelectedIndex];

                    await PopulateResultsListAsync(race);
                }
            }
        }
コード例 #2
0
        async Task PopulateResultsListAsync(Models.Race race)
        {
            string url = string.Format(RACES_RESULTS_URL_FORMAT, race.id);

            string json;

            using (var client = new WebClient())
            {
                json = await client.DownloadStringTaskAsync(url);
            }
            Models.RaceResultCollection results = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.RaceResultCollection>(json);

            ResultsList.ItemsSource = results.results;
        }