private void RemoveRightTabs(GenreTabPage gtp)
 {
     this.BeginUpdateGenreTabs();
     TabPage tp;
     while ((tp = this.tabcGsc.TabPages[this.tabcGsc.TabCount - 1]) != gtp) {
         this.RemoveGenreTabInternal(tp as GenreTabPage);
     }
     this.EndUpdateGenreTabs();
 }
        private void OpenContextMenu(int tabIndex, Point location)
        {
            this.lastContextMenuSource = this.tabcGsc.TabPages[tabIndex] as GenreTabPage;
            bool isGGenre = this.lastContextMenuSource is GGenreTabPage;
            bool isVGenre = this.lastContextMenuSource is VGenreTabPage;
            bool isFirstTab = (tabIndex == 0);
            bool isLastTab = (this.tabcGsc.TabCount == tabIndex + 1);
            bool isAloneTab = (this.tabcGsc.TabCount == 1);

            this.tsmiCmsStartCrawl.Enabled = isGGenre;
            this.tsmiCmsBrowseGenreTop.Enabled = isGGenre;
            this.tsmiCmsCopyName.Enabled = isGGenre || isVGenre;
            this.tsmiCmsCopyUri.Enabled = isGGenre;
            this.tsmiCmsCopyNameAndUri.Enabled = isGGenre;
            this.tsmiCmsCloseThis.Enabled = true;
            this.tsmiCmsCloseLeft.Enabled = !isFirstTab;
            this.tsmiCmsCloseRight.Enabled = !isLastTab;
            this.tsmiCmsCloseButThis.Enabled = !isAloneTab;

            this.cmsGenreTab.Show(this.tabcGsc, location);
        }
 private void RemoveGenreTabInternal(GenreTabPage gtp)
 {
     if (gtp == this.tabcGsc.SelectedTab) {
         this.BeginUpdateGenreTabs();
         int idx = this.tabcGsc.TabPages.IndexOf(gtp);
         if (idx + 1 == this.tabcGsc.TabCount) {
             this.tabcGsc.SelectedIndex = idx - 1;
         } else {
             this.tabcGsc.SelectedIndex = idx + 1;
         }
         this.tabcGsc.TabPages.Remove(gtp);
         this.EndUpdateGenreTabs();
     } else {
         this.tabcGsc.TabPages.Remove(gtp);
     }
     if (this.tabcGsc.TabCount == 0) {
         this.SelectedCrawlResult = null;
     }
     this.RecalcurateRequiredHeight();
     this.ChangeEnabilityOfMainMenuItems();
 }
 private void AddGenreTabInternal(GenreTabPage gtp)
 {
     this.tabcGsc.TabPages.Add(gtp);
     this.RecalcurateRequiredHeight();
     this.ChangeEnabilityOfMainMenuItems();
 }