示例#1
0
        /// <summary>
        ///     Adds a new settings panel by type and associates it with the
        /// </summary>
        /// <typeparam name="Type">Type of settings panel to add.</typeparam>
        /// <param name="nodeName">Name of node in tree view to associate panel with.</param>
        private void AddSettingsPanel <Type>(string nodeName)
            where Type : SettingsControlBase
        {
            SettingsControlBase settings = Activator.CreateInstance(typeof(Type)) as SettingsControlBase;

            settings.Dock = DockStyle.Top;

            settingsPanelContainer.Controls.Add(settings);
            settingsPanels.Add(nodeName, settings);
        }
示例#2
0
        /// <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()
        {
            settingsGroupNameLabel.Text = string.Empty;

            foreach (string nodeName in settingsPanels.Keys)
            {
                SettingsControlBase panel = settingsPanels[nodeName];

                bool selected = false;
                if (groupTreeView.SelectedNode != null)
                {
                    selected = groupTreeView.SelectedNode.Name == nodeName;
                }

                panel.Visible = selected;

                if (selected)
                {
                    settingsGroupNameLabel.Text = panel.GroupName;
                }
            }
        }