当前位置: 首页>>代码示例>>C#>>正文


C# HierarchyNode.CreateDirectory方法代码示例

本文整理汇总了C#中Microsoft.VisualStudio.Package.HierarchyNode.CreateDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode.CreateDirectory方法的具体用法?C# HierarchyNode.CreateDirectory怎么用?C# HierarchyNode.CreateDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.VisualStudio.Package.HierarchyNode的用法示例。


在下文中一共展示了HierarchyNode.CreateDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNewFolder

        /// <include file='doc\Hierarchy.uex' path='docs/doc[@for="HierarchyNode.AddNewFolder"]/*' />
        /// <summary>
        /// Get's called to a add a new Folder to the project hierarchy. Opens the dialog to do so and
        /// creates the physical representation
        /// </summary>
        /// <returns></returns>
        public int AddNewFolder(){
            // first generate a new folder name...
            try{
                string relFolder;
                object dummy = null;
                IVsProject3 project = (IVsProject3)this.projectMgr;
                IVsUIHierarchyWindow uiWindow = this.projectMgr.GetIVsUIHierarchyWindow(VsConstants.Guid_SolutionExplorer);

                project.GenerateUniqueItemName(this.hierarchyId, "", "", out relFolder);

                if (this != this.projectMgr){
                    // add this guys relpath to it...
                    relFolder = this.xmlNode.GetAttribute("RelPath") + relFolder;
                }
                // create the project part of it, the xml in the xsproj file
                XmlElement e = this.projectMgr.AddFolderNodeToProject(relFolder);
                HierarchyNode child = new HierarchyNode(this.projectMgr, HierarchyNodeType.Folder, e);
                this.AddChild(child);

                child.CreateDirectory();
                // we need to get into label edit mode now...
                // so first select the new guy...
                uiWindow.ExpandItem(this.projectMgr, child.hierarchyId, EXPANDFLAGS.EXPF_SelectItem);
                // them post the rename command to the shell. Folder verification and creation will
                // happen in the setlabel code...
                this.projectMgr.UIShell.PostExecCommand(ref VsConstants.guidStandardCommandSet97, (uint)VsCommands.Rename, 0, ref dummy);
            } catch{
            }

            return 0;
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:37,代码来源:Hierarchy.cs

示例2: AddNewFolder

        /// <include file='doc\Hierarchy.uex' path='docs/doc[@for="HierarchyNode.AddNewFolder"]/*' />
        /// <summary>
        /// Get's called to a add a new Folder to the project hierarchy. Opens the dialog to do so and
        /// creates the physical representation
        /// </summary>
        /// <returns></returns>
        public int AddNewFolder()
		{
            CCITracing.TraceCall();
            // first generate a new folder name...
            try
			{
                string relFolder;
                object dummy = null;
                IVsProject3 project = (IVsProject3)this.projectMgr;
                IVsUIHierarchyWindow uiWindow = this.projectMgr.GetIVsUIHierarchyWindow(HierarchyNode.Guid_SolutionExplorer);

                NativeMethods.ThrowOnFailure(project.GenerateUniqueItemName(this.hierarchyId, "", "", out relFolder));

                // create the project part of it, the project file
                HierarchyNode child = new HierarchyNode(this.projectMgr, HierarchyNodeType.Folder, relFolder);
                this.AddChild(child);

                child.CreateDirectory();
                // we need to get into label edit mode now...
                // so first select the new guy...
                NativeMethods.ThrowOnFailure(uiWindow.ExpandItem(this.projectMgr, child.hierarchyId, EXPANDFLAGS.EXPF_SelectItem));
                // them post the rename command to the shell. Folder verification and creation will
                // happen in the setlabel code...
                NativeMethods.ThrowOnFailure(this.projectMgr.UIShell.PostExecCommand(ref VsMenus.guidStandardCommandSet97, (uint)VsCommands.Rename, 0, ref dummy));
            }
			catch (Exception e)
			{
                CCITracing.Trace(e);
            }

            return 0;
        }
开发者ID:hesam,项目名称:SketchSharp,代码行数:38,代码来源:Hierarchy.cs


注:本文中的Microsoft.VisualStudio.Package.HierarchyNode.CreateDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。