-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (26 loc) · 802 Bytes
/
Program.cs
File metadata and controls
27 lines (26 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.Diagnostics;
namespace SingSelector
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// 这么做并不严谨,但Good Enough To Me
using Mutex mutex = new(true, Process.GetCurrentProcess().ProcessName, out bool createdNew);
if (createdNew) // 成功创建了互斥体,即没有已经运行的进程
{
Application.EnableVisualStyles();
ApplicationConfiguration.Initialize();
Application.Run(new MainPage());
}
else
{
MessageBox.Show("请勿重复运行");
}
}
}
}