C
C#16mo ago
Relevant

❔ ✅ Best practice for tracking progress for long running method

I am creating a Blazor Server application. I have a method that is compiling some data from a few servers. I'd like to show some sort of progress bar to show the user approximately how much is left. Currently the method just returns a List of all of the objects that was compiled during the process. This is being done in a service class, so I wouldn't have access to the UI elements from the method. So is there a way to send progress information back to the caller periodically? I could refactor the method to do 1 server at a time, that way I'll know, for example, that it's 3 of 8 completed, etc. And I could break it down even further to split apart each section of processing to get even more granular. But that seems like it could be more work than it's worth for just a UI nicety. Is there some super neat way of doing this better?
2 Replies
Relevant
Relevant16mo ago
Okay, that was easy, just needed to look up IProgress<T> !close
Accord
Accord16mo ago
Closed! 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
❔ So I've created a downloader, how do I link a progress bar to it? Winform, .NET frameworkhere's my code (website down rn): ```private void button1_Click(object sender, EventArgs e) ❔ Downloading string from webclient isnt responding properly to my if statement.So im trying to make a version check by grabbing the data from a raw github link, it gets the data b❔ how to make an API callI have tried looking up tutorials but they ended up making me more confused. I want to take a string❔ Best approach to share several properties application-wide in a WinUI3 project?Hi, I am looking for the preferred way, following the best practices for a small scale desktop appli❔ Blazor communicate with WebAPI on localhost serverHello, I want to start making a staging environment for my application, I got a WebAPI ready and wor❔ Get Pixels cords from Image by their colorHey, I'm writing a game and I need to get the pixels cords by their colors from an Image, I tried us❔ Storing & retrieving face encodings to compareWhat's the best way to store face encodings (an array of size 128 and type float64) in a database an❔ New to C# and am trying to make a Minesweeper console appI am having trouble with my "UpdateBoard" method and I can not seem to figure out what the problem i❔ System.Data.OleDb.OleDbException: 'Could not find installable ISAM.' errorHi anyone can help me? i start the test and i got System.Data.OleDb.OleDbException: 'Could not find ❔ Accounting for Daylight Savings Time skips at runtimeMy Discord bot I am developing has a reminder system which utilizes <https://github.com/robbell/nChr