This commit is contained in:
Kathy Ruffing 2010-11-03 16:21:42 +00:00
parent e8c3a7347a
commit c5b362497b

View File

@ -6,6 +6,7 @@ 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>
@ -14,7 +15,29 @@ namespace VEPROMS
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmVEPROMS());
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();
}
}
}