namespace HStation.WinFrmUI.PhartRelation
|
{
|
public partial class SetOtherNameDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public SetOtherNameDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<string, Task<bool>> VerifyValueChanged;
|
|
public void SetBindingData(string value = null)
|
{
|
this.btnEditValue.EditValue = value;
|
}
|
|
private bool Verify()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (this.btnEditValue.EditValue == null)
|
{
|
this.dxErrorProvider1.SetError(this.btnEditValue, "必填项");
|
return false;
|
}
|
|
return true;
|
}
|
|
private async void btnEditValue_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
{
|
if (!Verify())
|
return;
|
if (VerifyValueChanged == null)
|
return;
|
var value = this.btnEditValue.Text;
|
var bol = await this.VerifyValueChanged(value);
|
if (!bol)
|
{
|
XtraMessageBox.Show("内容不合理!");
|
return;
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
|
}
|
}
|