In my WPF application, I need to run 2 long running tasks in parallel, both which return data that needs to be shown in the UI.
I have a a property in my view model called IsBusy, which should be true until both tasks have completed.
How to I get a notification when the 2 long running tasks have completed?
I don’t want to use Task.WaitAll, because it will block my UI thread. I don’t want to chain the tasks using ContinueWith, because I want those long running tasks to run in parallel.
Use TaskScheduler.FromCurrentSynchronizationContext() and pass it to TaskFactory.ContinueWhenAll(…) to do UI update after both tasks completed.