Esempio n. 1
0
        public Boolean AddTag(String tag)
        {
            if (!tag.StartsWith("#"))
            {
                tag = "#" + tag;
            }

            if (!_filter.AddTag(tag))
            {
                MessageBox.Show("Cannot add new tag " + tag + "...");
                return(false);
            }

            TabPage tagTabPage = new TabPage(tag);

            tabControl.TabPages.Add(tagTabPage);
            tagTabPage.Tag = tag;

            ListBox tagListBox = new MessageListBox
            {
                Parent = tagTabPage,
                Dock   = DockStyle.Fill,
            };

            tagListBox.DoubleClick += ShowMessageDetails;


            Button removeButton = new Button
            {
                Parent      = tagTabPage,
                Dock        = DockStyle.Bottom,
                MaximumSize = new Size(100, 40),
                Tag         = tagTabPage,

                Text = "Remove Tag"
            };

            removeButton.Click += RemoveTag;

            tagTabPage.Controls.Add(new ListBox());

            _tabTags[tag] = tagListBox;
            return(true);
        }