From 5043208b24f45b3e3c630a596b9e83373096a78a Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期五, 18 十月 2024 12:47:49 +0800
Subject: [PATCH] 优化计算前提,计算逻辑还需要继续优化

---
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/11-prefix/01-waterbox/SetWaterboxCalcuPrefixListCtrl.cs |   67 ++++++++++++++++++++++++++++++---
 1 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/11-prefix/01-waterbox/SetWaterboxCalcuPrefixListCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/11-prefix/01-waterbox/SetWaterboxCalcuPrefixListCtrl.cs
index 3756408..ec18b7c 100644
--- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/11-prefix/01-waterbox/SetWaterboxCalcuPrefixListCtrl.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/11-prefix/01-waterbox/SetWaterboxCalcuPrefixListCtrl.cs
@@ -22,6 +22,11 @@
         }
 
         /// <summary>
+        /// 鏌ョ湅姘寸浜嬩欢
+        /// </summary>
+        public event Action<Yw.Model.HydroWaterboxInfo> ViewWaterboxEvent;
+
+        /// <summary>
         /// 椤甸潰鐘舵�佸彂鐢熸敼鍙�
         /// </summary>
         public event Action PageStateChangedEvent;
@@ -55,18 +60,45 @@
                     {
                         this.tabPanelCore.Rows.Add(new TablePanelRow(TablePanelEntityStyle.AutoSize, 150F));
                         var ctrl = new SetWaterboxCalcuPrefixCtrl();
-                        // ctrl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
-                        ctrl.SetBindingData(_vm.HydroInfo.Waterboxs[i]);
-                        //ctrl.Size = new Size();
+                        ctrl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
+                        ctrl.ViewEvent += (waterbox) =>
+                        {
+                            if (waterbox == null)
+                            {
+                                return;
+                            }
+                            this.ViewWaterboxEvent?.Invoke(waterbox);
+                        };
+                        _allCalcuPrefixCtrlList.Add(ctrl);
                         this.tabPanelCore.Controls.Add(ctrl);
                         this.tabPanelCore.SetCell(ctrl, i, 0);
                     }
                     this.tabPanelCore.Rows.Add(new TablePanelRow(TablePanelEntityStyle.AutoSize, 150F));
                 }
             }
+            if (_vm.HydroInfo.Waterboxs != null && _vm.HydroInfo.Waterboxs.Count == _allCalcuPrefixCtrlList.Count)
+            {
+                for (int i = 0; i < _allCalcuPrefixCtrlList.Count; i++)
+                {
+                    _allCalcuPrefixCtrlList[i].SetBindingData(_vm.HydroInfo.Waterboxs[i]);
+                }
+            }
         }
 
-        //鍏佽涓婁竴姝�
+        //鏇存柊椤甸潰
+        private void UpdatePage()
+        {
+            if (_allCalcuPrefixCtrlList == null)
+            {
+                return;
+            }
+            _allCalcuPrefixCtrlList.ForEach(x => x.UpdateBindingData());
+        }
+
+
+        /// <summary>
+        /// 鍏佽涓婁竴姝�
+        /// </summary>
         public bool AllowPrev
         {
             get
@@ -83,7 +115,9 @@
             }
         }
 
-        //鍏佽涓婁竴姝�
+        /// <summary>
+        /// 鍏佽涓婁竴姝�
+        /// </summary>
         public bool AllowNext
         {
             get
@@ -100,35 +134,54 @@
             }
         }
 
-        //鍏佽鍙栨秷
+        /// <summary>
+        /// 鍏佽鍙栨秷
+        /// </summary>
         public bool AllowCancel
         {
             get { return true; }
         }
 
-        //鍏佽瀹屾垚
+        /// <summary>
+        /// 鍏佽瀹屾垚
+        /// </summary>
         public bool AllowComplete
         {
             get { return true; }
         }
 
+
+        /// <summary>
+        /// 鑳藉惁涓婁竴姝�
+        /// </summary>
         public bool CanPrev()
         {
             return true;
         }
 
+        /// <summary>
+        /// 鑳藉惁涓嬩竴姝�
+        /// </summary>
         public bool CanNext()
         {
+            UpdatePage();
             return true;
         }
 
+        /// <summary>
+        /// 鑳藉惁鍙栨秷
+        /// </summary>
         public bool CanCancel()
         {
             return true;
         }
 
+        /// <summary>
+        /// 鑳藉惁瀹屾垚
+        /// </summary>
         public bool CanComplete()
         {
+            UpdatePage();
             return true;
         }
 

--
Gitblit v1.9.3