本文整理汇总了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;
}
示例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;
}