From d2ccacb3317aa6310f1b1bb5eb19fbdecba39ff9 Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期四, 27 三月 2025 11:50:43 +0800
Subject: [PATCH] 增加设施最高楼层标高字段

---
 Desktop/HStation.Desktop.Xhs.Core/Program.cs |   66 ++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/Desktop/HStation.Desktop.Xhs.Core/Program.cs b/Desktop/HStation.Desktop.Xhs.Core/Program.cs
index 16dce32..c4b8535 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;
 using Yw.WinFrmUI;
 
 namespace HStation.Desktop
@@ -35,6 +36,8 @@
                 Application.ThreadException += Application_ThreadException;
                 //处理非UI线程异常
                 AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+                //处理未被观察到的异常
+                TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
 
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
@@ -56,22 +59,42 @@
                 // To customize application configuration such as set high DPI settings or default font,
                 // see https://aka.ms/applicationconfiguration.
                 ApplicationConfiguration.Initialize();
+                Yw.WinFrmUI.GlobalParas.AppIcon = HStation.Desktop.Xhs.Core.Properties.Resources.app;
+
+                #region 验证升级
+
+                try
+                {
+
+                    if (AutoUpdateHelper.NeedExist())
+                        return;
+                }
+                catch (Exception ex)
+                {
+                    LogHelper.Error("验证升级错误", ex);
+                }
+
+                #endregion
+
 
                 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");
-                // Yw.FileFolderZipHelper.Zip(@"C:\Users\admin\Desktop\居家办公工作\循环水用例", @"C:\Users\admin\Desktop\居家办公工作\循环水用例.ywrvt");
-                //Yw.FileFolderZipHelper.Zip(@"C:\Users\admin\Desktop\居家办公工作\简单用例", @"C:\Users\admin\Desktop\居家办公工作\简单用例.ywrvt");
+                Yw.Untity.UserRegister.Regist
+                       (
+                           Yw.WinFrmUI.LoginUserInfo.CorpID,
+                           Yw.WinFrmUI.LoginUserInfo.UserID,
+                           (int)Yw.WinFrmUI.LoginUserInfo.AdminType,
+                           Yw.WinFrmUI.LoginUserInfo.UserName,
+                           Yw.WinFrmUI.LoginUserInfo.UserTag,
+                           Yw.WinFrmUI.LoginUserInfo.LoginAccountID,
+                           Yw.WinFrmUI.LoginUserInfo.LoginTypeID,
+                           Yw.WinFrmUI.LoginUserInfo.ProjectID,
+                           Yw.WinFrmUI.LoginUserInfo.SoftwareID
+                       );
 
-                //var json = RevitTestHelper.GenerateJson();
-
-                //var jsonFileName = @"C:\Users\admin\Desktop\居家办公工作\二开压缩文件\hydro.json";
-                //var jsonContent = File.ReadAllText(jsonFileName);
-                //var jsonModel = JsonHelper.Json2Object<HStation.Model.RevitModel>(jsonContent);
                 //扫描全局DTO映射
                 TypeAdapterConfig.GlobalSettings.Scan
                     (
@@ -82,10 +105,11 @@
                         Assembly.Load("HStation.BLL.Xhs.Core")
                     );
                 DbFirstHelper.Initial();
-                Yw.WinFrmUI.GlobalParas.AppIcon = HStation.Desktop.Xhs.Core.Properties.Resources.app;
                 Application.Run(new MainForm());
             }
         }
+
+
 
         ///<summary>
         ///  这就是我们要在发生未处理异常时处理的方法,我这是写出错详细信息到文本,如出错后弹出一个漂亮的出错提示窗体,给大家做个参考
@@ -97,10 +121,15 @@
         private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
         {
             var ex = e.Exception;
-            if (ex is Yw.Dto.InternalException internalEx)
+            if (ex is Yw.Vmo.VException vmoEx)
+            {
+                Yw.LogHelper.Error("系统出现内部异常,ERROR:249", vmoEx);
+                VmoExceptionTipFormHelper.Show(vmoEx);
+            }
+            else if (ex is Yw.Dto.InternalException internalEx)
             {
                 Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx);
-                MessageBoxHelper.ShowError(internalEx.ErrorMsg);
+
             }
             else
             {
@@ -112,10 +141,12 @@
         private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
         {
             var ex = e.ExceptionObject as Exception;
-            if (ex is Yw.Dto.InternalException internalEx)
+            if (ex is Yw.Vmo.VException internalEx)
             {
                 Yw.LogHelper.Error("系统出现内部异常,ERROR:249", internalEx);
-                MessageBoxHelper.ShowError(internalEx.ErrorMsg);
+                var dlg = new Yw.WinFrmUI.VmoExceptionInfoDlg();
+                dlg.SetBindingData(internalEx);
+                dlg.ShowDialog();
             }
             else
             {
@@ -123,5 +154,12 @@
                 MessageBoxHelper.ShowError($"系统出现未知异常,请重启系统!\r\n{ex.Message}");
             }
         }
+
+        //
+        private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
+        {
+            //throw new NotImplementedException();
+        }
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3