71 lines
2.4 KiB
C#
71 lines
2.4 KiB
C#
namespace HisenceYoloDetection
|
|
{
|
|
internal static class Program
|
|
{
|
|
static MainForm? mainFrm = null;
|
|
static Form1? form1 = null;
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
|
|
static void Main()
|
|
{
|
|
try
|
|
{
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
// see https://aka.ms/applicationconfiguration.
|
|
ApplicationConfiguration.Initialize();
|
|
mainFrm = new MainForm();
|
|
Application.Run(mainFrm);
|
|
//form1 = new Form1();
|
|
//Application.Run(form1);
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
Application.ThreadException += Application_ThreadException;
|
|
}catch (Exception ex)
|
|
{
|
|
}
|
|
|
|
|
|
}
|
|
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
|
{
|
|
string msg = e.Exception.Message;
|
|
|
|
using (StreamWriter sw = new StreamWriter("D://ThreadException.log", true))
|
|
{
|
|
sw.WriteLine("================================");
|
|
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
|
sw.WriteLine(msg);
|
|
sw.Flush();
|
|
}
|
|
|
|
|
|
if (mainFrm != null)
|
|
{
|
|
// mainFrm.DockFrm_OnLogMsgOutput(new LogMsg(DateTime.Now, EnumHelper.LogLevel.Exception, msg));
|
|
}
|
|
//MessageBox.Show(msg, "Ïß³ÌÒì³£±¨¾¯");
|
|
}
|
|
|
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
string msg = (e.ExceptionObject as Exception).Message;
|
|
|
|
using (StreamWriter sw = new StreamWriter("D://UnhandledException.log", true))
|
|
{
|
|
sw.WriteLine("================================");
|
|
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
|
sw.WriteLine(msg);
|
|
sw.Flush();
|
|
}
|
|
|
|
if (mainFrm != null)
|
|
{
|
|
//mainFrm.DockFrm_OnLogMsgOutput(new LogMsg(DateTime.Now, EnumHelper.LogLevel.Exception, msg));
|
|
//MessageBox.Show(msg, "δ´¦ÀíÒì³£");
|
|
}
|
|
|
|
}
|
|
}
|
|
} |