using Yw.Dto; namespace HStation.WinFrmUI.Basic { public partial class AddSysPropGrouoDlg : DevExpress.XtraEditors.XtraForm { public AddSysPropGrouoDlg() { InitializeComponent(); } public event Func> ReloadDataEvent = null; private AddSysPropGroupInput _AddPropGroupDto { get; set; } public async void SetBindingData(long TypeID) { _AddPropGroupDto = new AddSysPropGroupInput(); _AddPropGroupDto.TypeID = TypeID; } //数据验证 private bool Valid() { this.dxErrorProvider1.ClearErrors(); if (string.IsNullOrEmpty(TextEditName.Text.Trim())) { this.dxErrorProvider1.SetError(this.TextEditName, "必填项"); return false; } return true; } //完成 private async void BtnOk_ClickAsync(object sender, EventArgs e) { _AddPropGroupDto.Name = TextEditName.Text.Trim(); _AddPropGroupDto.Description = TextEditDescription.Text.Trim(); _AddPropGroupDto.Code = TextEditCode.Text.Trim(); if (await this.ReloadDataEvent.Invoke(_AddPropGroupDto)) { MessageBoxHelper.ShowSuccess("添加成功!"); } else { MessageBoxHelper.ShowError("添加失败!"); } this.DialogResult = DialogResult.OK; this.Close(); } } }