lixiaojun
2024-12-30 c22cc4c60e9ff156fc25b39a5c024cc758df354b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Yw.WinFrmUI.Bimface;
 
namespace HStation.WinFrmUI
{
    /// <summary>
    /// 监测标记辅助类
    /// </summary>
    public class SimulationMonitorMarkerHelper
    {
        /// <summary>
        /// 
        /// </summary>
        public SimulationMonitorMarkerHelper
            (
                SimulationMonitorHelper monitorHelper,
                ISimulationMonitorMarkerView view
            )
        {
            _monitorHelper = monitorHelper;
            _views = new List<ISimulationMonitorMarkerView>() { view };
        }
 
        private readonly SimulationMonitorHelper _monitorHelper = null;//监测点辅助类
        private readonly List<ISimulationMonitorMarkerView> _views = null;//视图列表
 
        /// <summary>
        /// 是否可见
        /// </summary>
        public bool Visible
        {
            get { return _visible; }
            set { _visible = value; }
        }
        private bool _visible = false;
 
        /// <summary>
        /// 获取所有
        /// </summary>
        public async Task<List<LogicMonitorMarker>> GetAll()
        {
            var allMonitorList = await _monitorHelper.GetAll();
            var allGroupList = allMonitorList?.GroupBy(x => new { x.Parter, x.SourceType }).ToList();
            var allMarkerList = allGroupList?.Select(x => new LogicMonitorMarker()
            {
                Code = x.Key.Parter,
                SourceType = (int)x.Key.SourceType,
                Description = x.Key.SourceType == Yw.Hydro.eSourceType.Docking ? $"传感器测点({x.Count()})" : $"分析测点({x.Count()})"
            }).ToList();
            return allMarkerList;
        }
 
        /// <summary>
        /// 设置
        /// </summary>
        public async void Set()
        {
            if (this.Visible)
            {
                var allMarkerList = await GetAll();
                _views.ForEach(x => x.SetLogicMonitors(allMarkerList));
            }
            else
            {
                _views.ForEach(x => x.ClearLogicMonitors());
            }
        }
 
 
 
 
    }
}