/// <summary> /// Add a "wizard page type" into the list of pages. /// The order that is used when adding pages will be /// used by the class when navigating with next/back /// buttons through the wizard. /// </summary> /// <param name="type">The type of the user control to /// use as wizard page.</param> public void AddWizardPage(Type type) { // Create the wizard page. WizardBaseCtl wizardPage = Activator.CreateInstance(type) as WizardBaseCtl; if (wizardPage != null) { // Translate and add the created wizard page // to the wizard pages list. wizardPages.Add(wizardPage); } }
/// <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(); }
private void AddPageToForm(WizardBaseCtl wizardPage) { this.SuspendLayout(); pnlWizardLayout.SuspendLayout(); pnlWizardStep.SuspendLayout(); wizardPage.Dock = DockStyle.Fill; wizardPage.Visible = true; Translator.TranslateControl(wizardPage, DesignMode); pnlContent.Margin = new Padding(0); pnlContent.Padding = new Padding(0); wizardPage.Margin = new Padding(0); wizardPage.Padding = new Padding(0); pnlWizardStep.Dock = DockStyle.Fill; pnlWizardStep.Controls.Clear(); pnlWizardStep.Controls.Add(wizardPage); ThemeManager.SetDoubleBuffer(wizardPage); if (wizardPage.DesiredSize.IsEmpty) { // Standard size this.Width = 535; this.Height = 400; } else { // Custom size this.Width = wizardPage.DesiredSize.Width; this.Height = wizardPage.DesiredSize.Height; } pnlWizardStep.ResumeLayout(); pnlWizardLayout.ResumeLayout(); this.ResumeLayout(); }
/// <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); // Set the title bar text. SetTitle(string.Format("{0} {1}", Translator.Translate(wizardName), Translator.Translate("TXT_WIZFINISHING"))); 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(); }
private void AddPageToForm(WizardBaseCtl wizardPage) { this.SuspendLayout(); pnlWizardLayout.SuspendLayout(); pnlWizardStep.SuspendLayout(); wizardPage.Dock = DockStyle.Fill; wizardPage.Visible = true; Translator.TranslateControl(wizardPage, DesignMode); pnlContent.Margin = new Padding(0); pnlContent.Padding = new Padding(0); wizardPage.Margin = new Padding(0); wizardPage.Padding = new Padding(0); pnlWizardStep.Dock = DockStyle.Fill; pnlWizardStep.Controls.Clear(); pnlWizardStep.Controls.Add(wizardPage); if (wizardPage.DesiredSize.IsEmpty) { // Standard size this.Width = 535; this.Height = 400; } else { // Custom size this.Width = wizardPage.DesiredSize.Width; this.Height = wizardPage.DesiredSize.Height; } ThemeManager.SetDoubleBuffer(wizardPage); pnlWizardStep.ResumeLayout(); pnlWizardLayout.ResumeLayout(); 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) { SetTitle(string.Format("{0} - {1} {2} {3} {4}", Translator.Translate(wizardName), Translator.Translate("TXT_WIZARDSTEPTEXT"), wizardStep + 1, Translator.Translate("TXT_WIZARDSTEPDELIMITER"), wizardPages.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(); } }
/// <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(); } }