当前位置: 首页>>代码示例>>C#>>正文


C# TagMode类代码示例

本文整理汇总了C#中TagMode的典型用法代码示例。如果您正苦于以下问题:C# TagMode类的具体用法?C# TagMode怎么用?C# TagMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TagMode类属于命名空间,在下文中一共展示了TagMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PhotoSearchOptions

 /// <summary>
 /// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list,
 /// with the selected tag mode, and containing the selected text.
 /// </summary>
 /// <param name="userId">The ID of the User to search for.</param>
 /// <param name="tags">The tags (comma delimited) to search for.</param>
 /// <param name="tagMode">The <see cref="TagMode"/> to use to search.</param>
 /// <param name="text">The text to search for in photo title and descriptions.</param>
 public PhotoSearchOptions(string userId, string tags, TagMode tagMode, string text)
 {
     UserId = userId;
     Tags = tags;
     TagMode = tagMode;
     Text = text;
 }
开发者ID:ericleigh007,项目名称:flickr-net,代码行数:15,代码来源:PhotoSearchOptions.cs

示例2: PhotoSearchOptions

 public PhotoSearchOptions(string userId, string tags, TagMode tagMode, string text)
 {
     this.UserId = userId;
       this.Tags = tags;
       this.TagMode = tagMode;
       this.Text = text;
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:7,代码来源:PhotoSearchOptions.cs

示例3: Begin

        /// <summary>
        /// Starts a <see cref="TagHelperExecutionContext"/> scope.
        /// </summary>
        /// <param name="tagName">The HTML tag name that the scope is associated with.</param>
        /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
        /// <param name="uniqueId">An identifier unique to the HTML element this scope is for.</param>
        /// <param name="executeChildContentAsync">A delegate used to execute the child content asynchronously.</param>
        /// <param name="startTagHelperWritingScope">A delegate used to start a writing scope in a Razor page.</param>
        /// <param name="endTagHelperWritingScope">A delegate used to end a writing scope in a Razor page.</param>
        /// <returns>A <see cref="TagHelperExecutionContext"/> to use.</returns>
        public TagHelperExecutionContext Begin(
            string tagName,
            TagMode tagMode,
            string uniqueId,
            Func<Task> executeChildContentAsync,
            Action startTagHelperWritingScope,
            Func<TagHelperContent> endTagHelperWritingScope)
        {
            if (tagName == null)
            {
                throw new ArgumentNullException(nameof(tagName));
            }

            if (uniqueId == null)
            {
                throw new ArgumentNullException(nameof(uniqueId));
            }

            if (executeChildContentAsync == null)
            {
                throw new ArgumentNullException(nameof(executeChildContentAsync));
            }

            if (startTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(startTagHelperWritingScope));
            }

            if (endTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(endTagHelperWritingScope));
            }

            IDictionary<object, object> items;

            // If we're not wrapped by another TagHelper, then there will not be a parentExecutionContext.
            if (_executionScopes.Count > 0)
            {
                items = new CopyOnWriteDictionary<object, object>(
                    _executionScopes.Peek().Items,
                    comparer: EqualityComparer<object>.Default);
            }
            else
            {
                items = new Dictionary<object, object>();
            }

            var executionContext = new TagHelperExecutionContext(
                tagName,
                tagMode,
                items,
                uniqueId,
                executeChildContentAsync,
                startTagHelperWritingScope,
                endTagHelperWritingScope);

            _executionScopes.Push(executionContext);

            return executionContext;
        }
开发者ID:huoxudong125,项目名称:Razor,代码行数:70,代码来源:TagHelperScopeManager.cs

示例4: TagHelperExecutionContext

        /// <summary>
        /// Instantiates a new <see cref="TagHelperExecutionContext"/>.
        /// </summary>
        /// <param name="tagName">The HTML tag name in the Razor source.</param>
        /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
        /// <param name="items">The collection of items used to communicate with other
        /// <see cref="ITagHelper"/>s</param>
        /// <param name="uniqueId">An identifier unique to the HTML element this context is for.</param>
        /// <param name="executeChildContentAsync">A delegate used to execute the child content asynchronously.</param>
        /// <param name="startTagHelperWritingScope">
        /// A delegate used to start a writing scope in a Razor page and optionally override the page's
        /// <see cref="HtmlEncoder"/> within that scope.
        /// </param>
        /// <param name="endTagHelperWritingScope">A delegate used to end a writing scope in a Razor page.</param>
        public TagHelperExecutionContext(
            string tagName,
            TagMode tagMode,
            IDictionary<object, object> items,
            string uniqueId,
            Func<Task> executeChildContentAsync,
            Action<HtmlEncoder> startTagHelperWritingScope,
            Func<TagHelperContent> endTagHelperWritingScope)
        {
            if (startTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(startTagHelperWritingScope));
            }

            if (endTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(endTagHelperWritingScope));
            }

            _tagHelpers = new List<ITagHelper>();
            _allAttributes = new TagHelperAttributeList();

            Context = new TagHelperContext(_allAttributes, items, uniqueId);
            Output = new TagHelperOutput(tagName, new TagHelperAttributeList(), GetChildContentAsync)
            {
                TagMode = tagMode
            };

            Reinitialize(tagName, tagMode, items, uniqueId, executeChildContentAsync);

            _startTagHelperWritingScope = startTagHelperWritingScope;
            _endTagHelperWritingScope = endTagHelperWritingScope;
        }
