So I’ve found this information
What is a good pattern for using a Global Mutex in C#?
But it’s based on the main entry point of a standard app.
How do you modify this to work for the WPF event model of starting the app?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It looks like the big issue is that when Startup is called by default it calls Show() on the main form.
Since this means the function returns, wrapping the Startup call in the mutex like the original example I linked, the lock on the mutex is released shortly after startup. If you either change the way Statup opens the main from from Show() to ShowDialog() it works as expected.