namespace HStation.WinFrmUI
|
{
|
public partial class SetHydroWaterboxCalcuPrefixListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public SetHydroWaterboxCalcuPrefixListCtrl()
|
{
|
InitializeComponent();
|
this.layoutView1.InitView();
|
}
|
|
/// <summary>
|
/// 查看水箱事件
|
/// </summary>
|
public event Action<Yw.Model.HydroWaterboxInfo> ViewParterEvent;
|
|
private Yw.Model.HydroModelInfo _hydroInfo = null;
|
private List<SetHydroWaterboxCalcuPrefixViewModel> _all_set_vm_list = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
|
{
|
_hydroInfo = hydroInfo;
|
InitialControls();
|
}
|
|
/// <summary>
|
/// 更新绑定数据
|
/// </summary>
|
public void UpdateBindingData()
|
{
|
if (_all_set_vm_list != null && _all_set_vm_list.Any())
|
{
|
for (int i = 0; i < _all_set_vm_list.Count; i++)
|
{
|
var set = _all_set_vm_list[i];
|
var item = _hydroInfo.Waterboxs[i];
|
item.InitLevel = set.InitLevel;
|
}
|
}
|
}
|
|
//初始化控件
|
private void InitialControls()
|
{
|
if (_hydroInfo == null)
|
{
|
return;
|
}
|
|
_all_set_vm_list = new List<SetHydroWaterboxCalcuPrefixViewModel>();
|
if (_hydroInfo != null)
|
{
|
if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
|
{
|
foreach (var waterbox in _hydroInfo.Waterboxs)
|
{
|
var vm = new SetHydroWaterboxCalcuPrefixViewModel(waterbox);
|
vm.Icon = svgImageCollection1[0];
|
_all_set_vm_list.Add(vm);
|
}
|
}
|
}
|
|
this.setHydroWaterboxCalcuPrefixViewModelBindingSource.DataSource = _all_set_vm_list;
|
this.setHydroWaterboxCalcuPrefixViewModelBindingSource.ResetBindings(false);
|
}
|
|
|
|
|
|
|
|
}
|
}
|