Esempio n. 1
0
 protected virtual void OnFileNameChanged(ExplorerLabelEditEventArgs e)
 {
     if (FileNameChanged != null)
     {
         FileNameChanged(this, e);
     }
 }
Esempio n. 2
0
        void tvwSolutionExplorer_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            tvwSolutionExplorer.LabelEdit = false;
            if (e.Label == null)
            {
                e.CancelEdit = true;
                return;
            }

            TreeNode node = e.Node;
            NodeType t    = (NodeType)node.Tag;

            if (t == NodeType.Folder)
            {
                e.CancelEdit = true;
                TreeNode parentNode = node.Parent;
                if (ValidateFolderName(parentNode, e.Label))
                {
                    e.Node.Text = e.Label;
                }
                else
                {
                    MessageBox.Show("Folder Name '" + e.Label + "' already exists in current hirerachy.Please select another name.");
                }
                return;
            }

            if (Path.GetFileNameWithoutExtension(e.Label).Length == 0)
            {
                e.CancelEdit = true;
                return;
            }
            string newName      = Path.GetFileNameWithoutExtension(e.Label);
            string oldExtension = Path.GetExtension(e.Node.Text);

            string validName = newName + oldExtension;

            ExplorerLabelEditEventArgs evnt = new ExplorerLabelEditEventArgs(validName, e.Node.Text);

            OnFileNameChanged(evnt);
            e.CancelEdit = true;
            if (evnt.Cancel == false)
            {
                e.Node.Text = validName;
            }
        }
Esempio n. 3
0
 void _winProjExplorer_FileNameChanged(object sender, ExplorerLabelEditEventArgs e)
 {
     if (ValidateFileName(e.NewName))
     {
         string contents = Parser.ProjectParser.GetFileContents(e.OldName);
         Parser.ProjectParser.ProjectFiles.Remove(e.OldName);
         Parser.ProjectParser.ParseProjectContents(e.NewName, contents);
         Document doc = GetExistingFile(e.OldName);
         if (doc != null)
         {
             doc.Text     = Path.GetFileNameWithoutExtension(e.NewName);
             doc.FileName = e.NewName;
         }
     }
     else
     {
         MessageBox.Show("File Name '" + e.NewName + "' already exists in the project.Please try other name.");
         e.Cancel = true;
     }
 }