Beispiel #1
0
        private void connectSSHToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Directly connect without stored session
            SessionOptionsDialog dlg = new SessionOptionsDialog();

            dlg.OKButtonText     = "Connect";
            dlg.Text             = "Direct connect";
            dlg.AllowGroupSelect = false;
            dlg.SessionGroups    = new List <SessionGroup>()
            {
                new SessionGroup("(No Group)")
            };
            dlg.SelectedGroup = dlg.SessionGroups.First();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                openTTY(dlg.Session);
            }
        }
Beispiel #2
0
        private void editSessionCtxMenuItem_Click(object sender, EventArgs e)
        {
            if (ctxMenuSession.Tag is TreeNode)
            {
                TreeNode node = (TreeNode)ctxMenuSession.Tag;
                if (!(node.Tag is SessionInfo))
                {
                    return;
                }

                SessionInfo session = (SessionInfo)node.Tag;
                if (session.External)
                {
                    return;
                }

                SessionGroup group = (SessionGroup)node.Parent.Tag;

                SessionOptionsDialog dlg = new SessionOptionsDialog();
                dlg.OKButtonText  = "Save";
                dlg.SessionGroups = GetGroupsAndSessions();
                dlg.SelectedGroup = group;
                dlg.Session       = new SessionInfo(session);

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    session.CopyFrom(dlg.Session);
                    node.Text = session.GetName();

                    if (dlg.SelectedGroup != group)
                    {
                        node.Remove();

                        TreeNode newGroupNode = GetSessionGroupTreeNode(dlg.SelectedGroup);
                        newGroupNode.Nodes.Add(node);
                    }

                    SaveGroupsAndSessions();
                }
            }
        }
Beispiel #3
0
        // If sessionGroup is not given, the first group node found will be pre-selected
        private void ShowNewSessionDialog(SessionGroup sessionGroup = null)
        {
            SessionOptionsDialog dlg = new SessionOptionsDialog();

            dlg.OKButtonText  = "Add";
            dlg.SessionGroups = GetGroupsAndSessions();
            dlg.SelectedGroup = (sessionGroup != null ? sessionGroup : dlg.SessionGroups.First());

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                SessionInfo session = dlg.Session;
                TreeNode    node    = new TreeNode(session.GetName());
                node.Tag = session;

                TreeNode groupNode = GetSessionGroupTreeNode(dlg.SelectedGroup);
                groupNode.Nodes.Add(node);
                groupNode.Expand();

                SaveGroupsAndSessions();
            }
        }