private void connectAllToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = 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); } } }
/// <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); } }