namespace Yw.WinFrmUI
|
{
|
public partial class SetNozzleCalcuPrefixCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public SetNozzleCalcuPrefixCtrl()
|
{
|
InitializeComponent();
|
this.layoutControl1.SetupLayoutControl();
|
}
|
|
/// <summary>
|
/// 查看事件
|
/// </summary>
|
public event Action<Yw.Model.HydroNozzleInfo> ViewEvent;
|
|
|
private Yw.Model.HydroNozzleInfo _nozzle = null;//喷嘴
|
|
/// <summary>
|
///
|
/// </summary>
|
public void SetBindingData(Yw.Model.HydroNozzleInfo nozzle)
|
{
|
_nozzle = nozzle;
|
if (_nozzle == null)
|
{
|
return;
|
}
|
this.layoutGroupCaption.Text = "喷嘴";
|
if (!string.IsNullOrEmpty(_nozzle.Name))
|
{
|
this.layoutGroupCaption.Text = _nozzle.Name;
|
}
|
this.txtElev.EditValue = _nozzle.Elev;
|
this.txtDemand.EditValue = _nozzle.Demand;
|
this.txtCoefficient.EditValue = _nozzle.Coefficient;
|
this.txtMinorLoss.EditValue = _nozzle.MinorLoss;
|
}
|
|
/// <summary>
|
/// 更新绑定数据
|
/// </summary>
|
public void UpdateBindingData()
|
{
|
if (_nozzle == null)
|
{
|
return;
|
}
|
_nozzle.Elev = double.Parse(this.txtElev.EditValue?.ToString());
|
_nozzle.Demand = this.txtDemand.EditValue == null ? null : double.Parse(this.txtDemand.EditValue.ToString());
|
_nozzle.Coefficient = double.Parse(this.txtCoefficient.EditValue?.ToString());
|
_nozzle.MinorLoss = this.txtMinorLoss.EditValue == null ? null : double.Parse(this.txtMinorLoss.EditValue.ToString());
|
}
|
|
//查看
|
private void layoutGroupCaption_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
|
{
|
if (_nozzle == null)
|
{
|
return;
|
}
|
this.ViewEvent?.Invoke(_nozzle);
|
}
|
|
}
|
}
|