/// <summary>
        /// Display the wizard finish page.
        /// </summary>
        private void DisplayFinishPage()
        {
            this.SuspendLayout();

            WizardBaseCtl previousPage = null;

            // Check if there was a previous wizard page.
            if (wizardPage != null)
            {
                task         = wizardPage.BkgTask;
                previousPage = wizardPage;

                // Remove the previous wizard page.
                pnlContent.Controls.Remove(wizardPage);
            }

            wizardPage = _finishPage;

            // Subscribe for wizard events.
            (wizardPage as WizFinishPageCtl).FinishPageExit +=
                new WizFinishPageCtl.FinishPageExitEventHandler(OnFinishPageExit);

            string wizName   = Translator.Translate(wizardName);
            string finishing = Translator.Translate("TXT_WIZFINISHING");

            // Set the title bar text.
            SetTitle($"{wizName} {finishing}");

            AddPageToForm(wizardPage);

            // Set the table of variables.
            // If this is the first wizard step then the table should be empty.
            wizardPage.BkgTask = task;

            // Set the wizard direction
            wizardPage.Direction = wizardDirection;

            if (previousPage != null)
            {
                // Set the wizard direction
                previousPage.Direction = wizardDirection;
                previousPage.ExecutePageLeaveActions();
            }

            wizardPage.ExecutePageEnterActions();
            wizardPage.Focus();

            this.ResumeLayout();
        }
        /// <summary>
        /// Display the wizard page that corresponds to the current
        /// wizard step.
        /// </summary>
        private void DisplayActiveWizardPage()
        {
            // Check if the specified wizardStep is in range.
            if (wizardStep < 0 || wizardStep >= wizardPages.Count)
            {
                return;
            }

            this.SuspendLayout();

            WizardBaseCtl previousPage = null;

            // Check if there was a previous wizard page.
            if (wizardPage != null)
            {
                task         = wizardPage.BkgTask;
                previousPage = wizardPage;
            }

            wizardPage = wizardPages[wizardStep] as WizardBaseCtl;

            if (this.wizardPage != null)
            {
                // On first wizard page, disable "Back" button
                stepButtons.CanMoveBack = (wizardStep > 0);
                // On last wizard page, disable "Next" button
                stepButtons.CanMoveNext = (wizardStep < wizardPages.Count - 1);
                // On last wizard page, enable "Finish" button
                stepButtons.CanFinish = (wizardStep >= wizardPages.Count - 1);

                // Set the title bar text (e.g. "Wizard X Step 2 of 4").
                // If the wizard has only one step show .
                if (wizardPages.Count > 1)
                {
                    string wizName  = Translator.Translate(wizardName);
                    string stepText = Translator.Translate("TXT_WIZARDSTEPTEXT");
                    int    step     = wizardStep + 1;
                    string delim    = Translator.Translate("TXT_WIZARDSTEPDELIMITER");
                    int    count    = wizardPages.Count;

                    SetTitle($"{wizName} - {stepText} {step} {delim} {count}");
                }
                else
                {
                    SetTitle(Translator.Translate(wizardName));
                }

                AddPageToForm(wizardPage);

                wizardPage.BkgTask = task;

                // Set the wizard direction
                wizardPage.Direction = wizardDirection;
                wizardPage.Focus();

                this.ShowImage     = wizardPage.ShowImage;
                this.ShowSeparator = wizardPage.ShowSeparator;
            }

            this.ResumeLayout();

            if (previousPage != null)
            {
                // Set the wizard direction
                previousPage.Direction = wizardDirection;
                previousPage.ExecutePageLeaveActions();
            }

            if (this.wizardPage != null)
            {
                // Execute the custom actions for the wizard page.
                // This is necessary because different actions might
                // be needed when moving next or back.
                wizardPage.ExecutePageEnterActions();
            }
        }