| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | | public partial class AddValveSeriesDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | |
| | | } |
| | | |
| | | public event Func<Vmo.ValveSeriesVmo, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | //初始化 |
| | | private void AddValveSeriesDlg_Load(object sender, EventArgs e) |
| | | { |
| | | TextEditType.Properties.AddEnum(typeof(HStation.Service.Assets.eValveSeriesType)); |
| | | } |
| | | |
| | | //数据验证 |
| | | private bool Valid() |
| | |
| | | return; |
| | | var model = new Vmo.ValveSeriesVmo(); |
| | | model.Name = NameTextEdit.Text; |
| | | |
| | | if (Enum.TryParse(Convert.ToString(TextEditType.EditValue), true, out HStation.Service.Assets.eValveSeriesType valvetype)) |
| | | { |
| | | model.Type = valvetype; |
| | | } |
| | | model.TagName = TagNameTextEdit.Text; |
| | | model.Description = DescriptionTextEdit.Text; |
| | | if (await this.ReloadDataEvent.Invoke(model)) |
| | | { |
| | | TipFormHelper.ShowSucceed("添加成功!"); |
| | | } |
| | | else |
| | | { |
| | | TipFormHelper.ShowSucceed("添加失败!"); |
| | | TipFormHelper.ShowError("添加失败!"); |
| | | } |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |