I have a problem when i want use mutex to force single instance of my program.
I a winform App with a WebBrowser Control. I need to autorestart if certain conditions ar
I do:
bool onlyInstance = false;
mutex = new System.Threading.Mutex(true, "qFluid", out onlyInstance);
int cntrSec = 0;
//per far funzionare restart ,aspetto per 3 sec per vedere se va via servizio
while (!onlyInstance & cntrSec < 3)
{
System.Threading.Thread.Sleep(1000);
cntrSec += 1;
}
if (!onlyInstance)
{
Xceed.Wpf.Toolkit.MessageBox.Show("The application is already arunning");
App.Current.Shutdown();
}