Any solid workaround for providing status update to the user while calling a time-consuming API at the same time?
Answer: You absolutely cannot safely perform any modification on the Revit database or use the Revit API in any way whatsoever, even for read-only purposes, except in a valid Revit API context; here is the final word on that.
My own progress bar implementation is provided by the ADN MEP sample application Adn Rme, originally dating way back to 2009 and earlier still.
Now Limin He of FM: Systems encountered and resolved an issue with his progress bar in VB.
This post introduces the Progress Reporter type, which greatly simplifies background tasks that need to do frequent progress reporting.
If you try to update a Progress Bar in a chunk of code that is running on the main UI thread and doing some work, the Progress Bar won’t update until all of the work is done.
For the background tasks that need to frequently update the UI (and can’t be easily split into “checkpointed” Tasks), another approach is necessary.
I tried the workaround you suggested using Application.The Progress Bar below shows that we’ve loaded 5 out of 12 records, so the Progress Bar is 42% full.In other cases, you may want to use a Progress Bar to show the user that something is happening, but you might not know how long the operation will take or how much of the total work has already been done.The TPL and higher-level abstractions (such as the Parallel class, Parallel LINQ, and the Reactive Extensions) will (hopefully) become the default approach for handling all multithreading situations.There is (almost) no reason to use the old Thread class anymore.