C
C#15mo ago
Cinthia

❔ 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
8 Replies
jcotton42
jcotton4215mo ago
do you have actual percentage information available to you, or are you just guessing?
Cinthia
Cinthia15mo ago
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
jcotton42
jcotton4215mo ago
then an indeterminate progress bar, ring, or throbber, combined with some descriptive captions, is a much better approach
Cinthia
Cinthia15mo ago
because my list only is created after the api request is finish thanks I will try to implement a ring
JakenVeina
JakenVeina15mo ago
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
Cinthia
Cinthia15mo ago
thank you, i was able to do work as I want today using BackgroundWorker
jcotton42
jcotton4215mo ago
Wait what Weren't you already using Task?
Accord
Accord15mo ago
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.
Want results from more Discord servers?
Add your server
More Posts
✅ cannot be accessed with an instance reference```cs public static class Details { // class for drawing event public class EventDrawModel ✅ MVVM Source Generator not copying attributesIt seems that if you do ```csharp [ObservableProperty, JsonIgnore] private ImageSource _MyBadPrope❔ error CS1525: Unexpected symbol `String'using System; public String DuplicateCount(string input) { foreach (char a in input) {❔ Newtonsoft json own read write methodHi there I want to serialized my struct to a json file and add support so specific types / field use❔ Calculating reading duration percentages for different time periodsI'm working on a project where I need to calculate the reading duration percentages for different ti❔ C# Rewrite ODT Links and download associated filesHello, I have a problem for several weeks on my c# code, my application is used to read an ODT file ❔ How to verify data according to DDD, SOLID and Clean Architecture?I own in two places one IF, it is: ```cs if(credential.Status != Credential.StatusType.Verified) ```✅ ✅ I can't display message in my dropdown if no data availablehttps://stackoverflow.com/questions/76199462/i-cant-display-message-in-my-dropdown-if-no-data-availa❔ Draggable markers on Gmap.NETI am using Gmap.NET and I'm trying to make the markers become draggable on the GUI. Any idea how to ❔ Using Allure for my tests but loading the report doesn’t usually workUsually when i try to open my report using “allure open “allure-report”” The server starts but acce