Beispiel #1
0
        private ITagPicker PrepareTagPicker(
            ITagPickingOptions tagPickingOptions,
            IEnumerable <ITagInfo> tagInfos)
        {
            ITagPicker tagPicker = _tagPickerFactory.CreateTagPicker(tagPickingOptions);

            tagPicker.PreProcessAllTags(tagInfos);
            return(tagPicker);
        }
Beispiel #2
0
        /// <summary>
        ///     Adds tags, but only those that are permitted by the tag picker.
        /// </summary>
        private void AddTags(IEnumerable <ITag> tags, ITagPickingOptions tagPickingOptions, ITree tree)
        {
            ITagInfo[] tagInfos = tags.Select(t => CreateTagInfo(t, tree)).ToArray();

            // Prepare picker.
            ITagPicker tagPicker = PrepareTagPicker(tagPickingOptions, tagInfos);

            // Now tags.
            foreach (ITagInfo tagInfo in tagInfos)
            {
                ITag tag = tagInfo.Tag;

                if (!tagPicker.CheckIfTagShouldBePicked(tag))
                {
                    continue;
                }

                tree.AddTag(tag);
            }
        }