/// <summary> /// create a new instance of the view model. /// </summary> /// <param name="tp">a OneNote page object</param> /// <param name="highlighter">object to generate a highlight description of the link title</param> /// <param name="onenote">OneNote application object proxy</param> internal HitHighlightedPageLinkModel(TaggedPage tp, TextSplitter highlighter, OneNoteProxy onenote) : base(tp.Title, tp.ID) { IsSelected = false; _page = tp; _highlights = highlighter.SplitText(_page.Title); HitCount = _highlights.Count((f) => f.IsMatch); _onenote = onenote; }
private void TrackCurrentPage(object state) { if (!_currentPageID.Equals(OneNoteApp.CurrentPageID)) { _currentPageID = OneNoteApp.CurrentPageID; TagsAndPages tap = new TagsAndPages(OneNoteApp); tap.LoadPageTags(TagContext.CurrentNote); TaggedPage tp = tap.Pages.Values.FirstOrDefault(); if (tp != null) { Dispatcher.Invoke(() => { CurrentTags = from t in tp.Tags select t.TagName; CurrentPageTitle = tp.Title; }); } } }
private void TrackCurrentPage(object state) { if (!_currentPageID.Equals(OneNoteApp.CurrentPageID)) { // pull in new page _currentPageID = OneNoteApp.CurrentPageID; XDocument result = OneNoteApp.GetHierarchy(_currentPageID, HierarchyScope.hsSelf); XNamespace one = result.Root.GetNamespaceOfPrefix("one"); XElement pg = result.Descendants(one.GetName("Page")).FirstOrDefault(); if (pg != null) { _currentPage = new TaggedPage(pg); fireNotifyPropertyChanged(Dispatcher, PAGE_TITLE); fireNotifyPropertyChanged(Dispatcher, RELATED_PAGES); } // build the list of pages } }
internal RelatedPageLinkModel(TaggedPage page, TagPageSet tag) { _page = page; _tag = tag; }