From 7e5fcbee07c65bed3333eb295d0d5117df46b939 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 05 十二月 2024 22:50:28 +0800
Subject: [PATCH] 修改阀门单独匹配

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingCheckedListHelper.cs |   29 ++++++++++++++++++++++++-----
 1 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingCheckedListHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingCheckedListHelper.cs
index a724798..fc673f1 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingCheckedListHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/05-working/SimulationWorkingCheckedListHelper.cs
@@ -1,4 +1,5 @@
-锘縰sing Yw.Vmo;
+锘縰sing DevExpress.Utils.Extensions;
+using Yw.Vmo;
 
 namespace HStation.WinFrmUI
 {
@@ -51,17 +52,35 @@
         /// </summary>
         public void Update(HydroWorkingVmo working, bool hasChecked)
         {
+            if (working == null)
+            {
+                return;
+            }
             if (_allWorkingCheckedListDict == null)
             {
                 _allWorkingCheckedListDict = new Dictionary<HydroWorkingVmo, bool>();
             }
-            if (_allWorkingCheckedListDict.ContainsKey(working))
+            var key = _allWorkingCheckedListDict.Keys.Where(x => x.ID == working.ID).FirstOrDefault();
+            if (key != null)
             {
-                _allWorkingCheckedListDict[working] = hasChecked;
+                _allWorkingCheckedListDict.Remove(key);
             }
-            else
+            _allWorkingCheckedListDict.Add(working, hasChecked);
+        }
+
+        /// <summary>
+        /// 绉婚櫎
+        /// </summary>
+        public void Remove(long workingId)
+        {
+            if (_allWorkingCheckedListDict == null)
             {
-                _allWorkingCheckedListDict.Add(working, hasChecked);
+                return;
+            }
+            var key = _allWorkingCheckedListDict.Keys.ToList().Find(x => x.ID == workingId);
+            if (key != null)
+            {
+                _allWorkingCheckedListDict.Remove(key);
             }
         }
 

--
Gitblit v1.9.3