private static Mutex CreateMutex(string name) { if (String.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } // Allow Everyone to signal the mutex from medium or higher integrity levels. MutexSecurity security = new MutexSecurity(); SignalViewModel.SetSecurity(security); // Create the mutex without taking ownership. bool created = false; Mutex mtx = new Mutex(false, name, out created, security); return mtx; }
private static EventWaitHandle CreateEvent(string name, bool auto) { if (String.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } // Allow everyone to signal the event from medium or higher integrity levels. EventWaitHandleSecurity security = new EventWaitHandleSecurity(); SignalViewModel.SetSecurity(security); // Create the event without signaling. EventResetMode mode = auto ? EventResetMode.AutoReset : EventResetMode.ManualReset; bool created = false; EventWaitHandle evt = new EventWaitHandle(false, EventResetMode.AutoReset, name, out created, security); return evt; }