63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using DevExpress.XtraSplashScreen;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Public
|
|
{
|
|
public class Loading
|
|
{
|
|
#region 等待窗体显示与隐藏封装
|
|
|
|
private SplashScreenManager _loadForm;
|
|
|
|
public Form form;
|
|
|
|
/// <summary>
|
|
/// 等待窗体管理对象
|
|
/// </summary>
|
|
protected SplashScreenManager LoadForm
|
|
{
|
|
get
|
|
{
|
|
if (_loadForm == null)
|
|
{
|
|
this._loadForm = new SplashScreenManager(form, typeof(Form_Wait), true, true);
|
|
this._loadForm.ClosingDelay = 0;
|
|
}
|
|
return _loadForm;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示等待窗体
|
|
/// </summary>
|
|
/// <param name="caption">大标题 为空时显示:请稍候</param>
|
|
/// <param name="description">提示 为空时显示:正在加载中</param>
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭等待窗体
|
|
/// </summary>
|
|
public void HideMessage()
|
|
{
|
|
bool isSplashFormVisible = this.LoadForm.IsSplashFormVisible;
|
|
if (isSplashFormVisible)
|
|
{
|
|
this.LoadForm.CloseWaitForm();
|
|
}
|
|
}
|
|
|
|
#endregion 等待窗体显示与隐藏封装
|
|
}
|
|
} |