Ejemplo n.º 1
0
 /// <summary>
 ///     Add New File
 /// </summary>
 private void AddNewFile()
 {
     try
     {
         var path = projtree.SelectedNode as ExTreeNode;
         if (path != null && path.Type == ProjectNodeType.Folder)
         {
             using (var util = new FolderUtils())
             {
                 if (util.ShowDialog(this) != DialogResult.OK)
                 {
                     return;
                 }
                 var file = Path.Combine(path.Name, util.FileName);
                 var node = new ExTreeNode(util.FileName, file, ProjectNodeType.File);
                 File.WriteAllText(file, "");
                 projtree.SelectedNode.Nodes.Add(node);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("There was an Error : " + ex.Message, "Project Manager", MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     Adds a New Folder to existing folder
        /// </summary>
        private void AddNewFolder()
        {
            var path = projtree.SelectedNode as ExTreeNode;

            if (path != null && path.Type == ProjectNodeType.Folder)
            {
                using (var util = new FolderUtils())
                {
                    if (util.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }
                    var dir  = Path.Combine(path.Name, util.FileName);
                    var node = new ExTreeNode(util.FileName, dir, ProjectNodeType.Folder);
                    Directory.CreateDirectory(dir);
                    projtree.SelectedNode.Nodes.Add(node);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     DoRename
        /// </summary>
        private void DoRename()
        {
            var node     = projtree.SelectedNode as ExTreeNode;
            var filename = projtree.SelectedNode.Name;
            var dir      = Path.GetDirectoryName(projtree.SelectedNode.Name);

            using (var dlg = new FolderUtils())
            {
                var result = dlg.ShowDialog() == DialogResult.OK;
                if (result)
                {
                    if (node.Type == ProjectNodeType.Folder)
                    {
                        RenameDirectory(filename, dir + @"\" + dlg.FileName, node);
                    }
                    else if (node.Type == ProjectNodeType.File)
                    {
                        RenameFile(filename, dir + @"\" + dlg.FileName, node);
                    }
                    node.Text = dlg.FileName;
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     DoRename
 /// </summary>
 private void DoRename()
 {
     var node = projtree.SelectedNode as ExTreeNode;
     var filename = projtree.SelectedNode.Name;
     var dir = Path.GetDirectoryName(projtree.SelectedNode.Name);
     using (var dlg = new FolderUtils())
     {
         var result = dlg.ShowDialog() == DialogResult.OK;
         if (result)
         {
             if (node.Type == ProjectNodeType.Folder)
                 RenameDirectory(filename, dir + @"\" + dlg.FileName, node);
             else if (node.Type == ProjectNodeType.File)
                 RenameFile(filename, dir + @"\" + dlg.FileName, node);
             node.Text = dlg.FileName;
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Adds a New Folder to existing folder
 /// </summary>
 private void AddNewFolder()
 {
     var path = projtree.SelectedNode as ExTreeNode;
     if (path != null && path.Type == ProjectNodeType.Folder)
     {
         using (var util = new FolderUtils())
         {
             if (util.ShowDialog(this) != DialogResult.OK) return;
             var dir = Path.Combine(path.Name, util.FileName);
             var node = new ExTreeNode(util.FileName, dir, ProjectNodeType.Folder);
             Directory.CreateDirectory(dir);
             projtree.SelectedNode.Nodes.Add(node);
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     Add New File
 /// </summary>
 private void AddNewFile()
 {
     try
     {
         var path = projtree.SelectedNode as ExTreeNode;
         if (path != null && path.Type == ProjectNodeType.Folder)
         {
             using (var util = new FolderUtils())
             {
                 if (util.ShowDialog(this) != DialogResult.OK) return;
                 var file = Path.Combine(path.Name, util.FileName);
                 var node = new ExTreeNode(util.FileName, file, ProjectNodeType.File);
                 File.WriteAllText(file, "");
                 projtree.SelectedNode.Nodes.Add(node);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("There was an Error : " + ex.Message, "Project Manager", MessageBoxButtons.OK,
             MessageBoxIcon.Exclamation);
     }
 }