I am using mutex to check one instance at the time. It works, but to be perfect I need to fix one bug. If program is in minimized state it will not restore it self after I click Ok. Any ideas?
This is in Program.cs :
if (process.Id != current.Id)
{
SetForegroundWindow(process.MainWindowHandle);
MessageBox.Show(new Form1 { TopMost = true }, "Application is already running!");
Form1 f1 = new Form1();
f1.WindowState = FormWindowState.Normal; // dont work
f1.BringToFront(); // dont work
f1.Focus(); // dont work
break;
}