private void connectAllToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = this.treeView1.SelectedNode; if (node != null && !IsSessionNode(node)) { List <SessionData> sessions = new List <SessionData>(); GetAllSessions(node, sessions); Log.InfoFormat("Found {0} sessions", sessions.Count); if (sessions.Count > MaxSessionsToOpen) { if (DialogResult.Cancel == MessageBox.Show( "Open All " + sessions.Count + " sessions?", "WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { // bug out...too many sessions to open return; } } foreach (SessionData session in sessions) { SuperPuTTY.OpenPuttySession(session); } } }
public static void OpenSession(SessionDataStartInfo ssi) { if (MainForm.InvokeRequired) { MainForm.BeginInvoke(new Action <SessionDataStartInfo>(OpenSession), ssi); return; } if (ssi != null) { if (ssi.UseScp) { SuperPuTTY.OpenScpSession(ssi.Session); } else { SuperPuTTY.OpenPuttySession(ssi.Session); } if (MainForm.WindowState == FormWindowState.Minimized) { NativeMethods.ShowWindow(MainForm.Handle, NativeMethods.WindowShowStyle.Restore); } } }
/// <summary>Restore sessions from a string containing previous sessions</summary> /// <param name="persistString">A string containing the sessions to restore</param> /// <returns>The <seealso cref="ctlPuttyPanel"/> object which is the parent of the hosted putty application, null if unable to start session</returns> public static ctlPuttyPanel FromPersistString(String persistString) { ctlPuttyPanel panel = null; if (persistString.StartsWith(typeof(ctlPuttyPanel).FullName)) { int idx = persistString.IndexOf("?"); if (idx != -1) { NameValueCollection data = HttpUtility.ParseQueryString(persistString.Substring(idx + 1)); string sessionId = data["SessionId"] ?? data["SessionName"]; string tabName = data["TabName"]; Log.InfoFormat("Restoring putty session, sessionId={0}, tabName={1}", sessionId, tabName); SessionData session = SuperPuTTY.GetSessionById(sessionId); if (session != null) { panel = SuperPuTTY.OpenPuttySession(session); if (panel == null) { Log.WarnFormat("Could not restore putty session, sessionId={0}", sessionId); } else { panel.Icon = SuperPuTTY.GetIconForSession(session); panel.Text = tabName; panel.TextOverride = tabName; } } else { Log.WarnFormat("Session not found, sessionId={0}", sessionId); } } else { idx = persistString.IndexOf(":"); if (idx != -1) { string sessionId = persistString.Substring(idx + 1); Log.InfoFormat("Restoring putty session, sessionId={0}", sessionId); SessionData session = SuperPuTTY.GetSessionById(sessionId); if (session != null) { panel = SuperPuTTY.OpenPuttySession(session); } else { Log.WarnFormat("Session not found, sessionId={0}", sessionId); } } } } return(panel); }
private void newSessionTSMI_Click(object sender, EventArgs e) { ToolStripMenuItem menuItem = (ToolStripMenuItem)sender; SessionData session = menuItem.Tag as SessionData; if (session != null) { SuperPuTTY.OpenPuttySession(session); } }
/// <summary> /// Shortcut for double clicking an entries node. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void connectToolStripMenuItem_Click(object sender, EventArgs e) { foreach (TreeNode node in treeView1.SelectedNodes) { if (IsSessionNode(node)) { SessionData sessionData = (SessionData)node.Tag; SuperPuTTY.OpenPuttySession(sessionData); } } }
/// <summary> /// Opens the selected session when the node is double clicked in the treeview /// </summary> /// <param name="sender">The treeview control that was double clicked</param> /// <param name="e">An Empty EventArgs object</param> private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { // e is null if this method is called from connectToolStripMenuItem_Click TreeNode node = (e != null) ? e.Node : treeView1.SelectedNode; if (IsSessionNode(node) && node == treeView1.SelectedNode) { SessionData sessionData = (SessionData)node.Tag; SuperPuTTY.OpenPuttySession(sessionData); } }
public static void OpenSession(SessionDataStartInfo ssi) { if (MainForm.InvokeRequired) { MainForm.BeginInvoke(new Action <SessionDataStartInfo>(OpenSession), ssi); return; } if (ssi != null) { if (ssi.UseScp) { SuperPuTTY.OpenScpSession(ssi.Session); } else { SuperPuTTY.OpenPuttySession(ssi.Session); } } }
private void duplicateSessionToolStripMenuItem_Click(object sender, EventArgs e) { SuperPuTTY.OpenPuttySession(this.m_Session); }