From f057f1388eda8aeaea7f3e7a0451b57f32de324c Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期一, 02 九月 2024 09:15:13 +0800
Subject: [PATCH] 界面优化

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs |  105 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
index 2fb045f..56ac5b7 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/00-core/ImportXhsProjectHelper.cs
@@ -18,14 +18,16 @@
         /// <param name="feedBackMsg">淇℃伅鍙嶉</param>
         /// <param name="feedBackProgress">杩涘害鍙嶉</param>
         /// <returns></returns>
-        public static async Task<bool> Import(ImportXhsProjectViewModel vm, Action<string> feedBackMsg, Action<int, int> feedBackProgress)
+        public static async Task<bool> Import(ImportXhsProjectViewModel vm, Action<string, Color> feedBackMsg, Action<int, int> feedBackProgress)
         {
             var msg = string.Empty;
+
+            var IsContinue = true;
 
             #region 绗竴姝� 涓存椂鏂囦欢澶勭悊锛堣繘搴�5%锛�
 
             msg = "寮�濮嬪鍏ラ」鐩�...";
-            feedBackMsg?.Invoke(msg);
+            feedBackMsg?.Invoke(msg, Color.Black);
 
             //涓存椂鏂囦欢澶硅矾寰�
             var tempFolder = Path.Combine(Yw.Service.ConfigHelper.DataPath, HStation.Settings.XhsParasHelper.Xhs.DataFolder, _tempFolder);
@@ -43,7 +45,7 @@
 
             #region 绗簩姝� 鍒涘缓椤圭洰锛堣繘搴� 10%锛�
 
-            feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...");
+            feedBackMsg?.Invoke("姝e湪鍒涘缓椤圭洰...", Color.Black);
 
             var bllXhsProjectExtensions = new Lazy<BLL.XhsProjectExtensions>(() => new BLL.XhsProjectExtensions());
 
@@ -66,11 +68,11 @@
             var projectId = await bllXhsProjectExtensions.Value.Insert(project);
             if (projectId < 1)
             {
-                feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�");
+                feedBackMsg?.Invoke("椤圭洰鍒涘缓澶辫触锛侊紒锛�", Color.Red);
                 return false;
             }
 
-            feedBackMsg?.Invoke("椤圭洰鍒涘缓鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("椤圭洰鍒涘缓鎴愬姛銆傘�傘��", Color.Green);
 
             vm.ProjectID = projectId;
 
@@ -80,7 +82,7 @@
 
             #region 绗笁姝� 璁剧疆鍦板浘浣嶇疆锛堣繘搴� 20%锛�
 
-            feedBackMsg?.Invoke("姝e湪璁剧疆鍦板浘浣嶇疆...");
+            feedBackMsg?.Invoke("姝e湪璁剧疆鍦板浘浣嶇疆...", Color.Black);
 
             if (vm.Location != null)
             {
@@ -96,17 +98,17 @@
                 var mapInfoId = await new Yw.BLL.MapInfo().Insert(mapInfo);
                 if (mapInfoId < 1)
                 {
-                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆澶辫触锛侊紒锛�");
+                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆澶辫触锛侊紒锛�", Color.Red);
                 }
                 else
                 {
                     vm.MapInfoID = mapInfoId;
-                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆鎴愬姛銆傘�傘��");
+                    feedBackMsg?.Invoke("璁剧疆鍦板浘浣嶇疆鎴愬姛銆傘�傘��", Color.Green);
                 }
             }
             else
             {
-                feedBackMsg?.Invoke("鏈缃湴鍥句綅缃俊鎭紒锛侊紒");
+                feedBackMsg?.Invoke("鏈缃湴鍥句綅缃俊鎭紒锛侊紒", Color.Red);
             }
 
             feedBackProgress?.Invoke(100, 20);
@@ -116,23 +118,34 @@
             #region 绗洓姝� 鍘嬬缉鏂囦欢瑙f瀽 锛堣繘搴�25%锛�
 
             msg = "姝e湪瑙f瀽妯″瀷鏂囦欢...";
-            feedBackMsg?.Invoke(msg);
+            feedBackMsg?.Invoke(msg, Color.Black);
             var bol = Yw.FileFolderZipHelper.UnZip(vm.ZipFile, tempFolder, null);
             if (!bol)
             {
-                feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�");
-                return false;
+                feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�", Color.Red);
+                //return false;
+            }
+            else
+            {
+                 IsContinue = false;
+            }
+
+            if (IsContinue)
+            {
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆鎴愬姛銆傘�傘��", Color.Green);
+                feedBackProgress?.Invoke(100, 100);
+                return true;
             }
 
             var tempFolderInfo = new DirectoryInfo(tempFolder);
             var allFileInfoList = tempFolderInfo.GetFiles();
             if (allFileInfoList == null || allFileInfoList.Count() < 1)
             {
-                feedBackMsg?.Invoke("妯″瀷鏂囦欢鏍煎紡閿欒锛侊紒锛�");
+                feedBackMsg?.Invoke("妯″瀷鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red);
                 return false;
             }
 
-            feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("妯″瀷鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green);
 
             feedBackProgress?.Invoke(100, 25);
 
@@ -140,25 +153,25 @@
 
             #region 绗簲姝� 瑙f瀽姘村姏缁撴瀯鏂囦欢 锛堣繘搴�30%锛�
 
-            feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢...");
+            feedBackMsg?.Invoke("姝e湪瑙f瀽姘村姏缁撴瀯鏂囦欢...", Color.Black);
             var jsonFileInfo = allFileInfoList.Where(x => x.Extension == ".json").FirstOrDefault();
             if (jsonFileInfo == null)
             {
-                feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢鏍煎紡閿欒锛侊紒锛�");
+                feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢鏍煎紡閿欒锛侊紒锛�", Color.Red);
                 return false;
             }
 
             var revitModel = HStation.Service.RevitParseHelper.FromJsonFile(jsonFileInfo.FullName, out msg);
             if (revitModel == null)
             {
-                feedBackMsg?.Invoke($"{msg}锛侊紒锛�");
+                feedBackMsg?.Invoke($"{msg}锛侊紒锛�", Color.Red);
                 return false;
             }
 
             var hydroInfo = HStation.Hydro.TransferHelper.FromRevit(revitModel, out msg);
             if (hydroInfo == null)
             {
-                feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽澶辫触锛寋msg}锛侊紒锛�");
+                feedBackMsg?.Invoke($"姘村姏缁撴瀯鏂囦欢瑙f瀽澶辫触锛寋msg}锛侊紒锛�", Color.Red);
                 return false;
             }
 
@@ -166,11 +179,11 @@
             var hydroId = await bllHydroInfo.Save(hydroInfo);
             if (hydroId < 1)
             {
-                feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�");
+                feedBackMsg?.Invoke("姘村姏缁撴瀯淇℃伅淇濆瓨澶辫触锛侊紒锛�", Color.Red);
                 return false;
             }
 
-            feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("姘村姏缁撴瀯鏂囦欢瑙f瀽鎴愬姛銆傘�傘��", Color.Green);
 
             feedBackProgress?.Invoke(100, 30);
 
@@ -184,14 +197,14 @@
             var projectSite = await bllXhsProjectSite.GetDefaultByProjectID(projectId);
             if (projectSite == null)
             {
-                feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�...");
+                feedBackMsg?.Invoke("椤圭洰绔欎俊鎭敊璇�...", Color.Red);
                 return false;
             }
 
             var projectSiteId = projectSite.ID;
             vm.ProjectSiteID = projectSite.ID;
 
-            feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷...");
+            feedBackMsg?.Invoke("姝e湪鍏宠仈姘村姏缁撴瀯妯″瀷...", Color.Black);
 
             var hydroRelation = new Yw.Dto.AddHydroModelRelationInput();
             hydroRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite;
@@ -205,13 +218,13 @@
             var hydroRelationId = await bllHydroRelation.Insert(hydroRelation);
             if (hydroRelationId < 1)
             {
-                feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷澶辫触锛侊紒锛�");
+                feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷澶辫触锛侊紒锛�", Color.Red);
                 return false;
             }
 
             vm.HydroRelationID = hydroRelationId;
 
-            feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("鍏宠仈姘村姏缁撴瀯妯″瀷鎴愬姛銆傘�傘��", Color.Green);
 
             feedBackProgress?.Invoke(100, 40);
 
@@ -219,12 +232,12 @@
 
             #region 绗竷姝� 涓婁紶Revit妯″瀷鏂囦欢锛堣繘搴� 45%锛�
 
-            feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢...");
+            feedBackMsg?.Invoke("姝e湪瑙f瀽Revit妯″瀷鏂囦欢...", Color.Black);
             var rvtFileInfo = allFileInfoList.Where(x => x.Extension == ".rvt").FirstOrDefault();
             if (rvtFileInfo == null)
             {
-                feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�");
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");
+                feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢瑙f瀽澶辫触锛侊紒锛�", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 return true;
             }
 
@@ -232,14 +245,14 @@
             var bimfaceId = 10000872887098; //娴嬭瘯鐢ㄤ緥
             if (bimfaceId < 1)
             {
-                feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�");
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");
+                feedBackMsg?.Invoke("Revit妯″瀷鏂囦欢涓婁紶澶辫触锛侊紒锛�", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 return true;
             }
 
             vm.BimfaceId = bimfaceId;
 
-            feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("瑙f瀽Revit妯″瀷鏂囦欢鎴愬姛銆傘�傘��", Color.Green);
 
             feedBackProgress?.Invoke(100, 45);
 
@@ -247,7 +260,7 @@
 
             #region 绗叓姝� 淇濆瓨Bimface鏂囦欢 锛堣繘搴� 50%锛�
 
-            feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢...");
+            feedBackMsg?.Invoke("姝e湪淇濆瓨Bimface鏂囦欢...", Color.Black);
 
             var bimfaceFile = new Yw.Dto.AddBimfaceFileInput();
             bimfaceFile.BimfaceId = bimfaceId.ToString();
@@ -262,13 +275,13 @@
             var bimfaceFileId = await bllBimfaceFile.Insert(bimfaceFile);
             if (bimfaceFileId < 1)
             {
-                feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨澶辫触锛侊紒锛�");
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");
+                feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨澶辫触锛侊紒锛�", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 return true;
             }
             vm.BimfaceFileID = bimfaceFileId;
 
-            feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("Bimface鏂囦欢淇濆瓨鎴愬姛銆傘�傘��", Color.Green);
 
             feedBackProgress?.Invoke(100, 50);
 
@@ -276,7 +289,7 @@
 
             #region 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛�
 
-            feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢...");
+            feedBackMsg?.Invoke("姝e湪鍏宠仈Bimface鏂囦欢...", Color.Black);
 
             var bimfaceRelation = new Yw.Dto.AddBimfaceFileRelationInput();
             bimfaceRelation.ObjectType = HStation.Xhs.DataType.XhsProjectSite;
@@ -289,19 +302,19 @@
             var bimfaceRelationId = await bllBimfaceRelation.Insert(bimfaceRelation);
             if (bimfaceRelationId < 1)
             {
-                feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈澶辫触锛侊紒锛�");
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");
+                feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈澶辫触锛侊紒锛�", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Blue);
                 return true;
             }
             vm.BimfaceFileRelationID = bimfaceRelationId;
-            feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��");
+            feedBackMsg?.Invoke("Bimface鏂囦欢鍏宠仈鎴愬姛銆傘�傘��", Color.Green);
             feedBackProgress?.Invoke(100, 55);
 
             #endregion 绗節姝� 鍏宠仈Bimface鏂囦欢锛堣繘搴� 55%锛�
 
             #region 绗崄姝� 鍙戣捣bimface杞崲锛堣繘搴� 80%锛�
 
-            feedBackMsg?.Invoke("姝e湪杩涜Bimface妯″瀷杞婚噺鍖�...");
+            feedBackMsg?.Invoke("姝e湪杩涜Bimface妯″瀷杞婚噺鍖�...", Color.Black);
             //var bimfaceTranslateStatus = await Yw.WinFrmUI.BimfaceHelper.TranslateRvtFile(bimfaceId);//鍙戣捣杞崲
             var bimfaceTranslateStatus = Yw.BIMFace.eTranslateStatus.Processing;//娴嬭瘯浠g爜
             feedBackProgress?.Invoke(100, 60);
@@ -312,17 +325,17 @@
                 {
                     await Yw.WinFrmUI.BimfaceHelper.WaitFileTranslateStatusUntilSuccess(bimfaceId, 3000);
                     vm.BimfaceConverted = true;
-                    feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��");
+                    feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
                 }
                 else
                 {
-                    feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��");
+                    feedBackMsg?.Invoke("璺宠繃Bimface妯″瀷杞婚噺鍖栫瓑寰呫�傘�傘��", Color.Black);
                 }
             }
             else
             {
                 vm.BimfaceConverted = true;
-                feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��");
+                feedBackMsg?.Invoke("Bimface妯″瀷杞婚噺鍖栧畬鎴愩�傘�傘��", Color.Green);
             }
 
             feedBackProgress?.Invoke(100, 80);
@@ -331,16 +344,16 @@
 
             #region 绗崄涓�姝� 鏇存柊Bimface鏂囦欢鐘舵�侊紙杩涘害 100%锛�
 
-            feedBackMsg?.Invoke("姝e湪鏇存柊Bimface鏂囦欢鐘舵��...");
+            feedBackMsg?.Invoke("姝e湪鏇存柊Bimface鏂囦欢鐘舵��...", Color.Black);
             bol = await bllBimfaceFile.UpdateFileStatus(bimfaceFileId, (int)Yw.Bimface.eFileStatus.ConvertSucceed);
             if (bol)
             {
-                feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��");
+                feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂版垚鍔熴�傘�傘��", Color.Green);
             }
             else
             {
-                feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒");
-                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��");
+                feedBackMsg?.Invoke("Bimface鏂囦欢鐘舵�佹洿鏂板け璐ワ紒锛侊紒", Color.Red);
+                feedBackMsg?.Invoke("椤圭洰瀵煎叆缁撴潫銆傘�傘��", Color.Black);
                 return true;
             }
 

--
Gitblit v1.9.3