diff --git a/App.config b/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..76aac41 --- /dev/null +++ b/App.xaml @@ -0,0 +1,69 @@ + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..6ea5ef3 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace MinecraftServerDownloader +{ + public partial class App : System.Windows.Application + { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + // 订阅 DispatcherUnhandledException 事件 + Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; + } + + private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) + { + // 处理异常 + Exception exception = e.Exception; + // 进行异常处理逻辑,如记录异常信息、显示错误消息等 + + // 标记为已处理,以防止应用程序崩溃 + e.Handled = true; + } + } +} diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..fc7dd60 --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +