using DevExpress.XtraEditors;
namespace Yw.WinFrmUI.Phart
{
public partial class ValveEditDlg : XtraForm
{
public ValveEditDlg()
{
InitializeComponent();
}
///
/// 回调事件
///
public event Func> ReloadDataEvent;
///
/// 初始化数据
///
public void SetBindingData(string pt_list_json)
{
var pt_list = Yw.JsonHelper.Json2Object>(pt_list_json);
if (pt_list == null || pt_list.Count == 0)
{
return;
}
var ql = new Yw.Geometry.CubicSpline2d(pt_list);
this.curveExpressEditCtrl1.SetBindingData(ql);
}
///
/// 绑定数据
///
public void SetBindingData(List pt_ql_list,
List def_pt_ql_list)
{
this.curveExpressEditCtrl1.SetBindingData(pt_ql_list, def_pt_ql_list);
}
//确定
private async void btnOk_Click(object sender, EventArgs e)
{
var bol = this.curveExpressEditCtrl1.GetPoints(
out List pt_ql_list);
if (!bol)
{
return;
}
var pt_list_json = Yw.JsonHelper.Object2Json(pt_ql_list);
var result = await this.ReloadDataEvent?.Invoke(pt_list_json);
if (!result)
{
XtraMessageBox.Show("更新失败!");
return;
}
XtraMessageBox.Show("更新成功!");
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}