/// <summary> /// /// </summary> /// <param name="uniqueName"></param> /// <returns>True is another instance is already running. False otherwise</returns> public static Boolean CheckForOtherApp(String uniqueName) { SingleAppComEventName = uniqueName; try { // another instance is already running threadComEvent = EventWaitHandle.OpenExisting(SingleAppComEventName); threadComEvent.Set(); // signal the other instance. threadComEvent.Close(); return true; // return immediatly. } catch { /* don't care about errors */ } // Create the Event handle threadComEvent = new EventWaitHandle(false, EventResetMode.AutoReset, SingleAppComEventName); // make sure the resources are cleaned up afterwards. cleanupCode = new CleanupCode(); CreateInterAppComThread(); return false; }
public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData);
public static void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) { }
public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, object?userData);