public static void ShowHint(string text, HintIconType iconType, int atLeastDuration, int atMostDuration,
                                    Form parentForm, bool waitForClose)
        {
            var tsk = new Task(() => {
                AutoCloseDialog dlg = new AutoCloseDialog();

                dlg.ShowClose(text, iconType, atLeastDuration, atMostDuration, parentForm);
            });

            tsk.Start();
            if (waitForClose)
            {
                tsk.Wait();
            }
        }
Пример #2
0
        ///// <summary>
        ///// 启动百分比进度条
        ///// </summary>
        ///// <param name="total">进度总值</param>
        ///// <param name="message">提示信息</param>
        ///// <param name="callback">Hint回调返回参数</param>
        //public static void StartProgress(SynchronizationContext uiContext, int total, string message, Action<HintArgs> callback = null)
        //{
        //    ProgressFormManage.Singleton.StartProgress(uiContext, total, message, callback);
        //}
        ///// <summary>
        ///// 百分比进度条
        ///// </summary>
        ///// <param name="current">当前进度值</param>
        ///// <param name="message">提示消息</param>
        //public static void ShowProcess(int current, string message)
        //{
        //    ProgressFormManage.Singleton.ShowProgress(current, message);
        //}
        ///// <summary>
        ///// 关闭百分比进度条
        ///// </summary>
        //public static void ProcessDone()
        //{
        //    ProgressFormManage.Singleton.ShowProgress(int.MaxValue, "");
        //}

        /// <summary>
        /// 自动隐藏提示框
        /// </summary>
        /// <param name="parentForm">所有者,影响显示位置,为null时屏幕居中</param>
        /// <param name="text"></param>
        /// <param name="iconType"></param>
        /// <param name="atLeastDuration"></param>
        /// <param name="atMostDuration"></param>
        /// <param name="waitForClose"></param>
        public static void ShowAutoCloseDialog(Form parentForm, string text, HintIconType iconType = HintIconType.OK, int atLeastDuration = 1500, int atMostDuration = 5000, bool waitForClose = false)
        {
            AutoCloseDialog.ShowHint(text, iconType, atLeastDuration, atMostDuration, parentForm, waitForClose);
        }