❔ Best loading progress WPF
Hello guys,
I need to implement a progress bar using IProgress interface, The problem is that I did something like this:
private async task LoadData(IProgress<int> progress)
{
var connection = await networkService.CheckConnectionAsync(); if(!connection.IsSuccess) { wait LoadDataBaseCountries(); progress.Report(100); } other { wait dataService.DeleteData(); progress.Report(33); wait LoadApiCountries(); progress.Report(66); wait dataService.SaveData(Country); progress.Report(100); } LoadComboBoxData(); } and the bar loads very quickly, but what takes longer to complete is the API, and I don't know how to implement slower loading on the bar
var connection = await networkService.CheckConnectionAsync(); if(!connection.IsSuccess) { wait LoadDataBaseCountries(); progress.Report(100); } other { wait dataService.DeleteData(); progress.Report(33); wait LoadApiCountries(); progress.Report(66); wait dataService.SaveData(Country); progress.Report(100); } LoadComboBoxData(); } and the bar loads very quickly, but what takes longer to complete is the API, and I don't know how to implement slower loading on the bar
8 Replies
do you have actual percentage information available to you, or are you just guessing?
I am just guessing
I read some documentation, and usually they take the values in a List Loop, but I dont understand how to do that
then an indeterminate progress bar, ring, or throbber, combined with some descriptive captions, is a much better approach
because my list only is created after the api request is finish
thanks I will try to implement a ring
yeah, from a user's point of view, an indeterminate progress bar is annoying
but it's less annoying than a progress bar that's just not accurate
what you should do, if at all possible, is restructure to get yourself a definite known progress
I.E. pre-query to get a count value
or just embed one in the data you're retrieving/parsing
and embed it at the front
thank you, i was able to do work as I want today using BackgroundWorker
Wait what
Weren't you already using Task?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.
Was this issue resolved? If so, run /close
- otherwise I will mark this as stale and this post will be archived until there is new activity.