/// <summary> /// Close all browsers except the first one from design time /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsMnuCloasAllWBs_Click(object sender, EventArgs e) { if (m_iCountWB == 1) return; try { foreach (ToolStripMenuItem item in ctxMnuOpenWBs.Items) { RemoveBrowser2(item.Name, false); } ctxMnuOpenWBs.Items.Clear(); m_CurWB = cEXWB1; m_CurWB.BringToFront(); m_CurWB.SetFocus(); m_tsBtnFirstTab.Checked = true; m_iCurTab = tsWBTabs.Items.IndexOf((ToolStripItem)m_tsBtnFirstTab); string text = m_CurWB.GetTitle(true); if (text.Length == 0) text = m_Blank; ToolStripMenuItem menu = new ToolStripMenuItem(text, m_imgUnLock); menu.Name = m_tsBtnFirstTab.Name; menu.Checked = true; ctxMnuOpenWBs.Items.Add((ToolStripItem)menu); m_iCurMenu = ctxMnuOpenWBs.Items.Count - 1; tsBtnOpenWBs.Text = m_iCountWB.ToString() + " open tab(s)"; } catch (Exception ee) { AllForms.m_frmLog.AppendToLog("tsMnuCloasAllWBs_Click\r\n" + ee.ToString()); } }
private void SwitchTabs(string name, ToolStripButton btn) { try { csExWB.cEXWB pWB = FindBrowser(name); if (pWB == null) return; //Uncheck last one if (m_iCountWB > 1) ((ToolStripButton)tsWBTabs.Items[m_iCurTab]).Checked = false; m_iCurTab = tsWBTabs.Items.IndexOf(btn); m_CurWB = pWB; tsBtnBack.Enabled = m_CurWB.CanGoBack; tsBtnForward.Enabled = m_CurWB.CanGoForward; m_CurWB.BringToFront(); m_CurWB.SetFocus(); this.Text = m_CurWB.GetTitle(true); if (this.Text.Length == 0) this.Text = m_Blank; if (btn != null) { btn.Checked = true; btn.Text = this.Text; if (btn.Text.Length > m_MaxTextLen) btn.Text = btn.Text.Substring(0, m_MaxTextLen) + "..."; btn.ToolTipText = HttpUtility.UrlDecode(m_CurWB.LocationUrl); this.comboURL.Text = btn.ToolTipText; } //Uncheck all menu items first foreach (ToolStripItem item in ctxMnuOpenWBs.Items) { if (item is ToolStripMenuItem) ((ToolStripMenuItem)item).Checked = false; } //Find target menu item ToolStripMenuItem menu = FindWBMenu(name); m_iCurMenu = ctxMnuOpenWBs.Items.IndexOf((ToolStripItem)menu); if (menu != null) { if (btn != null) menu.Text = btn.Text; menu.Checked = true; } //Reset and hide progressbar //If page is in the process of loading then the progressbar //will be adjusted tsProgress.Value = 0; tsProgress.Maximum = 0; tsProgress.Visible = false; //update SecureLockIcon state UpdateSecureLockIcon(m_CurWB.SecureLockIcon); } catch (Exception ee) { AllForms.m_frmLog.AppendToLog("SwitchingTabs\r\n" + ee.ToString()); } }