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


C# HierarchyNode类代码示例

本文整理汇总了C#中HierarchyNode的典型用法代码示例。如果您正苦于以下问题:C# HierarchyNode类的具体用法?C# HierarchyNode怎么用?C# HierarchyNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ExecCommandOnProjectSourceNode

        internal static bool ExecCommandOnProjectSourceNode(HierarchyNode node, Guid cmdGroup, uint cmd, uint cmdexecopt, IntPtr pvaIn, IntPtr pvaOut, out int returnCode)
        {
            if (cmdGroup == VsMenus.guidStandardCommandSet2K)
            {
                switch ((VsCommands2K)cmd)
                {
                    case VsCommands2K.INCLUDEINPROJECT:
                        returnCode = ((IProjectSourceNode)node).IncludeInProject();
                        return true;

                    case VsCommands2K.EXCLUDEFROMPROJECT:
                        returnCode = ((IProjectSourceNode)node).ExcludeFromProject();
                        return true;

                    case OpenFolderInExplorerCmdId:
                        System.Diagnostics.Process.Start(node.Url);
                        returnCode = VSConstants.S_OK;
                        return true;
                }
            }

            // just an arbitrary value, it doesn't matter if method hasn't handled the request
            returnCode = VSConstants.S_FALSE;

            // not handled
            return false;
        }
开发者ID:vestild,项目名称:nemerle,代码行数:27,代码来源:HierarchyHelpers.cs

示例2: CreateDirectoryNode

        public static HierarchyNode<ContentItem> CreateDirectoryNode(IFileSystem fs, ContentItem directory, HierarchyNode<ContentItem> parent, List<ContentItem> selectionTrail)
        {
            var node = new HierarchyNode<ContentItem>(directory);
            ExpandRecursive(fs, node, selectionTrail);

            return node;
        }
开发者ID:sveinfid,项目名称:n2cms,代码行数:7,代码来源:MediaBrowserUtils.cs

