Beispiel #1
0
    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();
        }
Beispiel #3
0
        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);
                    }
                }
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
                }
            }
        }
Beispiel #6
0
        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]);
                    }
                }
            }
        }
Beispiel #7
0
        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);
                }
            }
        }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
        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);
        }
      }
    }