From 1dd158434a41627a6684cd630b2696fb83b1e3d6 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 19 十二月 2024 13:23:04 +0800 Subject: [PATCH] 流量计整改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/02-visual/02-list/SimulationVisualListHelper.cs | 49 +++++++++++++++++++++++-------------------------- 1 files changed, 23 insertions(+), 26 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/02-visual/02-list/SimulationVisualListHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/02-visual/02-list/SimulationVisualListHelper.cs index c1e30c8..df2ff46 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/02-visual/02-list/SimulationVisualListHelper.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/02-visual/02-list/SimulationVisualListHelper.cs @@ -13,6 +13,11 @@ public SimulationVisualListHelper() { } /// <summary> + /// 鍒濆鍖栦簨浠� + /// </summary> + public event Action InitialEvent; + + /// <summary> /// 姘村姏淇℃伅 /// </summary> public HydroModelInfo HydroInfo @@ -21,7 +26,9 @@ private set { _hydroInfo = value; } } private HydroModelInfo _hydroInfo = null; - private Dictionary<string, HydroVisualInfo> _dict;//瀛楀吀 + + //瀛楀吀 + private Dictionary<string, HydroVisualInfo> _dict; /// <summary> /// 鍒濆鍖栨暟鎹� @@ -33,22 +40,15 @@ { return; } - _dict = new Dictionary<string, HydroVisualInfo>(); - var allVisualList = this.HydroInfo.GetAllVisuals(); - allVisualList?.ForEach(x => _dict.Add(x.Code, x)); + _dict = hydroInfo.GetVisualDict(); + InitialEvent?.Invoke(); } - - /// <summary> /// 鑾峰彇鍙瀛楀吀 /// </summary> public Dictionary<string, HydroVisualInfo> GetVisualDict() { - if (_hydroInfo == null) - { - return default; - } return _dict; } @@ -57,10 +57,6 @@ /// </summary> public List<HydroVisualInfo> GetVisualList() { - if (_hydroInfo == null) - { - return default; - } return _dict?.Values.ToList(); } @@ -69,12 +65,17 @@ /// </summary> public List<HydroNodeInfo> GetNodeList() { - if (_hydroInfo == null) - { - return default; - } - var nodes = _hydroInfo.GetAllNodes(); + var nodes = _hydroInfo?.GetAllNodes(); return nodes; + } + + /// <summary> + /// 鑾峰彇姘存簮鍒楄〃 + /// </summary> + public List<HydroSourceInfo> GetSourceList() + { + var sources = _hydroInfo?.GetAllSources(); + return sources; } /// <summary> @@ -82,11 +83,7 @@ /// </summary> public List<HydroLinkInfo> GetLinkList() { - if (_hydroInfo == null) - { - return default; - } - var links = _hydroInfo.GetAllLinks(); + var links = _hydroInfo?.GetAllLinks(); return links; } @@ -95,11 +92,11 @@ /// </summary> public HydroVisualInfo GetVisual(string code) { - if (_hydroInfo == null) + if (_dict == null || _dict.Count < 1) { return default; } - if (_dict == null || _dict.Count < 1) + if (string.IsNullOrEmpty(code)) { return default; } -- Gitblit v1.9.3