private void HandleMultiInstance() { _mutex = new Mutex(true, @"Global\WinDynamicDesktop", out bool isFirstInstance); GC.KeepAlive(_mutex); if (isFirstInstance) { ipcServer = IpcManager.StartServer(); } else { if (ThemeManager.importPaths.Count > 0) { // TODO Test passing string[] through named pipe IpcManager.SendArgsToServer(ThemeManager.importPaths.ToArray()); } else { MessageDialog.ShowWarning(_("Another instance of WinDynamicDesktop is already running. You can " + "access it by clicking on the icon in the system tray."), _("Error")); } Environment.Exit(0); } }
private void HandleMultiInstance() { ipcManager = new IpcManager(); if (ipcManager.isFirstInstance) { ipcManager.ListenForArgs(OnArgumentsReceived); } else { if (ThemeManager.importPaths.Count > 0) { ipcManager.SendArgsToFirstInstance(ThemeManager.importPaths.ToArray()); } else { MessageDialog.ShowWarning(_("Another instance of WinDynamicDesktop is already running. You can " + "access it by clicking on the icon in the system tray."), _("Error")); } Environment.Exit(0); } }