using DevExpress.XtraSplashScreen; using System.Windows.Forms; namespace HL_FristAidPlatform_Public { public class Loading { #region 等待窗体显示与隐藏封装 private SplashScreenManager _loadForm; public Form form; /// /// 等待窗体管理对象 /// protected SplashScreenManager LoadForm { get { if (_loadForm == null) { this._loadForm = new SplashScreenManager(form, typeof(Form_Wait), true, true); this._loadForm.ClosingDelay = 0; } return _loadForm; } } /// /// 显示等待窗体 /// /// 大标题 为空时显示:请稍候 /// 提示 为空时显示:正在加载中 public void ShowMessage(string caption = "", string description = "") { bool flag = !this.LoadForm.IsSplashFormVisible; if (flag) { this.LoadForm.ShowWaitForm(); if (!string.IsNullOrEmpty(caption)) this.LoadForm.SetWaitFormCaption(caption); if (!string.IsNullOrEmpty(description)) this.LoadForm.SetWaitFormDescription(description); } } /// /// 关闭等待窗体 /// public void HideMessage() { bool isSplashFormVisible = this.LoadForm.IsSplashFormVisible; if (isSplashFormVisible) { this.LoadForm.CloseWaitForm(); } } #endregion 等待窗体显示与隐藏封装 } }