From bef933e7e166b085ba7e46e38ea62d9ae0129ec6 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 20 一月 2025 10:47:23 +0800 Subject: [PATCH] 远程API模式阶段性提交 --- Desktop/HStation.Desktop.Xhs.Core/Program.cs | 36 +++++++++++++++++++++++++++--------- 1 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Desktop/HStation.Desktop.Xhs.Core/Program.cs b/Desktop/HStation.Desktop.Xhs.Core/Program.cs index 7c75e0d..fc879d3 100644 --- a/Desktop/HStation.Desktop.Xhs.Core/Program.cs +++ b/Desktop/HStation.Desktop.Xhs.Core/Program.cs @@ -1,6 +1,7 @@ using DevExpress.LookAndFeel; using Mapster; using System.Reflection; +using Yw.WinFrmUI; namespace HStation.Desktop { @@ -56,10 +57,10 @@ // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - //if (!LoginHelper.Login()) - //{ - // return; - //} + if (!LoginHelper.Login()) + { + return; + } // Yw.FileFolderZipHelper.Zip(@"C:\Users\ZKC\Desktop\循环水用例", @"C:\Users\ZKC\Desktop\循环水用例.ywrvt"); //Yw.FileFolderZipHelper.Zip(@"C:\Users\Eventech\Desktop\循环水用例", @"C:\Users\Eventech\Desktop\循环水用例.ywrvt"); @@ -90,21 +91,38 @@ /// 这就是我们要在发生未处理异常时处理的方法,我这是写出错详细信息到文本,如出错后弹出一个漂亮的出错提示窗体,给大家做个参考 /// 做法很多,可以是把出错详细信息记录到文本、数据库,发送出错邮件到作者信箱或出错后重新初始化等等 /// 这就是仁者见仁智者见智,大家自己做了。 - ///</summary> + ///</summary>d ///<param name="sender"> </param> ///<param name="e"> </param> private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { var ex = e.Exception; - Yw.LogHelper.Error("系统出现未知异常,ERROR:249", ex); - MessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); + if (ex is Yw.Dto.InternalException internalEx) + { + + Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx); + MessageBoxHelper.ShowError(internalEx.ErrorMsg); + } + else + { + Yw.LogHelper.Error("系统出现未知异常,ERROR:249", ex); + MessageBoxHelper.ShowError($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); + } } private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = e.ExceptionObject as Exception; - Yw.LogHelper.Error("系统出现未知异常,ERROR:255", ex); - MessageBox.Show($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); + if (ex is Yw.Dto.InternalException internalEx) + { + Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx); + MessageBoxHelper.ShowError(internalEx.ErrorMsg); + } + else + { + Yw.LogHelper.Error("系统出现未知异常,ERROR:255", ex); + MessageBoxHelper.ShowError($"系统出现未知异常,请重启系统!\r\n{ex.Message}"); + } } } } \ No newline at end of file -- Gitblit v1.9.3