var mutex = new Mutex(false, "TestShareMutex", out bool createdNew);var commEvent0 = new EventWaitHandle(false, EventResetMode.ManualReset, "TestEvent0");var attachEvent = new EventWaitHandle(false, EventResetMode.ManualReset, "TestAttachEvent");if (!createdNew){ mutex.WaitOne();}int waitTime = 9000000;if (mutex.WaitOne(waitTime)){ attachEvent.Set(); mutex.ReleaseMutex(); bool b = mutex.WaitOne(waitTime); bool a = attachEvent0.WaitOne(waitTime); System.Diagnostics.Debug.WriteLine(a.ToString()); Thread.Sleep(800); if (a && b) { mutex.ReleaseMutex(); }}
Package.appxmanifest