The InstanceMethodThatRefreshesProgressbar method will be called every time when it’s possible since 0 means “execute in the next event loop” (add the method to a window or something)
From the method, Read the progress value from a property in the thread.
How so? Simply move ALL your code into the thread. The long-running code will finish and then the next process will start. If you need multiple processes to run in sequence, while still leaving the UI responsive, put them all into the same thread. They will run in sequence.
You will need to ensure that the user can’t start some other process in the mean time. Disable buttons as needed.