68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
|
namespace HisenceYoloDetection
|
|||
|
{
|
|||
|
internal static class Program
|
|||
|
{
|
|||
|
static MainForm? mainFrm = 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);
|
|||
|
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, "<22>߳<EFBFBD><DFB3>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>");
|
|||
|
}
|
|||
|
|
|||
|
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, "δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>쳣");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|