Example #1
0
 private bool GetFavoriteContainer(out ChannelFolder parentChannelFolder, out TreeNodeCollection parentTreeNodeCollection)
 {
     if (this.treeViewChannel.SelectedNode == null || (this.treeViewChannel.SelectedNode.Parent == null && !(this.treeViewChannel.SelectedNode.Tag is ChannelFolder)))
     {
         parentChannelFolder = (ChannelFolder)this.treeViewChannel.Tag;
         parentTreeNodeCollection = this.treeViewChannel.Nodes;
         return true;
     }
     else if (this.treeViewChannel.SelectedNode.Tag is ChannelTV)
     {
         TreeNode parentTreeNode = this.treeViewChannel.SelectedNode.Parent;
         parentChannelFolder = (ChannelFolder)parentTreeNode.Tag;
         parentTreeNodeCollection = parentTreeNode.Nodes;
         return true;
     }
     else if (this.treeViewChannel.SelectedNode.Tag is ChannelFolder)
     {
         parentChannelFolder = (ChannelFolder)this.treeViewChannel.SelectedNode.Tag;
         parentTreeNodeCollection = treeViewChannel.SelectedNode.Nodes;
         return true;
     }
     parentChannelFolder = null;
     parentTreeNodeCollection = null;
     return false;
 }
Example #2
0
 internal void AddChannelToFavorite(ChannelFolder channelFolder, Channel[] channels)
 {
     TreeNode parentTreeNode = channelFolder.Tag as TreeNode;
     TreeNodeCollection parentTreeNodeCollection = (parentTreeNode == null ? this.treeViewChannel.Nodes : parentTreeNode.Nodes);
     foreach (Channel channel in channels)
     {
         channelFolder.Add(channel);
         parentTreeNodeCollection.Add(MakeTreeNodeFromChannel(channel));
     }
 }
Example #3
0
        internal void RecursedFillTree(ChannelFolder parentChannel, TreeNodeCollection parentTreeNodeCollection)
        {
            foreach (Channel channel in parentChannel.ChannelList)
            {
                channel.Parent = parentChannel;

                TreeNode treeNode = MakeTreeNodeFromChannel(channel);

                if (channel is ChannelFolder)
                    RecursedFillTree(channel as ChannelFolder, treeNode.Nodes);

                parentTreeNodeCollection.Add(treeNode);
            }
        }
Example #4
0
        private void addFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChannelFolder channelFolder = new ChannelFolder(Properties.Resources.NewChannelFolder);
            TreeNode treeNode = MakeTreeNodeFromChannel(channelFolder);
            treeNode.Expand();

            if (this.treeViewChannel.SelectedNode == null || this.treeViewChannel.SelectedNode.Parent == null)
            {
                ChannelFolder parentChannelFolder = (ChannelFolder)this.treeViewChannel.Tag;
                parentChannelFolder.Add(channelFolder);
                this.treeViewChannel.Nodes.Add(treeNode);
            }
            else if (this.treeViewChannel.SelectedNode.Tag is ChannelFolder)
            {
                ChannelFolder parentChannelFolder = (ChannelFolder)this.treeViewChannel.SelectedNode.Tag;
                parentChannelFolder.Add(channelFolder);
                this.treeViewChannel.SelectedNode.Nodes.Add(treeNode);
                this.treeViewChannel.SelectedNode.Expand();
            }
            else
            {
                ChannelFolder parentChannelFolder = (ChannelFolder)this.treeViewChannel.SelectedNode.Parent.Tag;
                TreeNode parentTreeNode = this.treeViewChannel.SelectedNode.Parent;
                int indexChannel = parentChannelFolder.ChannelList.IndexOf(this.treeViewChannel.SelectedNode.Tag as Channel);
                int indexTreeNode = parentTreeNode.Nodes.IndexOf(this.treeViewChannel.SelectedNode);

                channelFolder.Parent = parentChannelFolder;
                parentChannelFolder.ChannelList.Insert(indexChannel, channelFolder);
                this.treeViewChannel.SelectedNode.Parent.Nodes.Insert(indexTreeNode, treeNode);
            }
        }
Example #5
0
        internal void InsertChannels(Stream fileStream, ChannelFolder parentChannel, TreeNodeCollection parentTreeNodeCollection)
        {
            ChannelFolder channels = (ChannelFolder)Channel.Deserialize(fileStream);
            if (parentChannel == null)
                parentChannel = MainForm.rootChannelFolder;
            if (parentTreeNodeCollection == null)
                parentTreeNodeCollection = this.treeViewChannel.Nodes;

            // First level: we add to the existing folder
            // Second level: we adjust the parent
            foreach (Channel channel in channels.ChannelList)
            {
                parentChannel.Add(channel);

                TreeNode treeNode = MakeTreeNodeFromChannel(channel);

                if (channel is ChannelFolder)
                    RecursedFillTree(channel as ChannelFolder, treeNode.Nodes);

                parentTreeNodeCollection.Add(treeNode);
            }

            MainForm.UpdateChannelNumber();
        }
