using Yw.WinFrmUI; namespace HStation.WinFrmUI { public partial class AddPhoneNumberDlg : DevExpress.XtraEditors.XtraForm { public AddPhoneNumberDlg() { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; ; } public event Action ReloadDataEvent; //手机号验证 private bool IsValidMobileNumber(string mobile) { var regex = new System.Text.RegularExpressions.Regex(@"^1\d{10}$"); return regex.IsMatch(mobile); } /// /// 确定 /// private void GeneralOkAndCancelCtrl1_OkEvent() { if (!IsValidMobileNumber(this.txtEditPhoneNumber.Text.Trim())) { TipFormHelper.ShowError("手机号有误!"); return; } ReloadDataEvent.Invoke(this.txtEditPhoneNumber.Text.Trim()); this.DialogResult = DialogResult.OK; this.Close(); } } }