namespace Yw.WinFrmUI
|
{
|
/// <summary>
|
/// 水力工况信息ViewModel
|
/// </summary>
|
public class HydroWorkingInfoViewModel
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public HydroWorkingInfoViewModel()
|
{
|
this.Waterboxs = new List<HydroWaterboxWorkingInfoViewModel>();
|
this.Pumps = new List<HydroPumpWorkingInfoViewModel>();
|
this.Valves = new List<HydroValveWorkingInfoViewModel>();
|
this.Monitors = new List<HydroMonitorWorkingInfoViewModel>();
|
}
|
|
/// <summary>
|
/// 水箱
|
/// </summary>
|
public List<HydroWaterboxWorkingInfoViewModel> Waterboxs { get; set; }
|
|
/// <summary>
|
/// 水泵
|
/// </summary>
|
public List<HydroPumpWorkingInfoViewModel> Pumps { get; set; }
|
|
/// <summary>
|
/// 阀门
|
/// </summary>
|
public List<HydroValveWorkingInfoViewModel> Valves { get; set; }
|
|
/// <summary>
|
/// 监测
|
/// </summary>
|
public List<HydroMonitorWorkingInfoViewModel> Monitors { get; set; }
|
|
|
/// <summary>
|
/// 获取所有组件工况信息列表
|
/// </summary>
|
public List<HydroVisualWorkingInfoViewModel> GetAllVisualWorkingInfoList()
|
{
|
var list = new List<HydroVisualWorkingInfoViewModel>();
|
this.Waterboxs?.ForEach(x => list.Add(x));
|
this.Pumps?.ForEach(x => list.Add(x));
|
this.Valves?.ForEach(x => list.Add(x));
|
return list;
|
}
|
|
/// <summary>
|
/// 添加组件工况信息
|
/// </summary>
|
public bool AppendVisualWorkingInfo(HydroVisualWorkingInfoViewModel workingInfo)
|
{
|
if (workingInfo == null)
|
{
|
return false;
|
}
|
if (workingInfo is HydroWaterboxWorkingInfoViewModel waterbox)
|
{
|
if (this.Waterboxs.Exists(x => x.Code == waterbox.Code))
|
{
|
return false;
|
}
|
this.Waterboxs.Add(waterbox);
|
return true;
|
}
|
else if (workingInfo is HydroPumpWorkingInfoViewModel pump)
|
{
|
if (this.Pumps.Exists(x => x.Code == pump.Code))
|
{
|
return false;
|
}
|
this.Pumps.Add(pump);
|
return true;
|
}
|
else if (workingInfo is HydroValveWorkingInfoViewModel valve)
|
{
|
if (this.Valves.Exists(x => x.Code == valve.Code))
|
{
|
return false;
|
}
|
this.Valves.Add(valve);
|
return true;
|
}
|
return false;
|
}
|
|
|
|
}
|
}
|