Shuxia Ning
2024-10-15 a8e54743e599fa42d627cc97ab1468937e719c04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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();
        }
 
    }
}