public void SetToolbarBreadCrumbs() { m_Breadcrumbs.Clear(); var allHierarchyDocuments = new List <BuilderDocumentOpenUXML>(); var allOpenDocuments = m_PaneWindow.document.openUXMLFiles; foreach (var Doc in allOpenDocuments) { if (Doc.openSubDocumentParentIndex > -1 || allOpenDocuments.IndexOf(Doc) == 0) { allHierarchyDocuments.Add(Doc); } } if (allHierarchyDocuments.Count == 1) { m_BreadcrumbsToolbar.style.display = DisplayStyle.None; return; } m_BreadcrumbsToolbar.style.display = DisplayStyle.Flex; foreach (var Doc in allHierarchyDocuments) { string docName = BreadcrumbFileName(Doc); Action onBreadCrumbClick = () => { document.GoToSubdocument(m_Viewport.documentRootElement, m_PaneWindow, Doc); m_Viewport.SetViewFromDocumentSetting(); }; bool clickedOnSameDocument = document.activeOpenUXMLFile == Doc; m_Breadcrumbs.PushItem(docName, clickedOnSameDocument ? null : onBreadCrumbClick); } }
void BuildBreadCrumbs(string contentName) { m_Breadcrumbs.Clear(); List <string> contentTitles = new List <string>(); for (var c = contentName; m_Parents.TryGetValue(c, out var parent); c = parent) { contentTitles.Add(parent); } foreach (string title in Enumerable.Reverse(contentTitles)) { m_Breadcrumbs.PushItem(title, () => LoadContentByName(title)); } m_Breadcrumbs.PushItem(contentName); }