mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-07 12:16:04 +00:00
Add the mutex to avoid redundant
This commit is contained in:
parent
54af38b6b6
commit
d3135bef8e
|
@ -38,6 +38,7 @@ namespace WelsonJS.Launcher
|
|||
{
|
||||
e.Cancel = true;
|
||||
this.Hide();
|
||||
this.ShowInTaskbar = false;
|
||||
notifyIcon1.Visible = true;
|
||||
}
|
||||
base.OnFormClosing(e);
|
||||
|
@ -47,6 +48,7 @@ namespace WelsonJS.Launcher
|
|||
{
|
||||
this.Show();
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.ShowInTaskbar = true;
|
||||
this.Focus();
|
||||
notifyIcon1.Visible = false;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using WelsonJS.Launcher.Tools;
|
||||
|
||||
|
@ -9,14 +10,24 @@ namespace WelsonJS.Launcher
|
|||
{
|
||||
internal static class Program
|
||||
{
|
||||
static Mutex mutex;
|
||||
public static ResourceServer resourceServer;
|
||||
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
mutex = new Mutex(true, "WelsonJS.Launcher.Mutex", out bool isMutexNotExists);
|
||||
if (!isMutexNotExists)
|
||||
{
|
||||
MessageBox.Show("WelsonJS Launcher already running.");
|
||||
return;
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
|
||||
mutex.ReleaseMutex();
|
||||
}
|
||||
|
||||
public static void RunCommandPrompt(string workingDirectory, string entryFileName, string scriptName, bool isConsoleApplication = false, bool isInteractiveServiceAapplication = false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user