Exemple #1
0
        private void deleteGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripDropDownItem menuItem = sender as ToolStripDropDownItem;

            if (menuItem == null)
            {
                return;
            }

            TabPage tab = menuItem.Tag as TabPage;

            if (tab == null)
            {
                return;
            }

            ChannelGroup group = tab.Tag as ChannelGroup;

            if (group == null)
            {
                return;
            }

            DialogResult result = MessageBox.Show(string.Format("Are you sure you want to delete the group '{0}'?",
                                                                group.GroupName), "", MessageBoxButtons.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            bool groupIsEmpty = (group.ReferringGroupMap().Count <= 0);

            group.Delete();
            tabControl1.TabPages.Remove(tab);

            if (!groupIsEmpty && tabControl1.SelectedIndex == 0)
            {
                this.RefreshContextMenu();
                this.RefreshAllChannels();
            }
            else
            {
                this.RefreshContextMenu();
            }
        }
Exemple #2
0
        private void mpButtonDelGroup_Click(object sender, EventArgs e)
        {
            GroupSelectionForm dlgGrpSel = new GroupSelectionForm();

            if (dlgGrpSel.ShowDialog(typeof(ChannelGroup), this) != DialogResult.OK)
            {
                return;
            }

            ChannelGroup group = dlgGrpSel.Group as ChannelGroup;

            if (group == null)
            {
                return;
            }

            DialogResult result = MessageBox.Show(string.Format("Are you sure you want to delete the group '{0}'?",
                                                                group.GroupName), "", MessageBoxButtons.YesNo);

            if (result == DialogResult.No)
            {
                return;
            }

            bool isGroupEmpty = (group.ReferringGroupMap().Count <= 0);

            group.Delete();

            if (!isGroupEmpty)
            {
                this.RefreshAll();
            }
            else
            {
                this.RefreshContextMenu();
                this.RefreshTabs();
            }
        }