using DevExpress.XtraEditors;
namespace Yw.WinFrmUI.Phart
{
public partial class XtrPerform2dEditDlg : XtraForm
{
public XtrPerform2dEditDlg()
{
InitializeComponent();
}
///
/// 回调事件
///
public event Func> ReloadDataEvent;
///
/// 初始化数据
///
public void SetBindingData(
Yw.Pump.CurveQH qh,
Yw.Pump.CurveQE qe,
Yw.Pump.CurveQP qp)
{
if (qh == null)
{
return;
}
Yw.Geometry.CubicSpline2d cubic_spline_qh = null, cubic_spline_qe = null, cubic_spline_qp = null;
cubic_spline_qh = new Yw.Geometry.CubicSpline2d(qh.FeatCurve.GetPointList());
if (qe != null)
cubic_spline_qe = new Yw.Geometry.CubicSpline2d(qe.FeatCurve.GetPointList());
if (qp != null)
cubic_spline_qp = new Yw.Geometry.CubicSpline2d(qp.FeatCurve.GetPointList());
this.curveExpressEditCtrl1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp);
}
///
/// 初始化数据
///
public void SetBindingData(Yw.Geometry.CubicSpline2d cubic_spline_qh,
Yw.Geometry.CubicSpline2d cubic_spline_qe,
Yw.Geometry.CubicSpline2d cubic_spline_qp)
{
this.curveExpressEditCtrl1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp);
}
///
/// 绑定数据
///
public void SetBindingData(List pt_qh_list,
List pt_qe_list,
List pt_qp_list,
List def_pt_qh_list,
List def_pt_qe_list,
List def_pt_qp_list)
{
this.curveExpressEditCtrl1.SetBindingData(pt_qh_list, pt_qe_list, pt_qp_list, def_pt_qh_list,def_pt_qe_list,def_pt_qp_list);
}
//确定
private async void btnOk_Click(object sender, EventArgs e)
{
var bol = this.curveExpressEditCtrl1.GetPoints(
out List pt_qh_list,
out List pt_qe_list,
out List pt_qp_list);
if (!bol)
{
return;
}
var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(pt_qh_list);
var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(pt_qe_list);
var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(pt_qp_list);
var result = await this.ReloadDataEvent?.Invoke(cubic_spline_qh,cubic_spline_qe,cubic_spline_qp);
if (!result)
{
XtraMessageBox.Show("更新失败!");
return;
}
XtraMessageBox.Show("更新成功!");
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}