private async void CountriesBtn_Click(object sender, RoutedEventArgs e) { var cts = new CancellationTokenSource(TimeSpan.FromMinutes(CTS_TIMEOUT_DEFAULT)); var ct = cts.Token; this.CountriesList.ItemsSource = new string[] { "...loading..." }; var data = await CountriesService.GetCountriesAsync($"{App.API_BASE_URL}/countries?delay=5s", ct, captureContext : false); this.CountriesList.ItemsSource = data; }
/// Retrieves api results. private async Task <IQueryable <Data.Models.CountryModel> > ApiQuery() { return(await _countriesService.GetCountriesAsync()); }