private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem
                {
                    Text              = "Rename Folder",
                    ItemName          = node.Text,
                    DetailName        = "",
                    ItemNameValidator = delegate(string txt, out string error)
                    {
                        error = String.Empty;
                        if (node.Parent.Nodes.ContainsKey(txt) && txt != node.Text)
                        {
                            error = "Node with same name exists";
                        }
                        else if (txt.Contains(SessionIdDelim))
                        {
                            error = "Invalid character ( " + SessionIdDelim + " ) in name";
                        }
                        return(string.IsNullOrEmpty(error));
                    }
                };
                if (dialog.ShowDialog(this) == DialogResult.OK && node.Text != dialog.ItemName)
                {
                    node.Text = dialog.ItemName;
                    node.Name = dialog.ItemName;
                    UpdateSessionId(node);
                    SuperPuTTY.SaveSessions();
                    ResortNodes();
                }
            }
        }
Exemple #2
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutData layout = (LayoutData)listBoxLayouts.SelectedItem;

            if (layout != null)
            {
                dlgRenameItem renameDialog = new dlgRenameItem
                {
                    DetailName        = String.Empty,
                    ItemName          = layout.Name,
                    ItemNameValidator = ValidateLayoutName
                };
                if (DialogResult.OK == renameDialog.ShowDialog(this))
                {
                    SuperPuTTY.RenameLayout(layout, renameDialog.ItemName);
                }
            }
        }
        private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeView1.SelectedNode;

            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem
                {
                    Text              = "New Folder",
                    ItemName          = "New Folder",
                    DetailName        = "",
                    ItemNameValidator = delegate(string txt, out string error)
                    {
                        error = String.Empty;
                        if (string.IsNullOrEmpty(txt) || txt.Trim() == String.Empty)
                        {
                            error = "Empty folder name";
                        }
                        else if (node.Nodes.ContainsKey(txt))
                        {
                            error = "Node with same name exists";
                        }
                        else if (txt.Contains(SessionIdDelim))
                        {
                            error = "Invalid character ( " + SessionIdDelim + " ) in name";
                        }

                        return(string.IsNullOrEmpty(error));
                    }
                };
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    AddFolderNode(node, dialog.ItemName);
                }
            }
        }
        private void renameTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dlgRenameItem dialog = new dlgRenameItem
            {
                ItemName = this.Text,
                DetailName = this.m_Session.SessionId
            };

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                this.Text = dialog.ItemName;
                this.TextOverride = dialog.ItemName;
            }
        }
