How to prevent Windows Media Center from launching multiple copies of your application

I posted an item on the Media Center Sandbox site today that I wanted to link here as well in case anyone is interested. Windows Media Center maintains separate process spaces for each application that is launched and stores up to 8 of them in a back-stack to allow users to navigate back to their previous experiences. Because of this feature, it is possible to launch multiple instances of a Windows Media Center application. This can lead to performance bottlenecks and resource contention issues.

Jossef Goldberg, a program manager on the Windows Presentation Foundation (WPF) team, recently published some sample code that demonstrates how to implement a solution that uses a mutex to prevent Windows Media Center from launching more than one instance of an application.

I encourage you to check out my Sandbox blog post for a more in-depth description of the algorithm to address this issue, and also to check out this post from Jossef for a link to download a sample XBAP solution that uses this algorithm.