using Yw.Model; namespace Yw.WinFrmUI { public partial class HydroCompressorListCtrl : DevExpress.XtraEditors.XtraUserControl, IHydroParterList { public HydroCompressorListCtrl() { InitializeComponent(); this.gridView1.SetNormalView(30); this.gridView1.RegistCustomDrawRowIndicator(40); } /// /// 水力点击事件 /// public event Action HydroClickEvent; public event Action> HydroChangedEvent; /// /// 显示查询面板 /// [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, List allCalcuResultList) { _allBindingList = new List(); if (hydroInfo != null && hydroInfo.Compressors != null && hydroInfo.Compressors.Count > 0) { foreach (var compressor in hydroInfo.Compressors) { var calcuLinkResult = allCalcuResultList?.Find(x => x.Code == compressor.Code) as HydroCalcuLinkResult; var vm = new HydroCompressorViewModel(compressor, hydroInfo); _allBindingList.Add(vm); } } this.hydroCompressorViewModelBindingSource.DataSource = _allBindingList; this.hydroCompressorViewModelBindingSource.ResetBindings(false); if (allCalcuResultList == null || allCalcuResultList.Count < 1) { SetNormalView(); } else { SetCalcuView(); } } /// /// 设置简单显示模式 /// public void SetSimpleView() { this.colDbLocked.Visible = true; this.colCode.Visible = true; this.colName.Visible = true; this.colModelType.Visible = true; this.colHasDb.Visible = true; this.colStartCode.Visible = false; this.colEndCode.Visible = false; this.colLinkStatus.Visible = true; this.colDiameter.Visible = false; this.colLength.Visible = false; this.colMaterial.Visible = false; this.colRoughness.Visible = true; this.colMinorLoss.Visible = true; this.colMinorLossK.Visible = true; this.colCalcuFlow.Visible = false; this.colCalcuVelocity.Visible = false; this.colCalcuHeadLoss.Visible = false; this.colFlagsString.Visible = true; this.colDescription.Visible = true; } /// /// 设置正常显示模式 /// public void SetNormalView() { this.colDbLocked.Visible = true; this.colCode.Visible = true; this.colName.Visible = true; this.colModelType.Visible = true; this.colHasDb.Visible = true; this.colStartCode.Visible = false; this.colEndCode.Visible = false; this.colLinkStatus.Visible = true; this.colDiameter.Visible = true; this.colLength.Visible = true; this.colMaterial.Visible = true; this.colRoughness.Visible = true; this.colMinorLoss.Visible = true; this.colMinorLossK.Visible = true; this.colCalcuFlow.Visible = false; this.colCalcuVelocity.Visible = false; this.colCalcuHeadLoss.Visible = false; this.colFlagsString.Visible = true; this.colDescription.Visible = true; } /// /// 设置计算显示模式 /// public void SetCalcuView() { this.colDbLocked.Visible = true; this.colCode.Visible = true; this.colName.Visible = true; this.colModelType.Visible = true; this.colHasDb.Visible = true; this.colStartCode.Visible = false; this.colEndCode.Visible = false; this.colLinkStatus.Visible = true; this.colDiameter.Visible = true; this.colLength.Visible = true; this.colMaterial.Visible = true; this.colRoughness.Visible = true; this.colMinorLoss.Visible = true; this.colMinorLossK.Visible = true; this.colCalcuFlow.Visible = true; this.colCalcuVelocity.Visible = true; this.colCalcuHeadLoss.Visible = true; this.colFlagsString.Visible = true; this.colDescription.Visible = true; } //行点击事件 private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { var row = this.gridView1.GetRow(e.RowHandle) as HydroCompressorViewModel; if (row == null) { return; } this.HydroClickEvent?.Invoke(row.Vmo); } public void SetBindingData(HydroModelInfo hydroInfo) { throw new NotImplementedException(); } public void SetBulkSetView() { throw new NotImplementedException(); } public void UpdateProperty() { throw new NotImplementedException(); } public void UpdateProperty(HydroParterInfo parter) { throw new NotImplementedException(); } public void UpdateProperty(List parterList) { throw new NotImplementedException(); } public void UpdateCalcuProperty(List allCalcuResultList) { throw new NotImplementedException(); } } }