namespace HStation.WinFrmUI
{
public partial class XhsProjectSimulationValveCalcuPrefixCtrl : DevExpress.XtraEditors.XtraUserControl, IXhsProjectSimulationCalcuPrefix
{
public XhsProjectSimulationValveCalcuPrefixCtrl()
{
InitializeComponent();
this.gridView1.SetNormalView(30);
this.gridView1.RegistCustomDrawRowIndicator(40);
}
///
/// 水力点击事件
///
public event Action HydroClickEvent;
///
/// 显示查询面板
///
[Browsable(true)]
[Description("显示查询面板")]
[DefaultValue(true)]
public bool ShowFindPanel
{
get { return this.gridView1.OptionsFind.AlwaysVisible; }
set { this.gridView1.OptionsFind.AlwaysVisible = value; }
}
///
/// 是否拥有水利列表
///
public bool HasHydroList
{
get { return _allBindingList != null && _allBindingList.Count > 0; }
}
//绑定列表
private List _allBindingList = null;
///
/// 绑定数据
///
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
{
_allBindingList = new List();
hydroInfo?.Valves?.ForEach(x =>
{
var vm = new XhsProjectSimulationValveCalcuPrefixViewModel(x);
_allBindingList.Add(vm);
});
this.xhsProjectSimulationValveCalcuPrefixViewModelBindingSource.DataSource = _allBindingList;
this.xhsProjectSimulationValveCalcuPrefixViewModelBindingSource.ResetBindings(false);
}
//行单元点击
private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
{
var row = this.gridView1.GetRow(e.RowHandle) as XhsProjectSimulationValveCalcuPrefixViewModel;
if (row == null)
{
return;
}
this.HydroClickEvent?.Invoke(row.Vmo);
}
}
}