I can check if the application is already running and show a message box that says "The app is already open, please double click on the system tray icon to show it". What I want is that when the user try to open the app again it shows the opened instance. How can I do that?
string ProsesAdi = Process.GetCurrentProcess().ProcessName;
Process[] sonuc = Process.GetProcessesByName(ProsesAdi);
if (sonuc.Length > 1)
{
MessageBox.Show("Uygulama zaten açik. Sistem tepsisindeki simgeye çift tiklayin.", "Bilgi");
System.Environment.Exit(0);
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}