using DevExpress.XtraEditors;
|
using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
public partial class EditCurveExpressDlg : XtraForm
|
{
|
public EditCurveExpressDlg()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 回调事件
|
/// </summary>
|
public event Func<Model.PumpCurveInfo, bool> ReloadDataEvent;
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(Model.PumpCurveInfo expressGroup)
|
{
|
if (expressGroup == null)
|
return;
|
if (expressGroup.CurveQH == null)
|
return;
|
|
this.curveExpressEditCtrl1.SetBindingData(expressGroup.CurveQH, expressGroup.CurveQE, expressGroup.CurveQP);
|
|
}
|
|
/// <summary>
|
/// 初始化数据
|
/// </summary>
|
public void SetBindingData(Yw.Curve.CurveExpress curveQH,
|
Yw.Curve.CurveExpress curveQE,
|
Yw.Curve.CurveExpress curveQP)
|
{
|
|
this.curveExpressEditCtrl1.SetBindingData(curveQH, curveQE, curveQP);
|
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData(List<Yw.Geometry.Point2d> pointsQH,
|
List<Yw.Geometry.Point2d> pointsQE,
|
List<Yw.Geometry.Point2d> pointsQP,
|
Yw.Pump.eFeatType fitTypeQH,
|
Yw.Pump.eFeatType fitTypeQE,
|
Yw.Pump.eFeatType fitTypeQP)
|
{
|
this.curveExpressEditCtrl1.SetBindingData(pointsQH, pointsQE, pointsQP, fitTypeQH, fitTypeQE, fitTypeQP);
|
}
|
|
//确定
|
private void btnOk_Click(object sender, EventArgs e)
|
{
|
var bol = this.curveExpressEditCtrl1.GetPoints(out List<Yw.Geometry.Point2d> pointsQH,
|
out List<Yw.Geometry.Point2d> pointsQE,
|
out List<Yw.Geometry.Point2d> pointsQP,
|
out Yw.Pump.eFeatType fitTypeQH,
|
out Yw.Pump.eFeatType fitTypeQE,
|
out Yw.Pump.eFeatType fitTypeQP);
|
if (!bol)
|
{
|
return;
|
}
|
|
var featCurveExpressGroup = new Model.PumpCurveInfo();
|
if (pointsQH != null)
|
{
|
featCurveExpressGroup.CurveQH = Yw.Curve.FitHelper.BuildCurveExpress(pointsQH, fitTypeQH);
|
|
}
|
if (pointsQE != null)
|
{
|
featCurveExpressGroup.CurveQE = Yw.Curve.FitHelper.BuildCurveExpress(pointsQE, fitTypeQE);
|
|
}
|
if (pointsQP != null)
|
{
|
featCurveExpressGroup.CurveQP = Yw.Curve.FitHelper.BuildCurveExpress(pointsQP, fitTypeQP);
|
}
|
|
var result = this.ReloadDataEvent?.Invoke(featCurveExpressGroup);
|
if (result == null || !result.Value)
|
{
|
XtraMessageBox.Show("更新失败!");
|
return;
|
}
|
XtraMessageBox.Show("更新成功!");
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
}
|
}
|