/// <summary> /// Adds a new page panel by type and associates it with the /// </summary> /// <typeparam name="Type">Type of settings panel to add.</typeparam> private void AddPagePanel <Type>() where Type : SetupPageControlBase { SetupPageControlBase settings = Activator.CreateInstance(typeof(Type)) as SetupPageControlBase; settings.Dock = DockStyle.Top; pagePanelContainer.Controls.Add(settings); }
/// <summary> /// Updates the settings panel controls. Showing the one that is associated with /// the selected node and hiding the others. Also adjusts the page title text. /// </summary> private void UpdateSettingsPanels() { pageGroupNameLabel.Text = string.Empty; for (int i = 0; i < pagePanelContainer.Controls.Count; i++) { SetupPageControlBase panel = pagePanelContainer.Controls[i] as SetupPageControlBase; bool selected = (i == PageIndex); panel.Visible = selected; if (selected) { pageGroupNameLabel.Text = panel.Title; } } SetupPageControlBase selectedPanel = pagePanelContainer.Controls[PageIndex] as SetupPageControlBase; previousButton.Enabled = selectedPanel.PreviousEnabled; nextButton.Enabled = selectedPanel.NextEnabled; nextButton.Text = (PageIndex == pagePanelContainer.Controls.Count - 1) ? "Finish" : "Next"; }