using System.Threading; namespace Neta.Tray; public static class SingleInstance { private static Mutex? _mutex; public static bool TryAcquire() { _mutex = new Mutex(true, @"Local\Neta.Tray", out var createdNew); if (!createdNew) { _mutex.Dispose(); _mutex = null; } return createdNew; } }