Example #6
0
 private void UpdateChannelNumberRecursedTree(ChannelFolder channelFolder)
 {
     foreach (Channel channel in channelFolder.ChannelList)
     {
         if (channel is ChannelTV)
         {
             short channelNumber = (channel as ChannelTV).ChannelNumber;
             channelNumberMax = Math.Max(channelNumberMax, channelNumber);
             if (channelNumber >= 0)
             {
                 if (this.channelByChannelNumber.ContainsKey(channelNumber))
                     this.cloneChannelNumber.Add(channel);
                 else
                     this.channelByChannelNumber[channelNumber] = channel;
             }
         }
         else if (channel is ChannelFolder)
             UpdateChannelNumberRecursedTree(channel as ChannelFolder);
     }
 }
Example #7
0
        private void PopulateChannelsInDropDownMenu(ToolStripMenuItem toolStripMenuItem, ChannelFolder channelFolder)
        {
            toolStripMenuItem.DropDownItems.Clear();

            foreach (Channel channel in channelFolder.ChannelList)
            {
                ToolStripMenuItem channelToolStripMenuItem = new ToolStripMenuItem(channel.Name);
                channelToolStripMenuItem.Tag = channel;
                if (channel is ChannelFolder)
                {
                    channelToolStripMenuItem.Image = this.imageListLogoTV.Images["FolderClosed"];
                    channelToolStripMenuItem.DropDownItems.Add("dummy");
                    channelToolStripMenuItem.DropDownOpening += new EventHandler(channelToolStripMenuItem_DropDownOpening);
                }
                else
                {
                    if (channel is ChannelTV)
                    {
                        channelToolStripMenuItem.Image = this.imageListLogoTV.Images[(channel as ChannelTV).Logo];
                        if(channelToolStripMenuItem.Image == null)
                            channelToolStripMenuItem.Image = this.imageListLogoTV.Images["LogoTVDefault"];
                    }
                    channelToolStripMenuItem.Click += new EventHandler(channelToolStripMenuItem_Click);
                }
                toolStripMenuItem.DropDownItems.Add(channelToolStripMenuItem);
            }
        }
Example #8
0
        private void PopulateChannelsFolderInDropDownMenu(ToolStripItemCollection toolStripItemCollection, ChannelFolder channelFolder)
        {
            toolStripItemCollection.Clear();
            ToolStripMenuItem channelToolStripMenuItem0 = new ToolStripMenuItem(Properties.Resources.ChooseFolder);
            channelToolStripMenuItem0.Tag = channelFolder;
            channelToolStripMenuItem0.Click += new EventHandler(channelFolderToolStripMenuItem_Click);
            toolStripItemCollection.Add(channelToolStripMenuItem0);

            foreach (Channel channel in channelFolder.ChannelList)
            {
                if (channel is ChannelFolder)
                {
                    ToolStripMenuItem channelToolStripMenuItem = new ToolStripMenuItem(channel.Name);
                    channelToolStripMenuItem.Tag = channel;
                    channelToolStripMenuItem.DropDownItems.Clear();
                    channelToolStripMenuItem.DropDownOpening += new EventHandler(channelFolderToolStripMenuItem_DropDownOpening);

                    ToolStripMenuItem channelToolStripMenuItem1 = new ToolStripMenuItem("Dummy");
                    channelToolStripMenuItem.DropDownItems.Add(channelToolStripMenuItem1);

                    toolStripItemCollection.Add(channelToolStripMenuItem);
                }
            }
        }
Example #9
0
        // wizardPageChannelNumber
        private void InitChannelNumberingRecursedTree(ChannelFolder channelFolder)
        {
            foreach (Channel channel in channelFolder.ChannelList)
            {
                ListViewItem lvi = new ListViewItem(channel.Name);
                lvi.IndentCount = currentChannelIndentation;
                lvi.Tag = channel;
                mapChannelsIndentation[lvi] = currentChannelIndentation;
                if (channel is ChannelTV)
                {
                    ChannelTV channelTV = channel as ChannelTV;
                    lvi.SubItems.Add(channelTV.ChannelNumber.ToString());
                    maxChannelNumber = Math.Max(maxChannelNumber, channelTV.ChannelNumber);
                    lvi.ImageKey = (MainForm.imageListLogoTV.Images.ContainsKey(channelTV.Logo) ? channelTV.Logo : "LogoTVDefault");

                    this.listViewChannelNumbering.Items.Add(lvi);
                }
                else if (channel is ChannelFolder)
                {
                    this.listViewChannelNumbering.Items.Add(lvi);
                    lvi.ImageKey = "FolderClosed";

                    currentChannelIndentation++;
                    InitChannelNumberingRecursedTree(channel as ChannelFolder);
                    currentChannelIndentation--;
                }
            }
        }