Nobody likes seeing the hourglass… [Keep your application responsive with BackgroundTaskManager on WPF and Silverlight]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (9)
  1. Thank you for submitting this cool story – Trackback from DotNetShoutout

  2. davehorner says:

    great work….it’s a very clean solution.  Thanks for the nice article.


  3. mcnamaragio says:

    What if an exception is thrown in the background task?

  4. David Anson says:


    The MSDN documentation for the DoWork event describes what happens if an exception is thrown:

    Hope this helps!

  5. Ido Ran says:


    I’ve been trying to make a reusable background worker close to the one you show here.

    Your work looks good and I’ve learn from it, the obvious down-side is that your class is singleton and so can only be one instance in the whole system. You might want to have different section of your system have independent background task management.

    Also you left out the exception handling.

    Thank you,


  6. David Anson says:

    Thanks for the feedback, Ido! It’s always great when people are able to work off of each other’s ideas to come up with even better things! 🙂

  7. Grant says:


    I'm wanting to include a BGThread manager in my code, and I'm having issues translating your class to VB.Net..

    Specifically the following…

    1. public static EventHandler<EventArgs> BackgroundTaskStarted;

    2. var backgroundTaskStartedHandler = BackgroundTaskStarted;

           if (null != backgroundTaskStartedHandler)


               backgroundTaskStartedHandler.Invoke(null, EventArgs.Empty);


    I would appreciate it very much if you could supply a equivelant..

  8. David Anson says:


    I'm on vacation and don't have a compiler available at the moment – however, maybe try something like the following to get started:


    Public Shared BackgroundTaskCompleted As EventHandler(Of EventArgs)


    ' Invoke the BackgroundTaskStarted event

    Dim backgroundTaskStartedHandler = BackgroundTaskStarted

    If backgroundTaskStartedHandler IsNot Nothing Then

       backgroundTaskStartedHandler.Invoke(Nothing, EventArgs.Empty)

    End If

    If that doesn't help, maybe try one of the many VB.NET/C# code translation tools on the web. Thanks!

Comments are closed.

Skip to main content