views:

19

answers:

1

Is there a way to ensure that only a single instance of the desktop version of a trusted Silverlight 4 Out Of Browser app will run?

Or do I need to manually enforce this through the creation of a crude mutex of some sort?

If I must enforce this myself, I'd look at creating a file in isolated storage as a lock and then deleting it on exit. I'd check this files existence on launch to prevent opening a subsequent instance. Obviously I'd need a way to handle the app crashing or exiting some other way that prevents the lock file from being deleted. My instinct would be to have a timeout on the file and so ignore it if it's over a certain period of time old. Unfortunately, the app plays movies so it's likely it will run for several hours under normal circumstances. A lock timeout of a few hours isn't likely to be popular with any users in this situation. Are there any better solutions?

+2  A: 

Hi,

Check out this link:

http://www.tozon.info/blog/post/2009/11/01/Detecting-duplicate-instances-of-a-running-Silverlight-application.aspx

Perhaps it will help.

Vixen
What a brilliant, simple solution. It worked great. Thanks
Matt Lacey