开发者ID:x-strong,项目名称:Razor,代码行数:47,代码来源:TagHelperExecutionContext.cs

示例5: Begin

        /// <summary>
        /// Starts a <see cref="TagHelperExecutionContext"/> scope.
        /// </summary>
        /// <param name="tagName">The HTML tag name that the scope is associated with.</param>
        /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
        /// <param name="uniqueId">An identifier unique to the HTML element this scope is for.</param>
        /// <param name="executeChildContentAsync">A delegate used to execute the child content asynchronously.</param>
        /// <param name="startTagHelperWritingScope">A delegate used to start a writing scope in a Razor page.</param>
        /// <param name="endTagHelperWritingScope">A delegate used to end a writing scope in a Razor page.</param>
        /// <returns>A <see cref="TagHelperExecutionContext"/> to use.</returns>
        public TagHelperExecutionContext Begin(
            [NotNull] string tagName,
            TagMode tagMode,
            [NotNull] string uniqueId,
            [NotNull] Func<Task> executeChildContentAsync,
            [NotNull] Action startTagHelperWritingScope,
            [NotNull] Func<TagHelperContent> endTagHelperWritingScope)
        {
            IDictionary<object, object> items;

            // If we're not wrapped by another TagHelper, then there will not be a parentExecutionContext.
            if (_executionScopes.Count > 0)
            {
                items = new CopyOnWriteDictionary<object, object>(
                    _executionScopes.Peek().Items,
                    comparer: EqualityComparer<object>.Default);
            }
            else
            {
                items = new Dictionary<object, object>();
            }

            var executionContext = new TagHelperExecutionContext(
                tagName,
                tagMode,
                items,
                uniqueId,
                executeChildContentAsync,
                startTagHelperWritingScope,
                endTagHelperWritingScope);

            _executionScopes.Push(executionContext);

            return executionContext;
        }
开发者ID:antiufo,项目名称:Razor,代码行数:45,代码来源:TagHelperScopeManager.cs

示例6: TagMode_ReturnsExpectedValue

        public void TagMode_ReturnsExpectedValue(TagMode tagMode)
        {
            // Arrange & Act
            var executionContext = new TagHelperExecutionContext("p", tagMode);

            // Assert
            Assert.Equal(tagMode, executionContext.TagMode);
        }
开发者ID:leloulight,项目名称:Razor,代码行数:8,代码来源:TagHelperExecutionContextTest.cs

示例7: TagHelperExecutionContext

 /// <summary>
 /// Internal for testing purposes only.
 /// </summary>
 internal TagHelperExecutionContext(string tagName, TagMode tagMode)
     : this(tagName,
            tagMode,
            items: new Dictionary<object, object>(),
            uniqueId: string.Empty,
            executeChildContentAsync: async () => await Task.FromResult(result: true),
            startTagHelperWritingScope: () => { },
            endTagHelperWritingScope: () => new DefaultTagHelperContent())
 {
 }
开发者ID:antiufo,项目名称:Razor,代码行数:13,代码来源:TagHelperExecutionContext.cs

示例8: TagHelperChunk

 /// <summary>
 /// Instantiates a new <see cref="TagHelperChunk"/>.
 /// </summary>
 /// <param name="tagName">The tag name associated with the tag helpers HTML element.</param>
 /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
 /// <param name="attributes">The attributes associated with the tag helpers HTML element.</param>
 /// <param name="descriptors">
 /// The <see cref="TagHelperDescriptor"/>s associated with this tag helpers HTML element.
 /// </param>
 public TagHelperChunk(
     string tagName,
     TagMode tagMode,
     IList<KeyValuePair<string, Chunk>> attributes,
     IEnumerable<TagHelperDescriptor> descriptors)
 {
     TagName = tagName;
     TagMode = tagMode;
     Attributes = attributes;
     Descriptors = descriptors;
 }
