public void AddSection(ConfigPage aSection) { if (settingSections.ContainsKey(aSection.SectionName)) { return; } settingSections.Add(aSection.SectionName, aSection); }
private void ToggleSectionVisibility(bool aShowAdvancedOptions) { // using property so setter updates values.. AdvancedMode = aShowAdvancedOptions; sectionTree.BeginUpdate(); TreeNode currentSelected = (TreeNode)sectionTree.SelectedNode; sectionTree.Nodes.Clear(); foreach (KeyValuePair <string, ConfigPage> singleConfig in settingSections) { ConfigPage currentSection = singleConfig.Value; // Add all loaded sections to the TreeView if (currentSection.IsVisible) { SectionTreeNode treeNode = new SectionTreeNode(currentSection.ConfigSection); // If not parent is specified we add the section as root node. if (currentSection.Parentsection == null) { // Add to the root sectionTree.Nodes.Add(treeNode); } else { // Find parent section (IndexOfKey is buggy) int parentPos = -1; // This limits usage to one level only - loop subitems if you want to build a tree for (int i = 0; i < sectionTree.Nodes.Count; i++) { if (sectionTree.Nodes[i].Text.CompareTo(currentSection.Parentsection.Text) == 0) { parentPos = i; break; } } if (parentPos > -1) { // Add to the parent node SectionTreeNode parentTreeNode = (SectionTreeNode)sectionTree.Nodes[parentPos]; parentTreeNode.Nodes.Add(treeNode); } } } } if (currentSelected != null) { // Reselect the node we were editing before foreach (TreeNode parentNode in sectionTree.Nodes) { foreach (TreeNode node in parentNode.Nodes) { if (node.Text.CompareTo(currentSelected.Text) == 0) { sectionTree.SelectedNode = node; node.EnsureVisible(); break; } } } } sectionTree.EndUpdate(); }
private void onConfigClicked(object sender, System.EventArgs e) { this.clearHbConfig(); Widget w = new ConfigPage(); this.loadHbConfig(w); }
private void DisplayEnterTimePage() { m_CurrentPage = ConfigPage.EnterTime; btnCancel.Text = "Cancel"; btnOK.Text = "Next >>"; pnlObject.Visible = false; pnlTime.Visible = true; pnlTime.BringToFront(); }
private void DisplayEnterCoordsPage() { m_CurrentPage = ConfigPage.EnterCoords; btnCancel.Text = "<< Back"; btnOK.Text = "OK"; pnlTime.Visible = false; pnlObject.Visible = true; pnlObject.BringToFront(); }
protected override CodePage NewResultPage(ConfigPage page) => new CodePage(page.Manager, page);