Soumen Roy
asked on
Updating list view with repeated API calls
Hi Experts,
I am developing a Universal Windows Platform software with VS2015 CE. I am calling some web API through JSON and passing those data to my application.
I have one list view that displays a list of data call from various APIs. The whole list view needs to be replaced with a button click event. The list is being generated the first time when the application is loading. However the list does not seem to be refreshed with the desired button click.
Part of my Code is as follows:
-------------------------- ---------- -------
Regards,
Soumen
I am developing a Universal Windows Platform software with VS2015 CE. I am calling some web API through JSON and passing those data to my application.
I have one list view that displays a list of data call from various APIs. The whole list view needs to be replaced with a button click event. The list is being generated the first time when the application is loading. However the list does not seem to be refreshed with the desired button click.
Part of my Code is as follows:
--------------------------
private void btnCur_Click(object sender, RoutedEventArgs e)
{
if (btnCur.Content.Equals("USD"))
btnCur.Content="EUR";
else
btnCur.Content = "USD";
gdContents(Convert.ToString(btnCur.Content));
}
private async void gdContents(string un)
{
MyProgressRing.IsActive = true;
MyProgressRing.Visibility = Visibility.Visible;
//The APIData class has a function to manage the API calls and put them in a list
Data = new ObservableCollection<APIData>();
await APIDataManager.PopulateAPIDataAsync(Data, un);
MyProgressRing.IsActive = false;
MyProgressRing.Visibility = Visibility.Collapsed;
}
Regards,
Soumen
If that doesn't work, could you post your APIDataManager.PopulateAPI DataAsync method
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. It worked nicely :-)
to fix it, set your button click as async
make your gdContents methode return a Task then at the end of your method return a null object.
return Task.FromResult<object>(nu
Open in new window
try that and let me know if it works
Ok try that