mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-27 20:17:00 +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;
|
e.Cancel = true;
|
||||||
this.Hide();
|
this.Hide();
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
notifyIcon1.Visible = true;
|
notifyIcon1.Visible = true;
|
||||||
}
|
}
|
||||||
base.OnFormClosing(e);
|
base.OnFormClosing(e);
|
||||||
|
@ -47,6 +48,7 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
this.Show();
|
this.Show();
|
||||||
this.WindowState = FormWindowState.Normal;
|
this.WindowState = FormWindowState.Normal;
|
||||||
|
this.ShowInTaskbar = true;
|
||||||
this.Focus();
|
this.Focus();
|
||||||
notifyIcon1.Visible = false;
|
notifyIcon1.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using WelsonJS.Launcher.Tools;
|
using WelsonJS.Launcher.Tools;
|
||||||
|
|
||||||
|
@ -9,14 +10,24 @@ namespace WelsonJS.Launcher
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
static Mutex mutex;
|
||||||
public static ResourceServer resourceServer;
|
public static ResourceServer resourceServer;
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
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.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new MainForm());
|
Application.Run(new MainForm());
|
||||||
|
|
||||||
|
mutex.ReleaseMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RunCommandPrompt(string workingDirectory, string entryFileName, string scriptName, bool isConsoleApplication = false, bool isInteractiveServiceAapplication = false)
|
public static void RunCommandPrompt(string workingDirectory, string entryFileName, string scriptName, bool isConsoleApplication = false, bool isInteractiveServiceAapplication = false)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user