示例#1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (this.Mode == ScreenMode.Main)
            {
                this.CloseClicked(this.EndPoint, EventArgs.Empty);
            }
            else
            {
                int index = this.tabControl1.SelectedIndex;

                if (index > 0)
                {
                    this.tabControl1.SelectedIndex = 0;

                    if (this.tabControl1.TabPages[index] is PMTab)
                    {
                        PMTab pm = (PMTab)this.tabControl1.TabPages[index];
                        this.tabControl1.TabPages.RemoveAt(index);
                        pm.HashlinkClicked     -= this.LinkHashlinkClicked;
                        pm.EditScribbleClicked -= this.DoEditScribbleClicked;
                        pm.Free();
                        pm.Dispose();
                        pm = null;
                    }
                    else if (this.tabControl1.TabPages[index] is BrowseTab)
                    {
                        BrowseTab bt = (BrowseTab)this.tabControl1.TabPages[index];
                        this.tabControl1.TabPages.RemoveAt(index);
                        bt.Free();
                        bt.Dispose();
                        bt = null;
                    }
                }
            }
        }
示例#2
0
        public void CloseAllTabs(bool including_main)
        {
            if (including_main)
            {
                this.tabControl1.TabPages.RemoveAt(0);

                while (this.splitContainer1.Panel1.Controls.Count > 0)
                {
                    this.splitContainer1.Panel1.Controls.RemoveAt(0);
                }

                while (this.splitContainer1.Panel2.Controls.Count > 0)
                {
                    this.splitContainer1.Panel2.Controls.RemoveAt(0);
                }

                this.splitContainer1.Dispose();
                this.splitContainer1 = null;

                while (this.tabPage1.Controls.Count > 0)
                {
                    this.tabPage1.Controls.RemoveAt(0);
                }

                this.tabPage1.Dispose();
                this.tabPage1 = null;
                this.userListContainer1.Free();
                this.userListContainer1.Dispose();
                this.userListContainer1 = null;
            }

            // pm and file tabs
            for (int i = (this.tabControl1.TabPages.Count - 1); i > -1; i--)
            {
                if (this.tabControl1.TabPages[i] is PMTab)
                {
                    PMTab pm = (PMTab)this.tabControl1.TabPages[i];
                    this.tabControl1.TabPages.RemoveAt(i);
                    pm.HashlinkClicked     -= this.LinkHashlinkClicked;
                    pm.EditScribbleClicked -= this.DoEditScribbleClicked;
                    pm.Free();
                    pm.Dispose();
                    pm = null;
                }
                else if (this.tabControl1.TabPages[i] is BrowseTab)
                {
                    BrowseTab bt = (BrowseTab)this.tabControl1.TabPages[i];
                    this.tabControl1.TabPages.RemoveAt(i);
                    bt.Free();
                    bt.Dispose();
                    bt = null;
                }
            }
        }