namespace luoqicheng
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
InitApplication();
bool createNew;
try
{
using (Mutex mutex = new Mutex(true, "Global\\" + Application.ProductName, out createNew))
{
if (createNew)
{
Application.Run(new FormOCV());
}
else
{
}
}
// Console.ReadKey();
}
catch (Exception ex)
{
Application.ExitThread();
}
}
public static void InitApplication()
{
Application.ThreadException += Application_ThreadEexception;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// LogTy.Instance.Write(LogType.MAIN, "当前域发生没有处理的异常:", (Exception)e.ExceptionObject);
}
private static void Application_ThreadEexception(object sender, System.Threading.ThreadExceptionEventArgs e)
{
// LogTy.Instance.Write(LogType.MAIN, "当前线程发生没有处理的异常:", e.Exception);
}
}
}