using Bro.Common.Helper;
|
using Bro.Common.Model.Authority;
|
using System;
|
using System.Threading;
|
using System.Windows.Forms;
|
|
namespace Bro.UI.Config
|
{
|
static class Program
|
{
|
static MainFrm configFrm = null;
|
/// <summary>
|
/// 应用程序的主入口点。
|
/// </summary>
|
[STAThread]
|
static void Main()
|
{
|
if (!AuthorityCheck.AuthorityCheckOperation())
|
{
|
MessageBox.Show("加密狗本地检测和远程检测失败!请本地插入加密狗或确认远程加密服务就绪。");
|
Environment.Exit(1);
|
}
|
|
bool isAppRunning = false;
|
Mutex mutex = new Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out isAppRunning);
|
if (!isAppRunning)
|
{
|
MessageBox.Show("程序已运行,不能再次打开!");
|
Environment.Exit(1);
|
}
|
|
Application.EnableVisualStyles();
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
Application.ThreadException += Application_ThreadException;
|
|
configFrm = new MainFrm();
|
Application.Run(configFrm);
|
|
AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
|
Application.ThreadException -= Application_ThreadException;
|
}
|
|
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
{
|
string msg = e.Exception.GetExceptionMessage();
|
//mainFrm.RecordMsg(msg);
|
//configFrm.RecordMsg(DateTime.Now, "ThreadException", msg, true);
|
MessageBox.Show(msg);
|
}
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
{
|
string msg = (e.ExceptionObject as Exception).GetExceptionMessage();
|
//configFrm.RecordMsg(DateTime.Now, "UnhandleException", msg, true);
|
MessageBox.Show(msg);
|
}
|
}
|
}
|