Silverlight-4.0 – How to make sure the Silverlight OOB application has only one instance?

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

Or do I need to manually enforce this by creating some kind of primitive mutex?

If I have to enforce it myself, I will consider creating a file in quarantine storage as a lock, and then delete it when exiting. I will check if this file exists at startup to prevent opening subsequent instances .
Obviously, I need a way to handle app crashes or exit other ways that prevent locked files from being deleted. My intuition is that the file times out and if it exceeds a certain period of time, ignore it. Unfortunately, the app Play the movie, so it may run for several hours under normal conditions. In this case, no user will be affected by the lock timeout for several hours. Is there a better solution?

Check out this link:

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

Maybe it will help.

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

Or do I need to manually enforce this by creating some kind of primitive mutex?

If I have to enforce it myself, I will consider creating a file in quarantine storage as a lock, and then delete it when exiting. I will check if this file exists at startup to prevent opening subsequent instances .
Obviously, I need a way to handle app crashes or exit other ways that prevent locked files from being deleted. My intuition is that the file times out and if it exceeds a certain period of time, ignore it. Unfortunately, the app Play the movie, so it may run for several hours under normal conditions. In this case, no user will be affected by the lock timeout for several hours. Is there a better solution?

Check out this link:

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

Maybe it will help.

Leave a Comment

Your email address will not be published.