开发者ID:rahulchrty,项目名称:Razor,代码行数:20,代码来源:TagHelperChunk.cs

示例9: TagHelperExecutionContext

        /// <summary>
        /// Instantiates a new <see cref="TagHelperExecutionContext"/>.
        /// </summary>
        /// <param name="tagName">The HTML tag name in the Razor source.</param>
        /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
        /// <param name="items">The collection of items used to communicate with other
        /// <see cref="ITagHelper"/>s</param>
        /// <param name="uniqueId">An identifier unique to the HTML element this context is for.</param>
        /// <param name="executeChildContentAsync">A delegate used to execute the child content asynchronously.</param>
        /// <param name="startTagHelperWritingScope">A delegate used to start a writing scope in a Razor page.</param>
        /// <param name="endTagHelperWritingScope">A delegate used to end a writing scope in a Razor page.</param>
        public TagHelperExecutionContext(
            string tagName,
            TagMode tagMode,
            IDictionary<object, object> items,
            string uniqueId,
            Func<Task> executeChildContentAsync,
            Action startTagHelperWritingScope,
            Func<TagHelperContent> endTagHelperWritingScope)
        {
            if (tagName == null)
            {
                throw new ArgumentNullException(nameof(tagName));
            }

            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            if (uniqueId == null)
            {
                throw new ArgumentNullException(nameof(uniqueId));
            }

            if (executeChildContentAsync == null)
            {
                throw new ArgumentNullException(nameof(executeChildContentAsync));
            }

            if (startTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(startTagHelperWritingScope));
            }

            if (endTagHelperWritingScope == null)
            {
                throw new ArgumentNullException(nameof(endTagHelperWritingScope));
            }

            _tagHelpers = new List<ITagHelper>();
            _executeChildContentAsync = executeChildContentAsync;
            _startTagHelperWritingScope = startTagHelperWritingScope;
            _endTagHelperWritingScope = endTagHelperWritingScope;

            TagMode = tagMode;
            HTMLAttributes = new TagHelperAttributeList();
            AllAttributes = new TagHelperAttributeList();
            TagName = tagName;
            Items = items;
            UniqueId = uniqueId;
        }
开发者ID:leloulight,项目名称:Razor,代码行数:62,代码来源:TagHelperExecutionContext.cs

示例10: TagHelperBlockBuilder

 /// <summary>
 /// Instantiates a new instance of the <see cref="TagHelperBlockBuilder"/> class
 /// with the provided <paramref name="tagName"/> and derives its <see cref="Attributes"/>
 /// and <see cref="BlockBuilder.Type"/> from the <paramref name="startTag"/>.
 /// </summary>
 /// <param name="tagName">An HTML tag name.</param>
 /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
 /// <param name="start">Starting location of the <see cref="TagHelperBlock"/>.</param>
 /// <param name="attributes">Attributes of the <see cref="TagHelperBlock"/>.</param>
 /// <param name="descriptors">The <see cref="TagHelperDescriptor"/>s associated with the current HTML
 /// tag.</param>
 public TagHelperBlockBuilder(
     string tagName,
     TagMode tagMode,
     SourceLocation start,
     IList<KeyValuePair<string, SyntaxTreeNode>> attributes,
     IEnumerable<TagHelperDescriptor> descriptors)
 {
     TagName = tagName;
     TagMode = tagMode;
     Start = start;
     Descriptors = descriptors;
     Attributes = new List<KeyValuePair<string, SyntaxTreeNode>>(attributes);
     Type = BlockType.Tag;
     ChunkGenerator = new TagHelperChunkGenerator(descriptors);
 }
开发者ID:huoxudong125,项目名称:Razor,代码行数:26,代码来源:TagHelperBlockBuilder.cs

示例11: TagModeToString

 /// <summary>
 /// Convert a <see cref="TagMode"/> to a string used when passing to Flickr.
 /// </summary>
 /// <param name="tagMode">The tag mode to convert.</param>
 /// <returns>The string to pass to Flickr.</returns>
 public static string TagModeToString(TagMode tagMode)
 {
     switch (tagMode)
     {
         case TagMode.None:
             return String.Empty;
         case TagMode.AllTags:
             return "all";
         case TagMode.AnyTag:
             return "any";
         case TagMode.Boolean:
             return "bool";
         default:
             return String.Empty;
     }
 }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:21,代码来源:UtilityMethods.cs

