43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
|
|
namespace VEPROMS
|
|
{
|
|
static class Program
|
|
{
|
|
private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
|
|
{
|
|
Application.Run(new frmVEPROMS());
|
|
}
|
|
else
|
|
{
|
|
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
|
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
|
Application.Run(new frmVEPROMS());
|
|
}
|
|
}
|
|
|
|
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
_log.Error("PROMS2010 Main UnhandledException", e.ExceptionObject as Exception);
|
|
Application.Exit();
|
|
}
|
|
|
|
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
|
{
|
|
_log.Error("PROMS2010 Main ThreadException", e.Exception);
|
|
Application.Exit();
|
|
}
|
|
}
|
|
} |