Generic progress dialog
Inheritance: System.Windows.Forms.Form
コード例 #1
0
ファイル: ProgressDialog.cs プロジェクト: stophun/fdotoolbox
 /// <summary>
 /// Shows the progress dialog
 /// </summary>
 /// <param name="max">The maximum value. If less than or equal to 0, the progress bar will use the marquee animation</param>
 /// <param name="canCancel">if set to <c>true</c>, the user can cancel the operation. In this case, the <see cref="CancelEvent"/> must be handled</param>
 public static void Show(int max, bool canCancel)
 {
     instance = new ProgressDialog();
     instance.btnCancel.Enabled = canCancel;
     SetMax(max);
     
     thread = new Thread(new ThreadStart(LaunchForm));
     thread.IsBackground = true;
     thread.Start();
 }
コード例 #2
0
ファイル: ProgressDialog.cs プロジェクト: stophun/fdotoolbox
        /// <summary>
        /// Stops and closes the progress dialog
        /// </summary>
        public static void Stop()
        {
            if (instance != null)
            {
                if (instance.InvokeRequired)
                {
                    StopCallback s = new StopCallback(Stop);
                    instance.Invoke(s);
                }
                else
                {
                    instance.Close();
                    instance.Dispose();
                    instance = null;
                }
            }

            if (thread != null)
            {
                Thread.Sleep(0);
                thread = null;
            }
        }