示例3: Build

		/// <summary>
		/// Builds this instance.
		/// </summary>
		/// <returns></returns>
		public override HierarchyNode<ContentItem> Build()
		{
			if (initialItem == lastAncestor && !appendAdditionalLevel)
			{
				return new HierarchyNode<ContentItem>(initialItem);
			}

			HierarchyNode<ContentItem> previousNode = null;
			foreach (ContentItem currentItem in Find.EnumerateParents(initialItem, lastAncestor, appendAdditionalLevel, UseMasterVersion))
			{
				HierarchyNode<ContentItem> currentNode = new HierarchyNode<ContentItem>(currentItem);
				if (previousNode != null)
				{
					previousNode.Parent = currentNode;
				}

				foreach (ContentItem childItem in GetChildren(currentItem))
				{
					if (previousNode != null && childItem.Equals(previousNode.Current))
					{
						currentNode.Children.Add(previousNode);
					}
					else
					{
						HierarchyNode<ContentItem> childNode = new HierarchyNode<ContentItem>(childItem);
						currentNode.Children.Add(childNode);
						childNode.Parent = currentNode;
					}
				}
				previousNode = currentNode;
			}
			return previousNode;
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:37,代码来源:BranchHierarchyBuilder.cs

示例4: SelectItemInSolutionExplorer

 public static void SelectItemInSolutionExplorer(this IVsUIShell uiShell, HierarchyNode node)
 {
     if (node != null)
     {
         uiShell.GetSolutionExplorer().ExpandItem((node.Hierarchy as IVsUIHierarchy), node.ItemId, EXPANDFLAGS.EXPF_SelectItem);
     }
 }
开发者ID:henritersteeg,项目名称:cuke4vs,代码行数:7,代码来源:IVsUIShellExtensions.cs

示例5: Build

        public override HierarchyNode<ContentItem> Build()
        {
            if (_initialItem == _lastAncestor && !_appendAdditionalLevel)
                return new HierarchyNode<ContentItem>(_initialItem);

            HierarchyNode<ContentItem> previousNode = null;
            foreach (ContentItem currentItem in Find.EnumerateParents(_initialItem, _lastAncestor, _appendAdditionalLevel))
            {
                HierarchyNode<ContentItem> currentNode = new HierarchyNode<ContentItem>(currentItem);
                if (previousNode != null)
                    previousNode.Parent = currentNode;

                foreach (ContentItem childItem in GetChildren(currentItem))
                {
                    if (previousNode != null && (previousNode.Current == childItem || previousNode.Current.TranslationOf == childItem))
                    {
                        currentNode.Children.Add(previousNode);
                    }
                    else
                    {
                        HierarchyNode<ContentItem> childNode = new HierarchyNode<ContentItem>(childItem);
                        currentNode.Children.Add(childNode);
                        childNode.Parent = currentNode;
                    }
                }
                previousNode = currentNode;
            }
            return previousNode;
        }
开发者ID:dpawatts,项目名称:zeus,代码行数:29,代码来源:BranchHierarchyBuilder.cs

示例6: OnMenuChangeAddServiceReference

        public void OnMenuChangeAddServiceReference(object sender, EventArgs e)
        {
            try
            {
                Store store = this.CurrentDocView.CurrentDiagram.Store;
                Proxy proxy = DomainModelHelper.GetSelectedElement(this.ServiceProvider) as Proxy;

                if (proxy != null &&
                    !string.IsNullOrWhiteSpace(proxy.ClientApplication.ImplementationProject) &&
                    proxy.ClientApplication.ImplementationTechnology != null)
                {
                    IVsSolution solution = this.ServiceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
                    using (HierarchyNode projectNode = new HierarchyNode(solution, proxy.ClientApplication.ImplementationProject))
                    {
                        if (projectNode != null)
                        {
                            IVsAddWebReferenceResult result = VsShellDialogs.AddWebReferenceDialog(this.ServiceProvider, null, projectNode);
                            if (result != null)
                            {
                                result.Save();  // IVsWCFReferenceGroup refGropup = (IVsWCFReferenceGroup)result.Save()                              
                            }
                        }
                    }
                }
            }
            catch (Exception error)
            {
                Logger.Write(error);
            }
        }
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:30,代码来源:HostDesignerCommandSet.cs

示例7: Fire

        private void Fire(HierarchyNode node, Action<IVsExtensibility3, ProjectItem> fire) {
            // When we are in suspended mode. Do not fire anything
            if (this._suspended) {
                return;
            }

            // Project has to be opened
            if (!this._project.IsProjectOpened) {
                return;
            }

            // We don't want to fire events for references here. OAReferences should do the job
            if (node is ReferenceNode) {
                return;
            }

            IVsExtensibility3 vsExtensibility = this._project.GetService(typeof(IVsExtensibility)) as IVsExtensibility3;
            if (vsExtensibility != null) {
                object obj = node.GetAutomationObject();
                ProjectItem item = obj as ProjectItem;
                if (item != null) {
                    fire(vsExtensibility, item);
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:25,代码来源:ExtensibilityEventsDispatcher.cs

示例8: Replace

 public static void Replace(RustProjectNode root, HierarchyNode old, Func<HierarchyNode> newN)
 {
     if (root == null)
         throw new ArgumentNullException("root");
     if (old == null)
         throw new ArgumentNullException("old");
     if (newN == null)
         throw new ArgumentNullException("newN");
     __VSHIERARCHYITEMSTATE visualState = old.GetItemState(__VSHIERARCHYITEMSTATE.HIS_Selected | __VSHIERARCHYITEMSTATE.HIS_Expanded);
     HierarchyNode parent = old.Parent;
     HierarchyNode newNode;
     if(parent is UntrackedFolderNode)
     {
         using(((UntrackedFolderNode)parent).SuspendChildrenTracking())
         { 
             newNode = ReplaceCore(root, old, newN, parent);
             ((UntrackedFolderNode)parent).OnChildReplaced(old, newNode);
         }
     }
     else
     {
         newNode = ReplaceCore(root, old, newN, parent);
     }
     if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Expanded) != 0)
         newNode.ExpandItem(EXPANDFLAGS.EXPF_ExpandFolder);
     if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Selected) != 0)
         newNode.ExpandItem(EXPANDFLAGS.EXPF_SelectItem);
 }
开发者ID:whuthj,项目名称:VisualRust,代码行数:28,代码来源:TreeOperations.cs

示例9: EnsureDetachedFromFormerParent

 private static void EnsureDetachedFromFormerParent(HierarchyNode hierarchyNode, ChangeSetBuilder pendingChanges)
 {
     if (hierarchyNode.Parent != null)
     {
         pendingChanges.Add(new DetachChildCommand(hierarchyNode.Parent.Id, hierarchyNode.Id));
     }
 }
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:7,代码来源:OrgHierarchyAPI.cs

