I have a component which opens a window for fitness landscape visualisation. I’d like to implement a progressbar when this visualisation refreshes (via a button clicked in the main window). Because the refreshing takes a while to run, the refreshing code typically runs as a BackgroundWorker class, while the progressBar takes on the UI thread.
However the refreshing involves retrieving information from another component which requires expiring the solution, and calls to Grasshopper UI should only be called in the main UI thread.
Running the progress bar in the backgroundWorker class does not work. (Is it because the thread is pushed to a lower priority than the main thread?) The progress bar does not show (until the refresh is complete, so it flickers into existence for a moment and then immediately exits).
Is there a way I can implement the progress bar in my main window? I would like for the user to know that the code is not hanging when it’s doing the task of refreshing.