From 28a7344a9f352624c9f44cc3fcb38d7226d5a754 Mon Sep 17 00:00:00 2001
From: qin <a@163.com>
Date: 星期三, 19 三月 2025 09:10:02 +0800
Subject: [PATCH] 优化IBox接口请求

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingHelper.cs |   79 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingHelper.cs
index b3bb3ab..d878e78 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingHelper.cs
@@ -13,12 +13,35 @@
         public SimulationWorkingHelper() { }
 
         /// <summary>
+        /// 鍒濆鍖栦簨浠�
+        /// </summary>
+        public event Action InitialEvent;
+
+        /// <summary>
+        /// 鏄惁鍒濆鍖�
+        /// </summary>
+        public bool Initialized
+        {
+            get { return this.Working != null; }
+        }
+
+        /// <summary>
+        /// 姘村姏淇℃伅
+        /// </summary>
+        public Yw.Model.HydroModelInfo HydroInfo
+        {
+            get { return _hydroInfo; }
+            private set { _hydroInfo = value; }
+        }
+        private Yw.Model.HydroModelInfo _hydroInfo = null;
+
+        /// <summary>
         /// 宸ュ喌
         /// </summary>
         public HydroWorkingVmo Working
         {
             get { return _working; }
-            set { _working = value; }
+            private set { _working = value; }
         }
         private HydroWorkingVmo _working = null;
 
@@ -28,7 +51,7 @@
         public HydroCheckResult CheckResult
         {
             get { return _checkResult; }
-            set { _checkResult = value; }
+            private set { _checkResult = value; }
         }
         private HydroCheckResult _checkResult = null;
 
@@ -38,19 +61,67 @@
         public HydroCalcuResult CalcuResult
         {
             get { return _calcuResult; }
-            set { _calcuResult = value; }
+            private set { _calcuResult = value; }
         }
         private HydroCalcuResult _calcuResult = null;
 
         /// <summary>
+        /// 鏄惁鏄粷瀵瑰帇鍔�
+        /// </summary>
+        public bool IsHead
+        {
+            get { return _isHead; }
+            private set { _isHead = value; }
+        }
+        private bool _isHead = false;
+
+        /// <summary>
         /// 鍒濆鍖栨暟鎹�
         /// </summary>
-        public void InitialData(HydroWorkingVmo working, HydroCheckResult checkResult, HydroCalcuResult calcuResult)
+        public void InitialData
+            (
+                Yw.Model.HydroModelInfo hydroInfo,
+                HydroWorkingVmo working,
+                HydroCheckResult checkResult,
+                HydroCalcuResult calcuResult,
+                bool isHead = false
+            )
         {
+            this.HydroInfo = hydroInfo;
             this.Working = working;
             this.CheckResult = checkResult;
             this.CalcuResult = calcuResult;
+            this.IsHead = isHead;
+            this.InitialEvent?.Invoke();
         }
 
+        /// <summary>
+        /// 閲嶇疆宸ュ喌
+        /// </summary>
+        public void ResetWorking(HydroWorkingVmo working)
+        {
+            this.Working = working;
+        }
+
+        /// <summary>
+        /// 閲嶇疆缁撴灉
+        /// </summary>
+        public void ResetResult(bool isHead = false)
+        {
+            if (!Initialized)
+            {
+                return;
+            }
+            if (this.IsHead == isHead)
+            {
+                return;
+            }
+            this.IsHead = isHead;
+            var calcuResult = this.HydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead);
+            this.CalcuResult = calcuResult;
+            this.InitialEvent?.Invoke();
+        }
+
+
     }
 }

--
Gitblit v1.9.3