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());
|
}
|
}
|
|
|
|
|
}
|
}
|