本文整理汇总了C#中IContent.Has方法的典型用法代码示例。如果您正苦于以下问题:C# IContent.Has方法的具体用法?C# IContent.Has怎么用?C# IContent.Has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContent
的用法示例。
在下文中一共展示了IContent.Has方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTextDirection
public static string GetTextDirection(this WorkContext workContext, IContent content) {
var culture = workContext.CurrentSite.SiteCulture;
if (content != null && content.Has<ILocalizableAspect>()) {
culture = content.As<ILocalizableAspect>().Culture ?? culture;
}
return CultureInfo.GetCultureInfo(culture).TextInfo.IsRightToLeft ? "rtl" : "ltr"; ;
}
示例2: GetContentItemNode
private TreeNode GetContentItemNode(IContent item) {
return new TreeNode {
Title = _contentManager.GetItemMetadata(item).DisplayText,
Type = "content-item-" + item.Id,
Id = item.Id.ToString(CultureInfo.InvariantCulture),
Url = _url.ItemEditUrl(item),
IsLeaf = !item.Has<ContainerPart>()
};
}
示例3: GetThreadPart
public static ThreadPart GetThreadPart(IContent content) {
return content.Has<ThreadPart>() ? content.As<ThreadPart>() : content.As<PostPart>().ThreadPart;
}
示例4: CumulatedWatcherIds
/// <summary>
/// Combining watchers from this item and its containers
/// </summary>
private static IEnumerable<int> CumulatedWatcherIds(IContent content)
{
var watcherIds = new List<int>();
for (int i = 0; i < 3; i++) // Only going three levels up
{
if (content == null) return watcherIds;
if (content.Has<WatchablePart>())
{
watcherIds.AddRange(content.As<WatchablePart>().WatcherIds);
}
var commonPart = content.As<ICommonPart>();
if (commonPart == null) return watcherIds;
content = commonPart.Container;
}
return watcherIds;
}