I want to do a series of actions and simultaneously depend on exception it throw or doesn’t throw any exception update my UI, how can I achieve something like this?
I’ve already tried making new thread for each step but it doesn’t wait until one of steps ends and it writes fail message always, using Thread.Join() didn’t help either because it blocks UI thread too…
You need BackgroundWorker. Put the code you want to execute in background thread in
DoWorkhandler and code of updating UI inRunWorkerCompletedevent handler.In case you want to update GUI in between from
DoWorkhandler, you can queue it on UI dispatcher like this –