public virtual void AddChildSection(SectionSettings parentSection, SectionSettings section) { // // Make sure this section doesn't already exist // // // Add section to tree // SectionTreeNode treeNode = new SectionTreeNode(section); if (parentSection == null) { // // Add to the root // sectionTree.Nodes.Add(treeNode); } else { // // Add to the parent node // SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; parentTreeNode.Nodes.Add(treeNode); } settingSections.Add(section.Text, treeNode); //treeNode.EnsureVisible(); }
public override void AddChildSection(SectionSettings parentSection, SectionSettings section) { // // Make sure this section doesn't already exist // // // Add section to tree // SectionTreeNode treeNode = new SectionTreeNode(section); if (parentSection == null) { // // Add to the root // sectionTree.Nodes.Add(treeNode); } else { // // Add to the parent node // SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; treeNode.Name = section.Text; parentTreeNode.Nodes.Add(treeNode); } settingSections.Add(section.Text, treeNode); //treeNode.EnsureVisible(); }
public override void SaveSectionSettings(TreeNode currentNode) { if (currentNode != null) { // // Save settings for current node // SectionTreeNode treeNode = currentNode as SectionTreeNode; if (treeNode != null) { treeNode.Section.SaveSettings(); } // // Load settings for all child nodes // if (treeNode != null) { foreach (TreeNode childNode in treeNode.Nodes) { SaveSectionSettings(childNode); } } } }
public SectionTreeNode GetChildNode(SectionSettings parentSection, SectionSettings section) { SectionTreeNode treeNode = new SectionTreeNode(section); SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; for (int i = 0; i < parentTreeNode.GetNodeCount(true); i++) { if (parentTreeNode.Nodes[i].Name == section.Text) { return(treeNode); } } return(null); }
public void RemoveAllChildSections(SectionSettings parentSection) { // Remove section from tree if (parentSection != null) { SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; foreach (SectionTreeNode childNode in parentTreeNode.Nodes) { // recursive delete all children RemoveAllChildSections(childNode); //Remove the section from the hashtable in case we add it again settingSections.Remove(childNode.Text); parentTreeNode.Nodes.Remove(childNode); } } }
public void RemoveChildSection(SectionSettings parentSection, SectionSettings section) { // Remove section from tree if (parentSection != null) { SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; for (int i = 0; i < parentTreeNode.GetNodeCount(true); i++) { if (parentTreeNode.Nodes[i].Name == section.Text) { //Remove the section from the hashtable in case we add it again settingSections.Remove(section.Text); parentTreeNode.Nodes.Remove(parentTreeNode.Nodes[i]); } } } }
public void RemoveAllChildSections(SectionTreeNode parentTreeNode) { // Remove section from tree if (parentTreeNode != null) { foreach (SectionTreeNode childNode in parentTreeNode.Nodes) { // recursive delete all children RemoveAllChildSections(childNode); //Remove the section from the hashtable in case we add it again settingSections.Remove(childNode.Text); } // first remove all children and sections, then nodes themself (otherwise collection changes during iterate) foreach (SectionTreeNode childNode in parentTreeNode.Nodes) { parentTreeNode.Nodes.Remove(childNode); } } }
public static SectionSettings GetSection(string name) { SectionSettings sectionSettings = null; SectionTreeNode sectionTreeNode = SettingsForm.SettingSections[name] as SectionTreeNode; if (sectionTreeNode != null) { sectionSettings = sectionTreeNode.Section; } else { // // Failed to locate the specified section, loop through and try to match // a section against the type name instead, as this is the way the wizard names // its sections. // IDictionaryEnumerator enumerator = SettingsForm.SettingSections.GetEnumerator(); while (enumerator.MoveNext()) { SectionTreeNode treeNode = enumerator.Value as SectionTreeNode; if (treeNode != null) { Type sectionType = treeNode.Section.GetType(); if (sectionType.Name.Equals(name)) { sectionSettings = treeNode.Section; break; } } } } return(sectionSettings); }
public void AddChildSection(SectionSettings parentSection, SectionSettings section, int imageIndex) { // // Make sure this section doesn't already exist // // // Add section to tree // SectionTreeNode treeNode = new SectionTreeNode(section); if (parentSection == null) { // // Add to the root // treeNode.ImageIndex = imageIndex; treeNode.SelectedImageIndex = imageIndex; sectionTree.Nodes.Add(treeNode); } else { // // Add to the parent node // SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; treeNode.ImageIndex = imageIndex; treeNode.SelectedImageIndex = imageIndex; parentTreeNode.Nodes.Add(treeNode); } settingSections.Add(section.Text, treeNode); //treeNode.EnsureVisible(); }
private void AddServerTvCards(Servers servers, IList <Server> dbsServers, bool reloaded) { foreach (Server server in dbsServers) { bool isLocal = (server.HostName.ToLowerInvariant() == Dns.GetHostName().ToLowerInvariant() || server.HostName.ToLowerInvariant() == Dns.GetHostName().ToLowerInvariant() + "." + System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName. ToLowerInvariant()); cardPage = new TvCards(server.HostName); cardPage.TvCardsChanged += OnTvCardsChanged; AddChildSection(servers, cardPage, 0); foreach (Card dbsCard in server.ReferringCard()) { if (dbsCard.Enabled == true && RemoteControl.Instance.CardPresent(dbsCard.IdCard)) { CardType type = RemoteControl.Instance.Type(dbsCard.IdCard); int cardId = dbsCard.IdCard; string cardName = dbsCard.Name; switch (type) { case CardType.Analog: cardName = String.Format("{0} Analog {1}", cardId, cardName); AddChildSection(cardPage, new CardAnalog(cardName, dbsCard.IdCard), 1); break; case CardType.DvbT: cardName = String.Format("{0} DVB-T {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbT(cardName, dbsCard.IdCard), 1); break; case CardType.DvbC: cardName = String.Format("{0} DVB-C {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbC(cardName, dbsCard.IdCard), 1); break; case CardType.DvbS: cardName = String.Format("{0} DVB-S {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbS(cardName, dbsCard.IdCard), 1); break; case CardType.Atsc: cardName = String.Format("{0} ATSC {1}", cardId, cardName); AddChildSection(cardPage, new CardAtsc(cardName, dbsCard.IdCard), 1); break; case CardType.DvbIP: cardName = String.Format("{0} DVB-IP {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbIP(cardName, dbsCard.IdCard), 1); break; case CardType.RadioWebStream: cardName = String.Format("{0} {1}", cardId, cardName); InfoPage RadioWebStreamInfo = new InfoPage(cardName); RadioWebStreamInfo.InfoText = "The RadioWebStream card does not have any options.\n\n\nYou can add your favourite radio webstreams under:\n\n --> 'Radio Channels', 'Add', 'Web-Stream' or by importing a playlist."; AddChildSection(cardPage, RadioWebStreamInfo, 1); break; case CardType.Unknown: cardName = String.Format("{0} Unknown {1}", cardId, cardName); AddChildSection(cardPage, new CardAnalog(cardName, dbsCard.IdCard), 1); break; } } } if (isLocal) { Utils.CheckForDvbHotfix(); } if (reloaded) { SectionTreeNode activeNode = (SectionTreeNode)settingSections[server.HostName]; if (activeNode != null) { activeNode.Expand(); } } } }
public SectionTreeNode GetChildNode(SectionSettings parentSection, SectionSettings section) { SectionTreeNode treeNode = new SectionTreeNode(section); SectionTreeNode parentTreeNode = (SectionTreeNode)settingSections[parentSection.Text]; for (int i = 0; i < parentTreeNode.GetNodeCount(true); i++) { if (parentTreeNode.Nodes[i].Name == section.Text) return treeNode; } return null; }
public void RemoveAllChildSections(SectionTreeNode parentTreeNode) { // Remove section from tree if (parentTreeNode != null) { foreach (SectionTreeNode childNode in parentTreeNode.Nodes) { // recursive delete all children RemoveAllChildSections(childNode); //Remove the section from the hashtable in case we add it again settingSections.Remove(childNode.Text); } // first remove all children and sections, then nodes themself (otherwise collection changes during iterate) foreach (SectionTreeNode childNode in parentTreeNode.Nodes) { parentTreeNode.Nodes.Remove(childNode); } } }