MVVM async progress meter example using the Task Parallel Library

I’ve just posted up on GitHub a quick example WPF application that shows an MVVM-style progress meter dialog, using the .NET 4.5 Task Parallel Library (TPL). Specifically demonstrating:

  • A progress meter using .NET 4 Tasks (not BackgroundWorkers).
  • Async support.
  • Cancelling of Tasks via CancellationTokens.
  • Exception handling back to the original thread.
  • Reporting background progress updates via IProgress<T>.
  • Tasks can either be declared as void, or have a return value.
  • Progress can be reported from multiple tasks chained together.
  • An injectable, stateless IProgressDialogService, that can be injected for unit testing purposes.
  • Using an attached property to hide the close button in the progress dialog’s title bar using Win32 interop.
  • Using an attached property to implement a close window command using MVVM.

screenshot

It’s based off a blog post by Jürgen Bäurle but converted to use MVVM and the TPL.