7 Aralık 2017 Perşembe

c# Uygulama bilgisayarda bir defa çalışması için kontrol




Control to prevent the application from opening twice;

Uygulamamızın Bilgisyarda aynı anda iki defa çalışmasını engellemek için :

foreach (var item in System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName))
                {

                    if (item.Id != System.Diagnostics.Process.GetCurrentProcess().Id)
                    {
                        item.Kill();
                        item.Close();
                    }

                }