/// <summary> /// 显示对话框 /// </summary> /// <param name="title">标题</param> /// <param name="msg">消息</param> /// <param name="workMethod">执行方法,不能在此方法内改面Form控件值</param> /// <param name="completedMethod">完成方法,可以改变Form控件值</param> /// <param name="enalbeCancel">是否允许停止</param> /// <param name="autoClose">是否自动关闭</param> /// <param name="time">停留多长时间</param> public void AsyncShow(string title, string msg, AsyncRunHandler workMethod, CompletedHandler completedMethod, bool autoClose, float time) { try { if (Instance.actived) { return; } Instance.actived = true; work = null; completed = null; Instance.btnOK.Visible = false; instance.timerProgress = 2; Instance.timer.Enabled = true; Instance.timer.Interval = 200; //Instance.pgBar2.Visible = true; Instance.pgBar.Visible = true; Instance.pgBar.Text = string.Format("2% (0秒)"); Application.DoEvents(); Instance.lblContent.Text = cruMessage = msg; Instance.totalSencond = 1; instance.totalCount = 0; Instance.dialog = false; Instance.closeTime = time; Instance.isRunning = true; Instance.Text = title; Instance.autoClose = autoClose; Application.DoEvents(); work = workMethod; completed = completedMethod; Instance.ShowDialog(); } catch (Exception ex) { throw; } }
/// <summary> /// 显示对话框 /// </summary> /// <param name="title">标题</param> /// <param name="msg">消息</param> /// <param name="workMethod">执行方法,不能在此方法内改面Form控件值</param> /// <param name="completedMethod">完成方法,可以改变Form控件值</param> /// <param name="enalbeCancel">是否允许停止</param> /// <param name="autoClose">是否自动关闭</param> public void AsyncShow(string title, string msg, AsyncRunHandler workMethod, CompletedHandler completedMethod, bool autoClose) { AsyncShow(title, msg, workMethod, completedMethod, autoClose, 0); }
/// <summary> /// 显示对话框 /// </summary> /// <param name="title">标题</param> /// <param name="msg">消息</param> /// <param name="workMethod">执行方法,不能在此方法内改面Form控件值</param> /// <param name="completedMethod">完成方法,可以改变Form控件值</param> public void AsyncShow(string title, string msg, AsyncRunHandler workMethod, CompletedHandler completedMethod) { AsyncShow(title, msg, workMethod, completedMethod, true); }