示例#1
0
        // async event handlers should be be declared 'async void'
        private async void ChangeScope(object sender, EventArgs e)
        {
            tagsFlow.Controls.Clear();

            OneNote.Scope scope = OneNote.Scope.Notebooks;
            switch (scopeBox.SelectedIndex)
            {
            case 1: scope = OneNote.Scope.Sections; break;

            case 2: scope = OneNote.Scope.Pages; break;
            }

            var tags = await TagHelpers.FetchRecentTags(scope, 30);

            if (tags.Count > 0)
            {
                var sorted = tags.OrderBy(k => k.Key.StartsWith("#") ? k.Key.Substring(1) : k.Key);

                foreach (var s in sorted)
                {
                    var tag = new TagCheckBox(s.Value);
                    tag.CheckedChanged += ChangeTagSelection;
                    tagsFlow.Controls.Add(tag);
                }
            }
        }
示例#2
0
        private async Task FetchRecentTags()
        {
            var tags = await TagHelpers.FetchRecentTags(OneNote.Scope.Notebooks, PoolSize);

            if (tags.Count > 0)
            {
                // keep order of most recent first
                foreach (var value in tags.Values)
                {
                    recentFlow.Controls.Add(MakeLabel(value, value));
                }
            }
        }