-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (31 loc) · 1.08 KB
/
Copy pathProgram.cs
File metadata and controls
33 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using ScreenRecorder.Tray;
namespace ScreenRecorder;
static class Program
{
[STAThread]
static void Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += (_, ex) =>
{
MessageBox.Show($"{ex.Exception.Message}\n\n{ex.Exception.StackTrace}", "错误",
MessageBoxButtons.OK, MessageBoxIcon.Error);
};
AppDomain.CurrentDomain.UnhandledException += (_, ex) =>
{
var msg = ex.ExceptionObject is Exception e ? e.Message : ex.ExceptionObject.ToString();
MessageBox.Show(msg, "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
};
try
{
ApplicationConfiguration.Initialize();
using var trayManager = new TrayManager();
Application.Run(trayManager);
}
catch (Exception ex)
{
MessageBox.Show($"录屏截图工具启动失败:\n\n{ex.Message}", "错误",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}