jace.tang
2022-06-17 9bc010fc2b51ff02d1f7d09accc2847e3d925777
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
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
 
namespace M423project
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            bool createNew;
            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    //Application.Run(new MainForm());
                    FormStartup.LoadAndRun(new MainForm());
                }
                else
                {
                    // 程序已经运行,显示提示后退出
                    MessageBox.Show("应用程序已经运行!");
                    System.Environment.Exit(0);
                }
            }
        }
    }
}