コード例 #1
0
        /// <summary>
        /// Create a new instance of a design time view model
        /// </summary>
        public FindTaggedPagesDesignerModel()
        {
            _scopes = new List <SearchScopeFacade> {
                new SearchScopeFacade()
                {
                    Scope      = SearchScope.AllNotebooks,
                    ScopeLabel = "All Notebooks"
                },
                new SearchScopeFacade()
                {
                    Scope      = SearchScope.Notebook,
                    ScopeLabel = "Notebooks"
                }
            };

            _selectedScope = _scopes[0];

            TagsAndPages c = new TagsAndPages(null);

            c.ExtractTags(XDocument.Parse(_strXml), false);

            TextSplitter splitter = new TextSplitter("Cool");

            _pages.AddAll(from TaggedPage tp in c.Pages.Values select new HitHighlightedPageLinkModel(tp, splitter, null));

            _tags.AddAll(from t in c.Tags.Values select new TagSelectorModel(t));
        }
コード例 #2
0
        /// <summary>
        /// Create a new instance of the view model
        /// </summary>
        public TagEditorDesignerModel()
        {
            _suggestedTags.AddAll(new HitHighlightedTagButtonModel[] {
                new HitHighlightedTagButtonModel()
                {
                    TagName = "Suggested Tag 1"
                },
                new HitHighlightedTagButtonModel()
                {
                    TagName = "Suggested Tag 2"
                }
            });

            _pageTags.AddAll(new SimpleTagButtonModel[] { new SimpleTagButtonModel("tag 1"), new SimpleTagButtonModel("tag 2") });
        }
コード例 #3
0
        private void HandlePageCollectionChanges(object sender, NotifyDictionaryChangedEventArgs <string, TaggedPage> e)
        {
            Action a = null;

            switch (e.Action)
            {
            case NotifyDictionaryChangedAction.Add:
                a = () => _pages.AddAll(from i in e.Items select new HitHighlightedPageLinkModel(i, _highlighter, OneNoteApp));
                break;

            case NotifyDictionaryChangedAction.Remove:
                a = () => _pages.RemoveAll(from i in e.Items select i.Key);
                break;

            case NotifyDictionaryChangedAction.Reset:
                a = () => _pages.Clear();
                break;
            }
            if (a != null)
            {
                Dispatcher.Invoke(new Action(() => { a(); fireNotifyPropertyChanged(PAGE_COUNT); }));
            }
        }