This commit is contained in:
parent
e8c3a7347a
commit
c5b362497b
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user