using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace Yw.WinFrmUI
|
{
|
public partial class HydroPumpRunListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public HydroPumpRunListCtrl()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 选择改变事件
|
/// </summary>
|
public event Action<Yw.Model.HydroPumpInfo> SelectedChangedEvent;
|
|
private List<HydroPumpRunViewModel> _allBindingList = null;//绑定列表
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
|
{
|
SetBindingData(hydroInfo.Pumps);
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<Yw.Model.HydroPumpInfo> pumps)
|
{
|
_allBindingList = new List<HydroPumpRunViewModel>();
|
pumps?.ForEach(x => _allBindingList.Add(new HydroPumpRunViewModel(x)));
|
this.hydroPumpRunViewModelBindingSource.DataSource = _allBindingList;
|
this.hydroPumpRunViewModelBindingSource.ResetBindings(false);
|
}
|
|
//选择改变
|
private void imageListBoxControl1_SelectedValueChanged(object sender, EventArgs e)
|
{
|
if (_allBindingList == null || _allBindingList.Count < 1)
|
{
|
return;
|
}
|
var item = this.imageListBoxControl1.SelectedItem;
|
var pump = item as HydroPumpRunViewModel;
|
if (pump == null)
|
{
|
return;
|
}
|
this.SelectedChangedEvent?.Invoke(pump.Vmo);
|
}
|
|
}
|
}
|