using DevExpress.XtraEditors;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
public partial class SetPointDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public SetPointDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<double, double, bool> VerifyValueChanged;
|
|
public void SetBindingData(double? x = null, double? y = null)
|
{
|
this.txtX.EditValue = x;
|
this.txtY.EditValue = y;
|
}
|
|
private bool Verify()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (this.txtX.EditValue == null)
|
{
|
this.dxErrorProvider1.SetError(this.txtX, "必填项");
|
return false;
|
}
|
|
if (this.txtY.EditValue == null)
|
{
|
this.dxErrorProvider1.SetError(this.txtY, "必填项");
|
return false;
|
}
|
|
return true;
|
}
|
|
private void btnOk_Click(object sender, EventArgs e)
|
{
|
if (!Verify())
|
return;
|
if (VerifyValueChanged == null)
|
return;
|
var xValue = Convert.ToDouble(this.txtX.Text);
|
var yValue = Convert.ToDouble(this.txtY.Text);
|
var bol = this.VerifyValueChanged(xValue, yValue);
|
if (!bol)
|
{
|
XtraMessageBox.Show("数值不合理!");
|
return;
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
}
|