BF2Statistics.TaskForm.Show C# (CSharp) Метод

Show() публичный статический Метод

Open and displays the task form.
Thrown if the Task form is already open and running. Use the IsOpen property /// to determine if the form is already running
public static Show ( Form Parent, string WindowTitle, string InstructionText, ProgressBarStyle Style, int Steps ) : void
Parent System.Windows.Forms.Form The calling form, so the task form can be centered
WindowTitle string The task dialog window title
InstructionText string Instruction text displayed after the info icon. Leave null /// to hide the instruction text and icon.
Style ProgressBarStyle The progress bar style
Steps int
Результат void
        public static void Show(Form Parent, string WindowTitle, string InstructionText, ProgressBarStyle Style, int Steps)
        {
            Show(Parent, WindowTitle, InstructionText, null, true, Style, Steps);
        }

Same methods

TaskForm::Show ( Form Parent, string WindowTitle, string InstructionText, bool Cancelable ) : void
TaskForm::Show ( Form Parent, string WindowTitle, string InstructionText, bool Cancelable, ProgressBarStyle Style, int Steps ) : void
TaskForm::Show ( Form Parent, string WindowTitle, string InstructionText, string SubMessage, bool Cancelable, ProgressBarStyle Style, int ProgressBarSteps ) : void

Usage Example

Пример #1
0
        /// <summary>
        /// Open and displays the task form.
        /// </summary>
        /// <param name="Parent">The calling form, so the task form can be centered</param>
        /// <param name="WindowTitle">The task dialog window title</param>
        /// <param name="InstructionText">Instruction text displayed after the info icon. Leave null
        /// to hide the instruction text and icon.</param>
        /// <param name="SubMessage">Detail text that is displayed just above the progress bar</param>
        /// <param name="Cancelable">Specifies whether the operation can be canceled</param>
        /// <param name="Style">The progress bar style</param>
        /// <exception cref="Exception">Thrown if the Task form is already open and running. Use the IsOpen property
        /// to determine if the form is already running</exception>
        public static void Show(Form Parent, string WindowTitle, string InstructionText, string SubMessage, bool Cancelable, ProgressBarStyle Style, int ProgressBarSteps)
        {
            // Make sure we dont have an already active form
            if (Instance != null && !Instance.IsDisposed)
            {
                throw new Exception("Task Form is already being displayed!");
            }

            // Create new instance
            Instance      = new TaskForm();
            Instance.Text = WindowTitle;
            Instance.labelInstructionText.Text = InstructionText;
            Instance.labelContent.Text         = SubMessage;
            Instance.Cancelable        = Cancelable;
            Instance.progressBar.Style = Style;

            // Setup progress bar
            if (ProgressBarSteps > 0)
            {
                Instance.progressBar.Maximum = ProgressBarSteps;
            }

            // Hide Instruction panel if Instruction Text is empty
            if (String.IsNullOrWhiteSpace(InstructionText))
            {
                Instance.panelMain.Hide();
                Instance.labelContent.Location    = new Point(10, 15);
                Instance.labelContent.MaximumSize = new Size(410, 0);
                Instance.labelContent.Size        = new Size(410, 0);
                Instance.progressBar.Location     = new Point(10, 1);
                Instance.progressBar.Size         = new Size(410, 18);
            }

            // Hide Cancel
            if (!Cancelable)
            {
                Instance.panelButton.Hide();
                Instance.Padding   = new Padding(0, 0, 0, 15);
                Instance.BackColor = Color.White;
            }

            // Set window position to center parent
            double H = Parent.Location.Y + (Parent.Height / 2) - (Instance.Height / 2);
            double W = Parent.Location.X + (Parent.Width / 2) - (Instance.Width / 2);

            Instance.Location = new Point((int)Math.Round(W, 0), (int)Math.Round(H, 0));

            // Display the Instanced Form
            Instance.Show(Parent);

            // Wait until the Instance form is displayed
            while (!Instance.IsHandleCreated)
            {
                Thread.Sleep(50);
            }
        }
All Usage Examples Of BF2Statistics.TaskForm::Show