CodeTV.MainForm.PopulateChannelsInDropDownMenu C# (CSharp) Method

PopulateChannelsInDropDownMenu() private method

private PopulateChannelsInDropDownMenu ( ToolStripMenuItem toolStripMenuItem, ChannelFolder channelFolder ) : void
toolStripMenuItem System.Windows.Forms.ToolStripMenuItem
channelFolder ChannelFolder
return void
        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);
            }
        }
MainForm