CodeTV.WizardForm.PopulateChannelsInDropDownMenu C# (CSharp) Method

PopulateChannelsInDropDownMenu() private method

private PopulateChannelsInDropDownMenu ( ToolStripItemCollection toolStripItemCollection, ChannelFolder channelFolder ) : void
toolStripItemCollection System.Windows.Forms.ToolStripItemCollection
channelFolder ChannelFolder
return void
        private void PopulateChannelsInDropDownMenu(ToolStripItemCollection toolStripItemCollection, ChannelFolder channelFolder)
        {
            toolStripItemCollection.Clear();

            foreach (Channel channel in channelFolder.ChannelList)
            {
                ToolStripMenuItem channelToolStripMenuItem = new ToolStripMenuItem(channel.Name);
                channelToolStripMenuItem.Tag = channel;
                if (channel is ChannelFolder)
                {
                    channelToolStripMenuItem.DropDownItems.Add("dummy");
                    channelToolStripMenuItem.DropDownOpening += new EventHandler(channelToolStripMenuItem_DropDownOpening);
                }
                else
                {
                    if (channel is ChannelTV)
                    {
                        channelToolStripMenuItem.Image = MainForm.imageListLogoTV.Images[(channel as ChannelTV).Logo];
                        if(channelToolStripMenuItem.Image == null)
                            channelToolStripMenuItem.Image = MainForm.imageListLogoTV.Images["LogoTVDefault"];
                    }
                    channelToolStripMenuItem.Click += new EventHandler(channelToolStripMenuItem_Click);
                }
                toolStripItemCollection.Add(channelToolStripMenuItem);
            }
        }