hisence-yolo-detection/HisenceYoloDetection/Program.cs

71 lines
2.4 KiB
C#
Raw Normal View History

2024-05-31 10:14:57 +08:00
namespace HisenceYoloDetection
{
internal static class Program
{
static MainForm? mainFrm = null;
2024-06-11 11:40:47 +08:00
static Form1? form1 = null;
2024-05-31 10:14:57 +08:00
/// <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);
2024-06-11 11:40:47 +08:00
//form1 = new Form1();
//Application.Run(form1);
2024-05-31 10:14:57 +08:00
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>쳣");
}
}
}
}