예제 #1
0
        private static void ShowProgressWindow(object param)
        {
            ThreadParam threadParam = (ThreadParam)param;
            window = new fmProgress();
            //设置当前线程皮肤
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(ProgressService.SkinName);
            window.ShowInTaskbar = false;
            window.StartPosition = FormStartPosition.CenterScreen;

            window.Text = "正在执行...";
            window.Message = threadParam.Message;
            window.ProgressBar.Properties.Minimum = threadParam.Minimum;
            window.ProgressBar.Properties.Maximum = threadParam.Maximum;
            window.ProgressBar.Position = threadParam.Value;
            window.ProgressBar.Visible = !threadParam.IsIndeterminate;

            window.MarqueeProgressBar.Visible = threadParam.IsIndeterminate;
            window.MarqueeProgressBar.Location = window.ProgressBar.Location;

            window.ShowDialog();
        }
예제 #2
0
 /// <summary>
 /// 显示进度条,Show必须与Close配对出现,否则进度条无法关闭
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="message"></param>
 /// <param name="minimum"></param>
 /// <param name="maximum"></param>
 /// <param name="IsIndeterminate"></param>
 public static void Show(string message, int minimum, int maximum, bool IsIndeterminate)
 {
     if (bTestMode)
         return;
     if (_RefCount == 0)
     {
         progress = ProgressProxy.Show(message, minimum, maximum, IsIndeterminate);
     }
     else
     {
         progress.Message = message;
     }
     _RefCount++;
 }
예제 #3
0
        /// <summary>
        /// 关闭进度条
        /// </summary>
        public static void Close(Form parentForm = null)
        {
            if (bTestMode)
                return;
            _RefCount--;

            if (_RefCount == 0)
            {
                try
                {
                    progress.CloseProgress();
                    progress = null;
                    ActivateParentForm(parentForm);
                }
                catch { }
            }

            if (_RefCount < 0) _RefCount = 0;
        }
예제 #4
0
 /// <summary>
 /// 强制关闭进度条,catch块使用
 /// </summary>
 public static void Abort(Form parentForm = null)
 {
     if (bTestMode)
         return;
     if (_RefCount > 0)
     {
         _RefCountSnapshot = _RefCount;
         _MessageSnapshot = progress.Message;
         _TimerSnapShot = progress.Seconds;
         try
         {
             progress.CloseProgress();
             progress = null;
             ActivateParentForm(parentForm);
         }
         catch { }
     }
     _RefCount = 0;
 }