Exemple #1
0
        private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;

            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem();
                dialog.Text              = "New Folder";
                dialog.ItemName          = "New Folder";
                dialog.DetailName        = "";
                dialog.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 #2
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;

            if (node != null)
            {
                dlgRenameItem dialog = new dlgRenameItem();
                dialog.Text              = "Rename Folder";
                dialog.ItemName          = node.Text;
                dialog.DetailName        = "";
                dialog.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 #3
0
        private void renameTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dlgRenameItem dialog = new dlgRenameItem();

            dialog.ItemName   = this.Text;
            dialog.DetailName = this.m_Session.SessionId;

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                this.Text         = dialog.ItemName;
                this.TextOverride = dialog.ItemName;
            }
        }
Exemple #4
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutData layout = (LayoutData)this.listBoxLayouts.SelectedItem;

            if (layout != null)
            {
                dlgRenameItem renameDialog = new dlgRenameItem();
                renameDialog.DetailName        = String.Empty;
                renameDialog.ItemName          = layout.Name;
                renameDialog.ItemNameValidator = this.ValidateLayoutName;
                if (DialogResult.OK == renameDialog.ShowDialog(this))
                {
                    SuperPuTTY.RenameLayout(layout, renameDialog.ItemName);
                }
            }
        }