2026-07-14 13:55:17 +08:00
|
|
|
using HslCommunication;
|
2026-07-14 19:24:01 +08:00
|
|
|
using JY.DAL;
|
2026-07-14 13:55:17 +08:00
|
|
|
using JY.Utility;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace JY.Inspection
|
|
|
|
|
{
|
|
|
|
|
static class Program
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public delegate void RunWorkHandler();
|
|
|
|
|
private static HomeForm mFrmMain;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应用程序的主入口点。
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
if (Authorization.SetAuthorizationCode("b5f8f9f7-c075-4913-ae6e-d7d2cc6f2de1"))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("注册成功");
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
|
|
|
|
Application.ThreadException += Application_ThreadException;
|
|
|
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
|
|
|
Application.EnableVisualStyles();
|
|
|
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
|
IniFileHelper.CreateIniFile(Application.StartupPath + "\\Config\\", "Configure.ini");
|
|
|
|
|
string mutexName = Assembly.GetEntryAssembly().FullName;
|
|
|
|
|
string title = IniFileHelper.ReadIniData("SYSTEM_CONFIGURE", "Project_Name");
|
2026-07-14 19:24:01 +08:00
|
|
|
|
|
|
|
|
IocConfig.Initialize();
|
|
|
|
|
|
2026-07-14 13:55:17 +08:00
|
|
|
mFrmMain = new HomeForm();
|
|
|
|
|
bool isFirst;
|
|
|
|
|
using (new Mutex(false, mutexName, out isFirst))
|
|
|
|
|
{
|
|
|
|
|
if (!isFirst)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(title + " 已运行,请勿重复启动!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Application.Run(mFrmMain);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteException(ex, string.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteException(e.Exception, string.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteException(e.ExceptionObject as Exception, e.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|