namespace Yw.WinFrmUI
{
public partial class SetHydroCalcuPrefixCtrl : DevExpress.XtraEditors.XtraUserControl
{
public SetHydroCalcuPrefixCtrl()
{
InitializeComponent();
}
///
/// 水力查看事件
///
public event Action HydroViewEvent;
///
/// 水力计算事件
///
public event Action HydroCalcuEvent;
//水力信息
private Yw.Model.HydroModelInfo _hydroInfo = null;
///
/// 绑定数据
///
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
{
_hydroInfo = hydroInfo;
if (_hydroInfo == null)
{
return;
}
//水箱
if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
{
this.groupForWaterBox.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
this.setHydroWaterboxCalcuPrefixListCtrl1.SetBindingData(_hydroInfo);
}
else
{
this.groupForWaterBox.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
}
//水泵
if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
{
this.groupForPump.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
this.setHydroPumpCalcuPrefixListCtrl1.SetBindingData(_hydroInfo);
}
else
{
this.groupForPump.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
}
//喷嘴
if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
{
this.groupForNozzle.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
this.setHydroNozzleCalcuPrefixListCtrl1.SetBindingData(_hydroInfo);
}
else
{
this.groupForNozzle.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
}
}
///
/// 更新绑定数据
///
public void UpdateBindingData()
{
if (_hydroInfo == null)
{
return;
}
if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
{
this.setHydroWaterboxCalcuPrefixListCtrl1.UpdateBindingData();
}
if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
{
this.setHydroPumpCalcuPrefixListCtrl1.UpdateBindingData();
}
if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
{
this.setHydroNozzleCalcuPrefixListCtrl1.UpdateBindingData();
}
}
}
}