本文整理汇总了C#中Item.GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Item.GetChildren方法的具体用法?C# Item.GetChildren怎么用?C# Item.GetChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item.GetChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
var psButtons = button.GetChildren();
foreach (Item psButton in psButtons)
{
var msg = Message.Parse(this, psButton["Click"]);
var scriptDb = msg.Arguments["scriptDB"];
var scriptId = msg.Arguments["script"];
if (string.IsNullOrWhiteSpace(scriptDb) || string.IsNullOrWhiteSpace(scriptId))
{
continue;
}
var scriptItem = Factory.GetDatabase(scriptDb).GetItem(scriptId);
if (scriptItem == null || !RulesUtils.EvaluateRules(scriptItem["ShowRule"], context.Items[0]))
{
continue;
}
RenderLargeButton(output, ribbon, Control.GetUniqueID("script"),
Translate.Text(scriptItem.DisplayName),
scriptItem["__Icon"], string.Empty,
psButton["Click"],
RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.Items[0]),
false, context);
return;
}
}
示例2: ProcessChildren
/// <summary>
/// Processes the children.
/// </summary>
/// <param name="rootItem">The root item.</param>
/// <param name="itemsRedirectsList">The items redirects list.</param>
/// <param name="sectionsRedirectList">The sections redirect list.</param>
/// <param name="regExList">The reg ex list.</param>
/// <param name="itemsRedirectsListOut">The items redirects list out.</param>
/// <param name="sectionsRedirectListOut">The sections redirect list out.</param>
/// <param name="regExListOut">The reg ex list out.</param>
private static void ProcessChildren(Item rootItem,
List<RedirectItem> itemsRedirectsList,
List<RedirectItem> sectionsRedirectList,
List<RegExItem> regExList,
out List<RedirectItem> itemsRedirectsListOut,
out List<RedirectItem> sectionsRedirectListOut,
out List<RegExItem> regExListOut)
{
itemsRedirectsListOut = itemsRedirectsList;
sectionsRedirectListOut = sectionsRedirectList;
regExListOut = regExList;
foreach (var item in rootItem.GetChildren().ToArray())
{
if (!item.Publishing.IsPublishable(System.DateTime.Now, true))
{
continue;
}
List<RedirectItem> bufItemsRedirectsList;
List<RedirectItem> bufSectionsRedirectList;
List<RegExItem> bufRegExRedirectList;
CheckRedirectType(item, out bufItemsRedirectsList, out bufSectionsRedirectList, out bufRegExRedirectList);
if (bufItemsRedirectsList != null)
{
itemsRedirectsListOut.AddRange(bufItemsRedirectsList);
}
if (bufSectionsRedirectList != null)
{
sectionsRedirectListOut.AddRange(bufSectionsRedirectList);
}
if (bufRegExRedirectList != null)
{
regExListOut.AddRange(bufRegExRedirectList);
}
ProcessChildren(item, itemsRedirectsList, sectionsRedirectList, regExList, out itemsRedirectsList, out sectionsRedirectList, out regExList);
}
}
示例3: ProcessItem
/// <summary>
/// Adds items to the collection based on the search criteria
/// </summary>
/// <param name="items">The collection to add items to</param>
/// <param name="current">The current item</param>
/// <param name="templateId">Template filter</param>
/// <param name="branchId">Branch filter</param>
/// <param name="start">Indicates if the item is the start item</param>
protected virtual void ProcessItem(ItemCollection items, Item current, ID templateId, ID branchId, bool start)
{
if (!start)
{
var include = IncludeItem(current, templateId, branchId);
if (include)
items.Add(current);
}
if (Recursive || start)
{
// process each child
ChildList children = current.GetChildren();
for (int i = 0; i < children.Count; i++)
{
ProcessItem(items, children[i], templateId, branchId, false);
}
}
}