本文整理汇总了C#中UIHierarchyItem类的典型用法代码示例。如果您正苦于以下问题:C# UIHierarchyItem类的具体用法?C# UIHierarchyItem怎么用?C# UIHierarchyItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIHierarchyItem类属于命名空间,在下文中一共展示了UIHierarchyItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CollapseRecursively
internal static void CollapseRecursively(UIHierarchyItem parentItem)
{
if (parentItem == null)
{
throw new ArgumentNullException("parentItem");
}
if (!parentItem.UIHierarchyItems.Expanded) return;
// Recurse to all children first.
foreach (UIHierarchyItem childItem in parentItem.UIHierarchyItems)
{
CollapseRecursively(childItem);
}
if (ShouldCollapseItem(parentItem))
{
// Attempt the direct collapse first.
parentItem.UIHierarchyItems.Expanded = false;
// If failed, solution folder oddity may be at play. Try an alternate path.
if (parentItem.UIHierarchyItems.Expanded)
{
parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
((DTE2)parentItem.DTE).ToolWindows.SolutionExplorer.DoDefaultAction();
}
}
}
示例2: DisplayCommand
/// <summary>
/// Determines if the command should be displayed or not.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool DisplayCommand(UIHierarchyItem item)
{
try
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length != 1)
return false;
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
ProjectItem pi = (ProjectItem)hierItem.Object;
if (pi.Object is DataSourceView)
{
Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)pi.ContainingProject;
return (projExt.Kind == BIDSProjectKinds.SSAS); //only show in an SSAS project, not in a report model or SSIS project (which also can have a DSV)
}
else if (pi.Object is Dimension)
{
Dimension dim = pi.Object as Dimension;
if (dim != null && dim.IsParentChild)
return true;
}
return false;
}
catch
{
return false;
}
}
示例3: ToggleSolutionFoldersOpenTemporarily
/// <summary>
/// Toggles all solution folders open temporarily to workaround searches not working inside
/// solution folders that have never been expanded.
/// </summary>
/// <param name="parentItem">The parent item to inspect.</param>
private void ToggleSolutionFoldersOpenTemporarily(UIHierarchyItem parentItem)
{
if (parentItem == null)
{
throw new ArgumentNullException("parentItem");
}
const string solutionFolderGuid = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}";
var project = parentItem.Object as Project;
bool isCollapsedSolutionFolder = project != null && project.Kind == solutionFolderGuid && !parentItem.UIHierarchyItems.Expanded;
// Expand the solution folder temporarily.
if (isCollapsedSolutionFolder)
{
parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
Package.IDE.ToolWindows.SolutionExplorer.DoDefaultAction();
}
// Run recursively to children as well for nested solution folders.
foreach (UIHierarchyItem childItem in parentItem.UIHierarchyItems)
{
ToggleSolutionFoldersOpenTemporarily(childItem);
}
// Collapse the solution folder.
if (isCollapsedSolutionFolder)
{
parentItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
Package.IDE.ToolWindows.SolutionExplorer.DoDefaultAction();
}
}
示例4: DisplayCommand
/// <summary>
/// Determines if the command should be displayed or not.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool DisplayCommand(UIHierarchyItem item)
{
try
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length != 1)
return false;
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
Project p = hierItem.Object as Project;
SolutionClass solution = hierItem.Object as SolutionClass;
if (p != null)
{
Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p;
return (projExt.Kind == BIDSProjectKinds.SSRS);
}
else if (solution != null)
{
foreach (Project pp in solution.Projects)
{
Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt projExt = (Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)p;
if (projExt.Kind == BIDSProjectKinds.SSRS)
return true;
}
}
return false;
}
catch
{
return false;
}
}
示例5: Collapse
private static void Collapse(UIHierarchyItem item, ref UIHierarchy solutionExplorer)
{
foreach (UIHierarchyItem innerItem in item.UIHierarchyItems)
{
if (innerItem.UIHierarchyItems.Count > 0)
{
// Re-cursive call
Collapse(innerItem, ref solutionExplorer);
// Collapse
if (innerItem.UIHierarchyItems.Expanded)
{
innerItem.UIHierarchyItems.Expanded = false;
if (innerItem.UIHierarchyItems.Expanded == true)
{
// Bug in VS 2005
innerItem.Select(vsUISelectionType.vsUISelectionTypeSelect);
solutionExplorer.DoDefaultAction();
}
}
}
}
}
示例6: DisplayCommand
/// <summary>
/// Determines if the command should be displayed or not.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool DisplayCommand(UIHierarchyItem item)
{
try
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length != 1)
return false;
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
foreach (string extension in DTS_FILE_EXTENSIONS)
{
if (sFileName.EndsWith(extension))
return true;
}
foreach (string extension in SSAS_FILE_EXTENSIONS)
{
if (sFileName.EndsWith(extension))
return true;
}
foreach (string extension in SSRS_FILE_EXTENSIONS)
{
if (sFileName.EndsWith(extension))
return true;
}
return false;
}
catch
{
return false;
}
}
示例7: Collapse
private static void Collapse(UIHierarchyItem item) {
foreach (UIHierarchyItem hierarchyItem in item.UIHierarchyItems) {
if (hierarchyItem.UIHierarchyItems.Count > 0) {
Collapse(hierarchyItem);
if (hierarchyItem.UIHierarchyItems.Expanded)
hierarchyItem.UIHierarchyItems.Expanded = false;
}
}
}
示例8: HasExpandedChildren
internal static bool HasExpandedChildren(UIHierarchyItem parentItem)
{
if (parentItem == null)
{
throw new ArgumentNullException("parentItem");
}
return parentItem.UIHierarchyItems.Cast<UIHierarchyItem>().Any(
childItem => childItem.UIHierarchyItems.Expanded || HasExpandedChildren(childItem));
}
示例9: DisplayCommand
public override bool DisplayCommand(UIHierarchyItem item)
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length != 1) return false;
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
string sFileName = ((ProjectItem)hierItem.Object).Name.ToLower();
return (sFileName.EndsWith(".dtsx"));
}
示例10: ExpandCollapseNodes
private void ExpandCollapseNodes(UIHierarchyItem node, bool expanded, UIHierarchy tree)
{
foreach(UIHierarchyItem subNode in node.UIHierarchyItems)
{
ExpandCollapseNodes(subNode, expanded, tree);
}
if (node.Object is SolutionFolder)
{
node.UIHierarchyItems.Expanded = true;
}
else if (node.Object is Solution)
{
node.UIHierarchyItems.Expanded = true;
}
else if (node.Object is Project)
{
if (((Project)node.Object).Object is SolutionFolder)
{
//are there projects in the solution folder
SolutionFolder f = ((Project)node.Object).Object as SolutionFolder;
bool expandit = false;
foreach (ProjectItem pi in f.Parent.ProjectItems)
{
if (pi.Object is Project)
{
//solutionfolder contains a child project, dont close
expandit = true;
}
}
node.UIHierarchyItems.Expanded = expandit;
}
else
{
node.UIHierarchyItems.Expanded = false;
}
}
else
{
node.UIHierarchyItems.Expanded = false;
//bug in VS
//if still expanded
if (node.UIHierarchyItems.Expanded == true)
{
node.Select(vsUISelectionType.vsUISelectionTypeSelect);
tree.DoDefaultAction();
}
}
}
示例11: DisplayCommand
public override bool DisplayCommand(UIHierarchyItem item)
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
foreach (object selected in ((System.Array)solExplorer.SelectedItems))
{
UIHierarchyItem hierItem = (UIHierarchyItem)selected;
ProjectItem projectItem = hierItem.Object as ProjectItem;
if (projectItem == null || !projectItem.Name.ToLower().EndsWith(".biml"))
{
return false;
}
}
return (((System.Array)solExplorer.SelectedItems).Length > 0);
}
示例12: DisplayCommand
/// <summary>
/// Determines if the command should be displayed or not.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool DisplayCommand(UIHierarchyItem item)
{
try
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length != 1)
return false;
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
return (((ProjectItem)hierItem.Object).Object is Dimension);
}
catch
{
return false;
}
}
示例13: ShouldCollapseItem
private static bool ShouldCollapseItem(UIHierarchyItem parentItem)
{
if (parentItem.Object is Solution)
{
return false;
}
if (parentItem.Object is Project)
{
var solution = parentItem.DTE.Solution;
if (solution != null && solution.Projects.Count <= 2)
{
return false;
}
}
return true;
}
示例14: DisplayCommand
/// <summary>
/// Determines if the command should be displayed or not.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool DisplayCommand(UIHierarchyItem item)
{
try
{
bool bFoundRightItem = false;
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
foreach (UIHierarchyItem hierItem in ((System.Array)solExplorer.SelectedItems))
{
if (hierItem.Name.ToLower().EndsWith(".cube")) //checking the file extension is adequate because this feature is not needed for in online mode (when live connected to the server)
bFoundRightItem = true;
else
return false;
}
return bFoundRightItem;
}
catch
{
return false;
}
}
示例15: DisplayCommand
public override bool DisplayCommand(UIHierarchyItem item)
{
UIHierarchy solExplorer = this.ApplicationObject.ToolWindows.SolutionExplorer;
if (((System.Array)solExplorer.SelectedItems).Length == 1)
{
UIHierarchyItem hierItem = ((UIHierarchyItem)((System.Array)solExplorer.SelectedItems).GetValue(0));
Project project = hierItem.Object as Project;
ProjectItem projectItem = hierItem.Object as ProjectItem;
if (project != null)
{
return (project.Kind == BIDSProjectKinds.SSIS);
}
else if (projectItem != null)
{
return projectItem.ContainingProject.Kind == BIDSProjectKinds.SSIS;
}
}
return false;
}