From eb3ec7dfafe071de899112c918851db18bde6109 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 10 十二月 2024 13:36:23 +0800
Subject: [PATCH] 核心界面优化

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  105 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 69 insertions(+), 36 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 56ad3e6..311d22c 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -4,6 +4,7 @@
 using DevExpress.XtraMap;
 using HStation.WinFrmUI.PhartRelation;
 using Mapster;
+using NPOI.OpenXmlFormats.Dml;
 using NPOI.SS.Formula.Functions;
 using System.Diagnostics;
 using Yw.EPAnet;
@@ -29,6 +30,24 @@
         /// 鏂板宸ュ喌浜嬩欢
         /// </summary>
         public event Action<HydroWorkingVmo> AppendWorkingEvent;
+        /// <summary>
+        /// 淇濆瓨妯″瀷浜嬩欢
+        /// </summary>
+        public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent;
+        /// <summary>
+        /// 鍒锋柊妯″瀷浜嬩欢
+        /// </summary>
+        public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent;
+        /// <summary>
+        /// 鏇存柊鏂规浜嬩欢
+        /// </summary>
+        public event Action<XhsSchemeVmo> UpdateSchemeEvent;
+        /// <summary>
+        /// 绉婚櫎鏂规浜嬩欢
+        /// </summary>
+        public event Action<XhsSchemeVmo> RemoveSchemeEvent;
+
+
 
         private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰
         private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔�
@@ -54,6 +73,16 @@
             _hydroInfo = hydroInfo;
             _allWorkingCheckedListDict = allWorkingCheckedListDict;
             ResetMonitorValue();
+            if (_scheme == null)
+            {
+                this.ribPageGroupForScheme.Visible = false;
+                this.PageTitle.Caption = $"姘村姏妯℃嫙";
+            }
+            else
+            {
+                this.ribPageGroupForScheme.Visible = true;
+                this.PageTitle.Caption = $"姘村姏鏂规\r\n{_scheme.Name}";
+            }
         }
 
         /// <summary>
@@ -427,6 +456,13 @@
             return _visualListHelper;
         }
 
+        //閲嶇疆鍙鍒楄〃
+        private void ResetVisualList()
+        {
+            var helper = GetVisualListHelper();
+            helper.InitialData(_hydroInfo);
+        }
+
         //鑾峰彇鍙鏋勪欢
         private Yw.Model.HydroVisualInfo GetVisual(string code)
         {
@@ -665,24 +701,27 @@
             {
                 return;
             }
-            Stopwatch sw = new Stopwatch();
-            sw.Start();
-
-
-            var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo);
-
-            //鑰楁椂宸ㄥぇ鐨勪唬鐮�  
-
-            sw.Stop();
-            TimeSpan ts2 = sw.Elapsed;
-            Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds);
-            if (id < 1)
+            if (this.SaveModelEvent == null)
+            {
+                return;
+            }
+            var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo);
+            if (hydroInfo == null)
             {
                 TipFormHelper.ShowError("淇濆瓨澶辫触锛�");
                 return;
             }
-            _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id);
+            _hydroInfo = hydroInfo;
+
             TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�");
+
+
+            //Stopwatch sw = new Stopwatch();
+            //sw.Start();
+            //鑰楁椂宸ㄥぇ鐨勪唬鐮�  
+            //sw.Stop();
+            //TimeSpan ts2 = sw.Elapsed;
+            //Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds);
         }
 
         #endregion
@@ -1423,31 +1462,24 @@
         //鍒锋柊
         private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            if (this.RefreshModelEvent == null)
+            {
+                return;
+            }
             if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
-                if (_project == null)
-                {
-                    return;
-                }
-                if (_projectSite == null)
-                {
-                    return;
-                }
-                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
-                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
-                Stopwatch sw = new Stopwatch();
-                sw.Start();
-                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
-                sw.Stop();
-                TimeSpan ts2 = sw.Elapsed;
-                Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds);
-                _visual = null;
-                await _bimfaceCtrl?.ZoomAndSelectComponents(null);
-                //ShowSelectedProperty();
-                TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�");
 
-                var visualListHelper = GetVisualListHelper();
-                visualListHelper.InitialData(_hydroInfo);
+                var hydroInfo = await this.RefreshModelEvent.Invoke();
+                if (hydroInfo == null)
+                {
+                    TipFormHelper.ShowError("鍒锋柊澶辫触锛�");
+                    return;
+                }
+                _hydroInfo = hydroInfo;
+                SelectVisual(visual: null, eVisualSource.None);
+
+                ResetVisualList();
+                TipFormHelper.ShowSucceed("鍒锋柊鎴愬姛锛�");
             }
         }
 
@@ -2402,11 +2434,12 @@
                     return;
                 }
                 var dlg = new SimulationSingleWorkingEnergyDlg();
-                dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult);
+                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
                 dlg.ShowDialog();
             }
             else
             {
+
                 var dlg = new SimulationMultiWorkingEnergyDlg();
                 dlg.SetBindingData(_hydroInfo, allCheckedWorkingList);
                 dlg.ShowDialog();

--
Gitblit v1.9.3