示例12: Begin

        /// <summary>
        /// Starts a <see cref="TagHelperExecutionContext"/> scope.
        /// </summary>
        /// <param name="tagName">The HTML tag name that the scope is associated with.</param>
        /// <param name="tagMode">HTML syntax of the element in the Razor source.</param>
        /// <param name="uniqueId">An identifier unique to the HTML element this scope is for.</param>
        /// <param name="executeChildContentAsync">A delegate used to execute the child content asynchronously.</param>
        /// <returns>A <see cref="TagHelperExecutionContext"/> to use.</returns>
        public TagHelperExecutionContext Begin(
            string tagName,
            TagMode tagMode,
            string uniqueId,
            Func<Task> executeChildContentAsync)
        {
            if (tagName == null)
            {
                throw new ArgumentNullException(nameof(tagName));
            }

            if (uniqueId == null)
            {
                throw new ArgumentNullException(nameof(uniqueId));
            }

            if (executeChildContentAsync == null)
            {
                throw new ArgumentNullException(nameof(executeChildContentAsync));
            }

            IDictionary<object, object> items;
            var parentExecutionContext = _executionContextPool.Current;

            // If we're not wrapped by another TagHelper, then there will not be a parentExecutionContext.
            if (parentExecutionContext != null)
            {
                items = new CopyOnWriteDictionary<object, object>(
                    parentExecutionContext.Items,
                    comparer: EqualityComparer<object>.Default);
            }
            else
            {
                items = new Dictionary<object, object>();
            }

            var executionContext = _executionContextPool.Rent(
                tagName,
                tagMode,
                items,
                uniqueId,
                executeChildContentAsync);

            return executionContext;
        }
开发者ID:cjqian,项目名称:Razor,代码行数:53,代码来源:TagHelperScopeManager.cs

示例13: TagHelperBlock

        public Block TagHelperBlock(
            string tagName,
            TagMode tagMode,
            SourceLocation start,
            Block startTag,
            SyntaxTreeNode[] children,
            Block endTag)
        {
            var builder = new TagHelperBlockBuilder(
                tagName,
                tagMode,
                attributes: new List<KeyValuePair<string, SyntaxTreeNode>>(),
                children: children)
            {
                Start = start,
                SourceStartTag = startTag,
                SourceEndTag = endTag
            };

            return builder.Build();
        }
开发者ID:huoxudong125,项目名称:Razor,代码行数:21,代码来源:BlockFactory.cs

示例14: GetTagHelperOutput

        private static TagHelperOutput GetTagHelperOutput(
            string tagName,
            TagHelperAttributeList attributes,
            TagMode tagMode,
            string preElement,
            string preContent,
            string content,
            string postContent,
            string postElement)
        {
            var output = new TagHelperOutput(tagName, attributes)
            {
                TagMode = tagMode
            };

            output.PreElement.AppendEncoded(preElement);
            output.PreContent.AppendEncoded(preContent);
            output.Content.AppendEncoded(content);
            output.PostContent.AppendEncoded(postContent);
            output.PostElement.AppendEncoded(postElement);

            return output;
        }
开发者ID:4myBenefits,项目名称:Mvc,代码行数:23,代码来源:RazorPageTest.cs

示例15: PhotosSearch

        // Actual PhotoSearch function
        /// <summary>
        /// Search for photos.
        /// </summary>
        /// <param name="userId">The ID of the user to search the photos of.</param>
        /// <param name="tags">A comma seperated list of tags to search for.</param>
        /// <param name="tagMode">Match all tags, or any tag.</param>
        /// <param name="text">Text to search for in photo title or description.</param>
        /// <param name="perPage">Number of photos to return per page.</param>
        /// <param name="page">The page number to return.</param>
        /// <param name="extras">Optional extras to return.</param>
        /// <param name="minUploadDate">The minimum upload date.</param>
        /// <param name="maxUploadDate">The maxmimum upload date.</param>
        /// <param name="license">The license type to return.</param>
        /// <returns>A <see cref="Photos"/> instance.</returns>
        public Photos PhotosSearch(string userId, string tags, TagMode tagMode, string text, DateTime minUploadDate, DateTime maxUploadDate, int license, int perPage, int page, PhotoSearchExtras extras)
        {
            PhotoSearchOptions options = new PhotoSearchOptions();
            options.UserId = userId;
            options.Tags = tags;
            options.TagMode = tagMode;
            options.Text = text;
            options.MinUploadDate = minUploadDate;
            options.MaxUploadDate = maxUploadDate;
            if( license > 0 ) options.AddLicense(license);
            options.PerPage = perPage;
            options.Page = page;
            options.Extras = extras;

            return PhotosSearch(options);
        }
开发者ID:mono,项目名称:flickr-sharp,代码行数:31,代码来源:Flickr.cs


注:本文中的TagMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。