From 7079cbb505471a8d3251cac4e27c7a3841f8e656 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期三, 04 十二月 2024 22:51:37 +0800 Subject: [PATCH] 修改单独匹配界面 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs index adc013c..5f933e4 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/01-flow-effect/SimulationFlowEffectHelper.cs @@ -139,24 +139,40 @@ } /// <summary> - /// 鏇存柊 + /// 璁剧疆 /// </summary> - public void Update(HydroVisualInfo visual) + public void Set(HydroVisualInfo visual) { if (visual == null) { return; } - var item = this.Items?.Find(x => x.Id == visual.Code); - if (item == null) + var oldItem = this.Items?.Find(x => x.Id == visual.Code); + if (oldItem != null) { - return; + if (this.Items != null) + { + this.Items.Remove(oldItem); + } + this.Items?.Remove(oldItem); } - this.Items.Remove(item); var allCalcuResultVisualDict = _calcuResult?.GetVisualDict(); - item = CreateItem(visual, allCalcuResultVisualDict); - this.Items.Add(item); - _views?.ForEach(async x => await x.UpdateFlowEffect(item)); + var newItem = CreateItem(visual, allCalcuResultVisualDict); + if (newItem != null) + { + if (this.Items != null) + { + this.Items.Add(newItem); + } + } + if (this.Visible) + { + if (newItem != null) + { + _views?.ForEach(async x => await x.UpdateFlowEffect(newItem)); + } + } + } -- Gitblit v1.9.3