You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using Microsoft.VisualBasic.ApplicationServices;
|
|
namespace ControlSystem
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// 单实例应用程序类
|
|
/// </summary>
|
|
class SingleInstanceApplication : WindowsFormsApplicationBase
|
|
{
|
|
static SingleInstanceApplication application;
|
|
internal static SingleInstanceApplication Application
|
|
{
|
|
get
|
|
{
|
|
if (application == null)
|
|
{
|
|
application = new SingleInstanceApplication();
|
|
}
|
|
|
|
return application;
|
|
}
|
|
}
|
|
|
|
public SingleInstanceApplication()
|
|
{
|
|
this.IsSingleInstance = true;
|
|
}
|
|
protected override void OnCreateMainForm()
|
|
{
|
|
this.MainForm =FrmMain.FormInstance;
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 应用程序的主入口点。
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main(string[] args)
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
SingleInstanceApplication.Application.Run(args);
|
|
|
|
}
|
|
}
|
|
}
|