using DevExpress.XtraEditors;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
public partial class PumpPerform2dEditDlg : XtraForm
|
{
|
public PumpPerform2dEditDlg()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 回调事件
|
/// </summary>
|
public event Func<Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Yw.Geometry.CubicSpline2d, Task<bool>> ReloadDataEvent;
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(
|
Yw.Pump.CurveQH curve_qh,
|
Yw.Pump.CurveQE curve_qe,
|
Yw.Pump.CurveQP curve_qp)
|
{
|
if (curve_qh == null)
|
{
|
return;
|
}
|
Yw.Geometry.CubicSpline2d qh = null, qe = null, qp = null;
|
|
qh = new Yw.Geometry.CubicSpline2d(curve_qh.FeatCurve.GetPointList());
|
if (qe != null)
|
qe = new Yw.Geometry.CubicSpline2d(curve_qe.FeatCurve.GetPointList());
|
if (qp != null)
|
qp = new Yw.Geometry.CubicSpline2d(curve_qp.FeatCurve.GetPointList());
|
|
this.curveExpressEditCtrl1.SetBindingData(qh, qe, qp);
|
}
|
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(Yw.Geometry.CubicSpline2d qh,
|
Yw.Geometry.CubicSpline2d qe,
|
Yw.Geometry.CubicSpline2d qp)
|
{
|
|
this.curveExpressEditCtrl1.SetBindingData(qh, qe, qp);
|
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<Yw.Geometry.Point2d> qh_pt_list,
|
List<Yw.Geometry.Point2d> qe_pt_list,
|
List<Yw.Geometry.Point2d> qp_pt_list,
|
List<Yw.Geometry.Point2d> def_qh_pt_list,
|
List<Yw.Geometry.Point2d> def_qe_pt_list,
|
List<Yw.Geometry.Point2d> def_qp_pt_list)
|
{
|
this.curveExpressEditCtrl1.SetBindingData(qh_pt_list, qe_pt_list, qp_pt_list, def_qh_pt_list,def_qe_pt_list,def_qp_pt_list);
|
}
|
|
//确定
|
private async void btnOk_Click(object sender, EventArgs e)
|
{
|
var bol = this.curveExpressEditCtrl1.GetPoints(
|
out List<Yw.Geometry.Point2d> qh_pt_list,
|
out List<Yw.Geometry.Point2d> qe_pt_list,
|
out List<Yw.Geometry.Point2d> qp_pt_list);
|
if (!bol)
|
{
|
return;
|
}
|
|
var qh = new Yw.Geometry.CubicSpline2d(qh_pt_list);
|
var qe = new Yw.Geometry.CubicSpline2d(qe_pt_list);
|
var qp = new Yw.Geometry.CubicSpline2d(qp_pt_list);
|
var result = await this.ReloadDataEvent?.Invoke(qh,qe,qp);
|
if (!result)
|
{
|
XtraMessageBox.Show("更新失败!");
|
return;
|
}
|
XtraMessageBox.Show("更新成功!");
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
}
|
}
|