internal void AttachTabFromWindow(TerminalTabControlItem tabControlToAttach) { this.mainTabControl.AddTab(tabControlToAttach); PopupTerminal popupTerminal = tabControlToAttach.FindForm() as PopupTerminal; if (popupTerminal != null) { UnRegisterPopUp(popupTerminal); } }
internal void AttachTabFromWindow(TerminalTabControlItem tabControlToAttach) { this.mainTabControl.AddTab(tabControlToAttach); PopupTerminal popupTerminal = tabControlToAttach.FindForm() as PopupTerminal; if (popupTerminal != null) { UnRegisterPopUp(popupTerminal); } }
private void PopupTerminal_FormClosing(object sender, FormClosingEventArgs e) { this.mainTabsControler.UnRegisterPopUp(this); TerminalTabControlItem activeTab = this.tabControl1.SelectedItem as TerminalTabControlItem; if (activeTab != null) { // doesnt metter yet. Nobody closes connections this.tabControl1.CloseTab(activeTab); } }
private void AttachToTerminalsToolStripMenuItem_Click(object sender, EventArgs e) { TerminalTabControlItem activeTab = this.tabControl1.SelectedItem as TerminalTabControlItem; if (activeTab != null) { this.mainTabsControler.AttachTabFromWindow(activeTab); } this.Close(); }
/// <summary> /// Because tabControl is cast internaly to TabControlItem, all connections should send their tab, /// which we already have in the connection. /// </summary> private void InvokeCloseTab(TerminalTabControlItem tabPage) { if (this.mainForm.InvokeRequired) { var d = new InvokeCloseTabPage(this.CloseTabPage); this.mainForm.Invoke(d, new object[] { tabPage }); } else { this.CloseTabPage(tabPage); } }
private CaptureManagerLayout FindCaptureManagerControl() { TerminalTabControlItem tab = this.filter.FindCaptureManagerTab(); if (tab != null) { // after the connection is removed, this index moves to zero return(tab.Controls[CaptureManagerLayout.ControlName] as CaptureManagerLayout); } return(null); }
internal void DetachTabToNewWindow(TerminalTabControlItem tabControlToOpen) { if (tabControlToOpen != null) { this.mainTabControl.Items.SuspendEvents(); PopupTerminal pop = new PopupTerminal(this); mainTabControl.RemoveTab(tabControlToOpen); pop.AddTerminal(tabControlToOpen); this.mainTabControl.Items.ResumeEvents(); this.detachedWindows.Add(pop); pop.Show(); } }
internal void AddTerminal(TerminalTabControlItem tabControlItem) { this.tabControl1.AddTab(tabControlItem); this.Text = tabControlItem.Title; }
internal void AssingDoubleClickEventHandler(TerminalTabControlItem terminalTabPage) { terminalTabPage.DoubleClick += new EventHandler(this.TerminalTabPage_DoubleClick); }
internal void RemoveAndUnSelect(TerminalTabControlItem toRemove) { this.mainTabControl.Items.Remove(toRemove); this.UnSelect(); }
/// <summary> /// Markes the selected terminal as selected. If it is in mainTabControl, /// then directly selects it, otherwise marks the selected window /// </summary> /// <param name="toSelect">new terminal tabControl to assign as selected</param> internal void Select(TerminalTabControlItem toSelect) { this.mainTabControl.SelectedItem = toSelect; }
public void AddTerminal(TerminalTabControlItem TabControlItem) { this.tabControl1.AddTab(TabControlItem); Terminals.Connections.Connection b = (TabControlItem.Connection as Terminals.Connections.Connection); this.Text = TabControlItem.Connection.Favorite.Name; }
public void OpenNetworkingTools(string action, string host) { Log.InsideMethod(); TerminalTabControlItem terminalTabPage = new TerminalTabControlItem("Networking Tools", "Networking Tools"); try { terminalTabPage.AllowDrop = false; terminalTabPage.ToolTipText = "Networking Tools"; terminalTabPage.Favorite = null; terminalTabPage.DoubleClick += this.TerminalTabPage_DoubleClick; this.terminalsControler.AddAndSelect(terminalTabPage); this.tcTerminals_SelectedIndexChanged(this, EventArgs.Empty); using (NetworkingToolsConnection conn = new NetworkingToolsConnection()) { conn.TerminalTabPage = terminalTabPage; conn.ParentForm = this; terminalTabPage.Connection = conn; conn.Connect(); conn.BringToFront(); conn.Update(); this.UpdateControls(); conn.Execute(action, host); } } catch (Exception exc) { Log.Error("Open networking tools failure", exc); this.terminalsControler.RemoveAndUnSelect(terminalTabPage); terminalTabPage.Dispose(); } }
public void RemoveAndUnSelect(TerminalTabControlItem toRemove) { Log.InsideMethod(); this.terminalsControler.RemoveAndUnSelect(toRemove); }
public void DetachTabToNewWindow(TerminalTabControlItem tabControlToOpen) { Log.InsideMethod(); this.terminalsControler.DetachTabToNewWindow(tabControlToOpen); }
internal void AddTerminal(TerminalTabControlItem tabControlItem) { this.tabControl1.AddTab(tabControlItem); this.Text = tabControlItem.Title; }
internal void DetachTabToNewWindow(TerminalTabControlItem tabControlToOpen) { if (tabControlToOpen != null) { this.mainTabControl.Items.SuspendEvents(); PopupTerminal pop = new PopupTerminal(this); mainTabControl.RemoveTab(tabControlToOpen); pop.AddTerminal(tabControlToOpen); this.mainTabControl.Items.ResumeEvents(); this.detachedWindows.Add(pop); pop.Show(); } }
internal void AddAndSelect(TerminalTabControlItem toAdd) { this.mainTabControl.Items.Add(toAdd); this.Select(toAdd); }
private void toolStripMenuItem5_Click(object sender, EventArgs e) { bool createNew = true; foreach(TerminalTabControlItem tab in tcTerminals.Items) { if(tab.Title == "Capture Manager") { Terminals.Connections.CaptureManagerConnection conn = (tab.Connection as Terminals.Connections.CaptureManagerConnection); conn.RefreshView(); if(Settings.AutoSwitchOnCapture) tcTerminals.SelectedItem = tab; createNew = false; break; } } if(createNew) { if(sender == null && !Settings.AutoSwitchOnCapture) createNew = false; } if(createNew) { TerminalTabControlItem terminalTabPage = new TerminalTabControlItem("Capture Manager"); try { terminalTabPage.AllowDrop = false; terminalTabPage.ToolTipText = "Capture Manager"; terminalTabPage.Favorite = null; terminalTabPage.DoubleClick += new EventHandler(terminalTabPage_DoubleClick); tcTerminals.Items.Add(terminalTabPage); tcTerminals.SelectedItem = terminalTabPage; tcTerminals_SelectedIndexChanged(this, EventArgs.Empty); Connections.IConnection conn = new Terminals.Connections.CaptureManagerConnection(); conn.TerminalTabPage = terminalTabPage; conn.ParentForm = this; conn.Connect(); (conn as Control).BringToFront(); (conn as Control).Update(); UpdateControls(); } catch(Exception exc) { Terminals.Logging.Log.Info("", exc); tcTerminals.Items.Remove(terminalTabPage); tcTerminals.SelectedItem = null; terminalTabPage.Dispose(); System.Windows.Forms.MessageBox.Show(exc.Message); } } }
internal void AddAndSelect(TerminalTabControlItem toAdd) { this.mainTabControl.Items.Add(toAdd); this.Select(toAdd); }
/// <summary> /// Markes the selected terminal as selected. If it is in mainTabControl, /// then directly selects it, otherwise marks the selected window /// </summary> /// <param name="toSelect">new terminal tabControl to assign as selected</param> internal void Select(TerminalTabControlItem toSelect) { this.mainTabControl.SelectedItem = toSelect; }
public void AddTerminal(TerminalTabControlItem TabControlItem) { this.tcTerminals.AddTab(TabControlItem); }
internal void RemoveAndUnSelect(TerminalTabControlItem toRemove) { this.mainTabControl.Items.Remove(toRemove); this.UnSelect(); }
public void OpenNetworkingTools(string Action, string Host) { TerminalTabControlItem terminalTabPage = new TerminalTabControlItem("Networking Tools"); try { terminalTabPage.AllowDrop = false; terminalTabPage.ToolTipText = "Networking Tools"; terminalTabPage.Favorite = null; terminalTabPage.DoubleClick += new EventHandler(terminalTabPage_DoubleClick); tcTerminals.Items.Add(terminalTabPage); tcTerminals.SelectedItem = terminalTabPage; tcTerminals_SelectedIndexChanged(this, EventArgs.Empty); Terminals.Connections.NetworkingToolsConnection conn = new Terminals.Connections.NetworkingToolsConnection(); conn.TerminalTabPage = terminalTabPage; conn.ParentForm = this; conn.Connect(); (conn as Control).BringToFront(); (conn as Control).Update(); UpdateControls(); conn.Execute(Action, Host); } catch(Exception exc) { Terminals.Logging.Log.Info("", exc); tcTerminals.Items.Remove(terminalTabPage); tcTerminals.SelectedItem = null; terminalTabPage.Dispose(); System.Windows.Forms.MessageBox.Show(exc.Message); } }
private void CreateTerminalTab(FavoriteConfigurationElement favorite) { if(Settings.ExecuteBeforeConnect) { ProcessStartInfo processStartInfo = new ProcessStartInfo(Settings.ExecuteBeforeConnectCommand, Settings.ExecuteBeforeConnectArgs); processStartInfo.WorkingDirectory = Settings.ExecuteBeforeConnectInitialDirectory; Process process = Process.Start(processStartInfo); if(Settings.ExecuteBeforeConnectWaitForExit) { process.WaitForExit(); } } if(favorite.ExecuteBeforeConnect) { ProcessStartInfo processStartInfo = new ProcessStartInfo(favorite.ExecuteBeforeConnectCommand, favorite.ExecuteBeforeConnectArgs); processStartInfo.WorkingDirectory = favorite.ExecuteBeforeConnectInitialDirectory; Process process = Process.Start(processStartInfo); if(favorite.ExecuteBeforeConnectWaitForExit) { process.WaitForExit(); } } string terminalTabTitle = favorite.Name; if(Settings.ShowUserNameInTitle) { terminalTabTitle += " (" + Functions.UserDisplayName(favorite.DomainName, favorite.UserName) + ")"; } TerminalTabControlItem terminalTabPage = new TerminalTabControlItem(terminalTabTitle); try { terminalTabPage.AllowDrop = true; terminalTabPage.DragOver += terminalTabPage_DragOver; terminalTabPage.DragEnter += new DragEventHandler(terminalTabPage_DragEnter); this.Resize += new EventHandler(MainForm_Resize); terminalTabPage.ToolTipText = GetToolTipText(favorite); terminalTabPage.Favorite = favorite; terminalTabPage.DoubleClick += new EventHandler(terminalTabPage_DoubleClick); tcTerminals.Items.Add(terminalTabPage); tcTerminals.SelectedItem = terminalTabPage; tcTerminals_SelectedIndexChanged(this, EventArgs.Empty); Connections.IConnection conn = Connections.ConnectionManager.CreateConnection(favorite, terminalTabPage, this); if(conn.Connect()) { (conn as Control).BringToFront(); (conn as Control).Update(); UpdateControls(); if(favorite.DesktopSize == DesktopSize.FullScreen) FullScreen = true; Terminals.Connections.Connection b = (conn as Terminals.Connections.Connection); b.OnTerminalServerStateDiscovery += new Terminals.Connections.Connection.TerminalServerStateDiscovery(b_OnTerminalServerStateDiscovery); b.CheckForTerminalServer(favorite); } else { string msg = "Sorry, Terminals was unable to connect to the remote machine. Try again, or check the log for more information."; System.Windows.Forms.MessageBox.Show(msg); tcTerminals.Items.Remove(terminalTabPage); tcTerminals.SelectedItem = null; } if(conn.Connected) { if(favorite.NewWindow) { OpenConnectionInNewWindow(conn); } } } catch(Exception exc) { Terminals.Logging.Log.Info("", exc); tcTerminals.SelectedItem = null; //tcTerminals = null; System.Windows.Forms.MessageBox.Show(exc.Message); } }
internal void AssignEventsToConnectionTab(TerminalTabControlItem terminalTabPage) { terminalTabPage.DragOver += this.TerminalTabPage_DragOver; terminalTabPage.DragEnter += new DragEventHandler(this.terminalTabPage_DragEnter); terminalTabPage.Resize += new EventHandler(terminalTabPage_Resize); }
/// <summary> /// Because tabControl is cast internaly to TabControlItem, all connections should send their tab, /// which we already have in the connection. /// </summary> private void InvokeCloseTab(TerminalTabControlItem tabControl) { if (this.mainForm.InvokeRequired) { var d = new InvokeCloseTabPage(this.CloseTabPage); this.mainForm.Invoke(d, new object[] { tabControl }); } else { this.CloseTabPage(tabControl); } }
public void AddTerminal(TerminalTabControlItem TabControlItem) { this.tabControl1.AddTab(TabControlItem); Terminals.Connections.Connection b = (TabControlItem.Connection as Terminals.Connections.Connection); this.Text = TabControlItem.Connection.Favorite.Name; }