コード例 #1
0
ファイル: ProjectPanel.cs プロジェクト: walney/ynoteclassic
 /// <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);
     }
 }
コード例 #2
0
ファイル: ProjectPanel.cs プロジェクト: walney/ynoteclassic
        /// <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);
                }
            }
        }
コード例 #3
0
ファイル: ProjectPanel.cs プロジェクト: walney/ynoteclassic
        /// <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;
                }
            }
        }
コード例 #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;
         }
     }
 }
コード例 #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);
         }
     }
 }
コード例 #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);
     }
 }