示例10: Write

		internal static void Write(HierarchyNode<ContentItem> hierarchy, ContentItem selectedItem, IContentAdapterProvider adapters, ItemFilter filter, string selectableTypes, string selectableExtensions, bool excludeRoot, string target, TextWriter writer)
		{
			N2.Web.Tree.Using(hierarchy)
				.OpenTo(selectedItem)
				.Filters(filter)
				.IdProvider(n => "u" + n.Current.ID, n => "l" + n.Current.ID)
				.LinkWriter((n, w) =>
				{
					BuildLink(adapters.ResolveAdapter<NodeAdapter>(n.Current), n.Current, n.Current.Path == selectedItem.Path, target, IsSelectable(n.Current, selectableTypes, selectableExtensions)).WriteTo(w);
					if (n.Children.Count == 0 && adapters.ResolveAdapter<NodeAdapter>(n.Current).HasChildren(n.Current, filter))
					{
						var ul = new TagBuilder("ul");
						ul.AddCssClass("ajax");
						w.Write(ul.ToString(TagRenderMode.StartTag));

						var li = new TagBuilder("li");
						li.InnerHtml = "{url:" + Url.ParseTokenized("{ManagementUrl}/Content/Navigation/LoadTree.ashx")
							.AppendQuery("target", target)
							.AppendQuery(SelectionUtility.SelectedQueryKey, HttpUtility.UrlEncode(n.Current.Path))
							.AppendQuery("selectableTypes", selectableTypes)
							.AppendQuery("selectableExtensions", selectableExtensions)
							+ "}";
						w.Write(li.ToString());

						w.Write(ul.ToString(TagRenderMode.EndTag));
					}
				})
				.ExcludeRoot(excludeRoot)
				.WriteTo(writer);
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:30,代码来源:TreeUtility.cs

示例11: CreateItem

 /// <summary>
 /// Private helper to facilitate the previous CreateItem methods.
 /// </summary>
 private static IItemContainer CreateItem(IServiceProvider serviceProvider, HierarchyNode parent, uint selectedItemid)
 {
     using (HierarchyNode current = new HierarchyNode(parent, selectedItemid))
     {
         return ItemFactory.CreateItem(serviceProvider, current);
     }
 }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:10,代码来源:ItemFactory.cs

示例12: OnInit

        protected override void OnInit(EventArgs e)
        {
            var selected = Selection.SelectedItem;
            if (IsPostBack && !string.IsNullOrEmpty(inputFile.PostedFile.FileName))
            {
                string uploadFolder = Request["inputLocation"];
                if(!IsAvailable(uploadFolder))
                    throw new N2Exception("Cannot upload to " + Server.HtmlEncode(uploadFolder));

                string fileName = System.IO.Path.GetFileName(inputFile.PostedFile.FileName);
                string filePath = VirtualPathUtility.Combine(uploadFolder, fileName);
                FS.WriteFile(filePath, inputFile.PostedFile.InputStream);

                ClientScript.RegisterStartupScript(typeof(Tree), "select", "updateOpenerWithUrlAndClose('" + ResolveUrl(filePath) + "');", true);
            }
            else if (Request["location"] == "files" || Request["location"] == "filesselection")
            {
                IHost host = Engine.Resolve<IHost>();
                HierarchyNode<ContentItem> root = new HierarchyNode<ContentItem>(Engine.Persister.Get(host.DefaultSite.RootItemID));

                var selectionTrail = new List<ContentItem>();
                if (selected is AbstractNode)
                {
                    selectionTrail = new List<ContentItem>(Find.EnumerateParents(selected, null, true));
                }
                else
                {
                    TrySelectingPrevious(ref selected, ref selectionTrail);
                }

                foreach (string uploadFolder in Engine.EditManager.UploadFolders)
                {
                    var dd = FS.GetDirectory(uploadFolder);

                    var node = CreateDirectoryNode(FS, new Directory(FS, dd, root.Current), root, selectionTrail);
                    root.Children.Add(node);
                }

                AddSiteFilesNodes(root, host.DefaultSite, selectionTrail);
                foreach (var site in host.Sites)
                {
                    AddSiteFilesNodes(root, site, selectionTrail);
                }

                siteTreeView.Nodes = root;
                siteTreeView.SelectedItem = selected;
            }
            else
            {
                var filter = Engine.EditManager.GetEditorFilter(Page.User);
                siteTreeView.Filter = filter;
                siteTreeView.RootNode = RootNode;
                siteTreeView.SelectedItem = selected;
            }

            siteTreeView.DataBind();

            base.OnInit(e);
        }
开发者ID:cherylhanlon,项目名称:Tigers,代码行数:59,代码来源:Tree.aspx.cs

示例13: AddDirectory

 /// <summary>
 /// Adds a directory to the project hierarchy with the specified parent.
 /// </summary>
 protected void AddDirectory(HierarchyNode parent, bool isSearchPath, string subfolder) {
     var existing = parent.FindChild(Path.GetFileName(subfolder));
     if (existing == null) {
         FolderNode folderNode = CreateFolderNode(subfolder);
         parent.AddChild(folderNode);
         CreateHierarchy(folderNode, subfolder, isSearchPath);
     }
 }
开发者ID:jschementi,项目名称:iron,代码行数:11,代码来源:DirectoryBasedProjectNode.cs

示例14: GetNodeNameForPackage

 private static string GetNodeNameForPackage(HierarchyNode node) {
     var project = node as ProjectNode;
     if (project != null) {
         return CommonUtils.GetFileOrDirectoryName(project.ProjectHome);
     } else {
         return node.Caption;
     }
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:PythonFileNode.cs

示例15: NamePropertySetCorrectly

		public void NamePropertySetCorrectly()
		{
			string name = "MyName";
			MockVSHierarchy hierarchy = new MockVSHierarchy(name, Guid.NewGuid());
			MockVsSolution solution = new MockVsSolution(hierarchy);
			HierarchyNode node = new HierarchyNode(solution);
			Assert.AreEqual<string>(name, node.Name);
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:8,代码来源:HierarchyNodeFixture.cs


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