Exemple #5
0
        bool ExecuteSuperPuttyAction(SuperPuttyAction action)
        {
            ctlPuttyPanel activePanel = this.DockPanel.ActiveDocument as ctlPuttyPanel;
            bool success = true;

            Log.InfoFormat("Executing action, name={0}", action);
            switch (action)
            {
                case SuperPuttyAction.CloseTab:
                    ToolWindow win = this.DockPanel.ActiveDocument as ToolWindow;
                    if (win != null) { win.Close(); }
                    break;
                case SuperPuttyAction.NextTab:
                    this.tabSwitcher.MoveToNextDocument();
                    break;
                case SuperPuttyAction.PrevTab:
                    this.tabSwitcher.MoveToPrevDocument();
                    break;
                case SuperPuttyAction.FullScreen:
                    this.ToggleFullScreen();
                    break;
                case SuperPuttyAction.OpenSession:
                    KeyEventWindowActivator.ActivateForm(this);
                    this.openSessionToolStripMenuItem.PerformClick();
                    break;
                case SuperPuttyAction.SwitchSession:
                    KeyEventWindowActivator.ActivateForm(this);
                    this.switchSessionToolStripMenuItem.PerformClick();
                    break;
                case SuperPuttyAction.Options:
                    KeyEventWindowActivator.ActivateForm(this);
                    this.optionsToolStripMenuItem.PerformClick();
                    break;
                case SuperPuttyAction.DuplicateSession:
                    if (activePanel != null && activePanel.Session != null)
                        SuperPuTTY.OpenPuttySession(activePanel.Session);
                    break;
                case SuperPuttyAction.GotoCommandBar:
                    if (!this.fullscreenViewState.IsFullScreen)
                    {
                        KeyEventWindowActivator.ActivateForm(this);
                        if (!this.tsCommands.Visible)
                        {
                            this.toggleCheckedState(this.sendCommandsToolStripMenuItem, EventArgs.Empty);
                        }
                        this.tsSendCommandCombo.Focus();
                    }
                    break;
                case SuperPuttyAction.GotoConnectionBar:
                    // perhaps consider allowing this later...need to really have a better approach to the state saving/invoking the toggle.
                    if (!this.fullscreenViewState.IsFullScreen)
                    {
                        KeyEventWindowActivator.ActivateForm(this);
                        if (!this.tsConnect.Visible)
                        {
                            this.toggleCheckedState(this.quickConnectionToolStripMenuItem, EventArgs.Empty);
                        }
                        this.tbTxtBoxHost.Focus();
                    }
                    break;
                case SuperPuttyAction.FocusActiveSession:
                    // focus on current super putty session...or at least try to
                    KeyEventWindowActivator.ActivateForm(this);
                    if (activePanel != null)
                        activePanel.SetFocusToChildApplication("ExecuteAction");
                    break;
                case SuperPuttyAction.OpenScriptEditor:
                    KeyEventWindowActivator.ActivateForm(this);
                    toolStripButtonRunScript_Click(this, EventArgs.Empty);
                    break;
                case SuperPuttyAction.RenameTab:                    
                    if (activePanel != null && activePanel.Session != null)
                    {
                        dlgRenameItem dialog = new dlgRenameItem
                        {
                            ItemName = activePanel.Text,
                            DetailName = activePanel.Session.SessionId
                        };

                        if (dialog.ShowDialog(this) == DialogResult.OK)
                        {
                            activePanel.Text = activePanel.TextOverride = dialog.ItemName;                            
                        }                        
                    }
                    break;
                default:
                    success = false;
                    break;
            }

            return success;
        }
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TreeNode node = this.treeView1.SelectedNode;
     if (node != null)
     {
         dlgRenameItem dialog = new dlgRenameItem
         {
             Text = "Rename Folder",
             ItemName = node.Text,
             DetailName = "",
             ItemNameValidator = delegate(string txt, out string error)
             {
                 error = String.Empty;
                 if (node.Parent.Nodes.ContainsKey(txt) && txt != node.Text)
                 {
                     error = "Node with same name exists";
                 }
                 else if (txt.Contains(SessionIdDelim))
                 {
                     error = "Invalid character ( " + SessionIdDelim + " ) in name";
                 }
                 return string.IsNullOrEmpty(error);
             }
         };
         if (dialog.ShowDialog(this) == DialogResult.OK && node.Text != dialog.ItemName)
         {
             node.Text = dialog.ItemName;
             node.Name = dialog.ItemName;
             UpdateSessionId(node);
             SuperPuTTY.SaveSessions();
             ResortNodes();
         }
     }
 }
        private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;
            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem
                {
                    Text = "New Folder",
                    ItemName = "New Folder",
                    DetailName = "",
                    ItemNameValidator = delegate(string txt, out string error)
                    {
                        error = String.Empty;
                        if (node.Nodes.ContainsKey(txt))
                        {
                            error = "Node with same name exists";
                        }
                        else if (txt.Contains(SessionIdDelim))
                        {
                            error = "Invalid character ( " + SessionIdDelim + " ) in name";
                        }
                        else if (string.IsNullOrEmpty(txt) || txt.Trim() == String.Empty)
                        {
                            error = "Empty folder name";
                        }

                        return string.IsNullOrEmpty(error);
                    }
                };
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    AddFolderNode(node, dialog.ItemName);
                }
            }
        }
Exemple #8
0
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     LayoutData layout = (LayoutData)this.listBoxLayouts.SelectedItem;
     if (layout != null)
     {
         dlgRenameItem renameDialog = new dlgRenameItem
         {
             DetailName = String.Empty,
             ItemName = layout.Name,
             ItemNameValidator = this.ValidateLayoutName
         };
         if (DialogResult.OK == renameDialog.ShowDialog(this))
         {
             SuperPuTTY.RenameLayout(layout, renameDialog.ItemName);
         }
     }
     
 }