namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectSimulationValveCalcuPrefixCtrl : DevExpress.XtraEditors.XtraUserControl, IXhsProjectSimulationCalcuPrefix
|
{
|
public XhsProjectSimulationValveCalcuPrefixCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.RegistCustomDrawRowIndicator(40);
|
}
|
|
/// <summary>
|
/// 水力点击事件
|
/// </summary>
|
public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
|
|
/// <summary>
|
/// 显示查询面板
|
/// </summary>
|
[Browsable(true)]
|
[Description("显示查询面板")]
|
[DefaultValue(true)]
|
public bool ShowFindPanel
|
{
|
get { return this.gridView1.OptionsFind.AlwaysVisible; }
|
set { this.gridView1.OptionsFind.AlwaysVisible = value; }
|
}
|
|
/// <summary>
|
/// 是否拥有水利列表
|
/// </summary>
|
public bool HasHydroList
|
{
|
get { return _allBindingList != null && _allBindingList.Count > 0; }
|
}
|
|
//绑定列表
|
private List<XhsProjectSimulationValveCalcuPrefixViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo)
|
{
|
_allBindingList = new List<XhsProjectSimulationValveCalcuPrefixViewModel>();
|
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);
|
}
|
|
|
}
|
}
|