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 HStation.WinFrmUI
{
public partial class XhsProjectSimulationPumpUnMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
{
public XhsProjectSimulationPumpUnMatchingListCtrl()
{
InitializeComponent();
this.gridView1.SetNormalView(30);
this.gridView1.RegistCustomDrawRowIndicator(40);
}
///
/// 显示查询面板
///
[Browsable(true)]
[Description("显示查询面板")]
[DefaultValue(true)]
public bool ShowFindPanel
{
get { return this.gridView1.OptionsFind.AlwaysVisible; }
set { this.gridView1.OptionsFind.AlwaysVisible = value; }
}
///
/// 水力点击事件
///
public event Action HydroClickEvent;
private List _allBindingList = null;//所有绑定列表
///
/// 绑定数据
///
///
public void SetBindingData(List allPumpList)
{
_allBindingList = new List();
if (allPumpList != null && allPumpList.Count > 0)
{
foreach (var pump in allPumpList)
{
if (string.IsNullOrEmpty(pump.DbId))
{
var vm = new XhsProjectSimulationPumpUnMatchingViewModel(pump);
_allBindingList.Add(vm);
}
}
}
this.xhsProjectSimulationPumpUnMatchingViewModelBindingSource.DataSource = _allBindingList;
this.xhsProjectSimulationPumpUnMatchingViewModelBindingSource.ResetBindings(false);
}
//行点击事件
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
var row = this.gridView1.GetRow(e.RowHandle) as XhsProjectSimulationPumpUnMatchingViewModel;
if (row == null)
{
return;
}
this.HydroClickEvent?.Invoke(row.Vmo);
}
}
}