本文整理汇总了C#中TagMode类的典型用法代码示例。如果您正苦于以下问题:C# TagMode类的具体用法?C# TagMode怎么用?C# TagMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagMode类属于命名空间,在下文中一共展示了TagMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: RenderBeginTagHelperScope
private void RenderBeginTagHelperScope(string tagName, TagMode tagMode, IList<Chunk> children)
{
// Scopes/execution contexts are a runtime feature.
if (_designTimeMode)
{
// Render all of the tag helper children inline for IntelliSense.
_bodyVisitor.Accept(children);
return;
}
// Call into the tag helper scope manager to start a new tag helper scope.
// Also capture the value as the current execution context.
_writer
.WriteStartAssignment(ExecutionContextVariableName)
.WriteStartInstanceMethodInvocation(
ScopeManagerVariableName,
_tagHelperContext.ScopeManagerBeginMethodName);
// Assign a unique ID for this instance of the source HTML tag. This must be unique
// per call site, e.g. if the tag is on the view twice, there should be two IDs.
_writer.WriteStringLiteral(tagName)
.WriteParameterSeparator()
.Write("global::")
.Write(typeof(TagMode).FullName)
.Write(".")
.Write(tagMode.ToString())
.WriteParameterSeparator()
.WriteStringLiteral(GenerateUniqueId())
.WriteParameterSeparator();
// We remove the target writer so TagHelper authors can retrieve content.
var oldWriter = _context.TargetWriterName;
_context.TargetWriterName = null;
using (_writer.BuildAsyncLambda(endLine: false))
{
// Render all of the tag helper children.
_bodyVisitor.Accept(children);
}
_context.TargetWriterName = oldWriter;
_writer.WriteEndMethodInvocation();
}
开发者ID:cjqian,项目名称:Razor,代码行数:44,代码来源:CSharpTagHelperCodeRenderer.cs
示例17: Rent
public TagHelperExecutionContext Rent(
string tagName,
TagMode tagMode,
IDictionary<object, object> items,
string uniqueId,
Func<Task> executeChildContentAsync)
{
TagHelperExecutionContext tagHelperExecutionContext;
if (_nextIndex == _executionContexts.Count)
{
tagHelperExecutionContext = new TagHelperExecutionContext(
tagName,
tagMode,
items,
uniqueId,
executeChildContentAsync,
_startTagHelperWritingScope,
_endTagHelperWritingScope);
_executionContexts.Add(tagHelperExecutionContext);
}
else
{
tagHelperExecutionContext = _executionContexts[_nextIndex];
tagHelperExecutionContext.Reinitialize(tagName, tagMode, items, uniqueId, executeChildContentAsync);
}
_nextIndex++;
return tagHelperExecutionContext;
}
开发者ID:cjqian,项目名称:Razor,代码行数:32,代码来源:TagHelperScopeManager.cs
示例18: PlacesPlacesForTags
public PlaceCollection PlacesPlacesForTags(string woeId, IEnumerable<string> tags, TagMode tagMode)
{
return PlacesPlacesForTags(PlaceType.None, woeId, null, null, tags, tagMode, null, MachineTagMode.None, null, null, null, null);
}
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:4,代码来源:FlickrNetSync.cs
示例19: RunAsync_SetsTagHelperOutputTagMode
public async Task RunAsync_SetsTagHelperOutputTagMode(TagMode tagMode)
{
// Arrange
var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", tagMode);
var tagHelper = new TagHelperContextTouchingTagHelper();
executionContext.Add(tagHelper);
executionContext.AddTagHelperAttribute("foo", true);
// Act
var output = await runner.RunAsync(executionContext);
// Assert
Assert.Equal(tagMode, output.TagMode);
}
开发者ID:rahulchrty,项目名称:Razor,代码行数:16,代码来源:TagHelperRunnerTest.cs
示例20: SwitchMode
/// <summary>
/// Switch the mode of a particular Tag to a mode.
/// Valid Mode are <see cref="TagMode.Seamless"/> and <see cref="TagMode.Manual"/>
/// </summary>
/// <param name="name">The name of the tag to switch</param>
/// <param name="mode">The mode to switch to</param>
/// <exception cref="ArgumentOutOfRangeException">If the TagMode Specified is not a valid TagMode</exception>
/// <exception cref="UnhandledException">Unhandled Exception</exception>
/// <returns>true if the mode can be switch.</returns>
public bool SwitchMode(string name, TagMode mode)
{
try
{
switch (mode)
{
case TagMode.Seamless: MonitorTag(name, true);
break;
case TagMode.Manual: MonitorTag(name, false);
break;
default:
throw new ArgumentOutOfRangeException("mode");
}
return true;
}
catch (ArgumentOutOfRangeException)
{
throw;
}
catch (Exception e)
{
//Handle some unexpected exception so that it does not hang the UI.
ServiceLocator.GetLogger(ServiceLocator.DEBUG_LOG).Write(e);
throw new UnhandledException(e);
}
}
开发者ID:sr3dna,项目名称:big5sync,代码行数:35,代码来源:SystemLogicLayer.cs
注:本文中的TagMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论