You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace RfidWeb
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应用程序的主入口点。
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
// 获取当前运行的进程名
|
|
|
|
|
string currentProcessName = Process.GetCurrentProcess().ProcessName;
|
|
|
|
|
|
|
|
|
|
// 检查是否存在其他同名进程
|
|
|
|
|
var processes = Process.GetProcessesByName(currentProcessName);
|
|
|
|
|
if (processes.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
// 如果有多个同名进程,说明已经有实例在运行
|
|
|
|
|
MessageBox.Show("应用程序已在运行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
|
|
|
Application.EnableVisualStyles();
|
|
|
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
|
Application.Run(new FormMain());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|