Пример #1
0
        public void UpdateChannels()
        {
            List <Channel> channels = client.GetChannelList();

            ((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems.Clear();
            //contextMenuStripChannels.Invoke((MethodInvoker)delegate { ((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems.Clear(); });
            for (int i = 0; i < channels.Count; i++)
            {
                Channel c = channels[i];
                ((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems.Add(c.GetLabel());
                ((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems[i].Tag    = c.GetName();
                ((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems[i].Click += JoinChannel;
                //contextMenuStripChannels.Invoke((MethodInvoker)delegate{((ToolStripMenuItem)contextMenuStripChannels.Items[0]).DropDownItems.Add(c.GetLabel());});
            }
        }