本文整理汇总了C#中ItemData.ReplacePlaceholders方法的典型用法代码示例。如果您正苦于以下问题:C# ItemData.ReplacePlaceholders方法的具体用法?C# ItemData.ReplacePlaceholders怎么用?C# ItemData.ReplacePlaceholders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemData
的用法示例。
在下文中一共展示了ItemData.ReplacePlaceholders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNode
/// <summary>
/// Add node to hierarchy where root collection are nodes relating to groups[0]. If groups is empty, all nodes are added to root collection.
/// </summary>
/// <param name="parent"></param>
/// <param name="groups"></param>
/// <param name="currentGroup"></param>
/// <param name="node"></param>
private void AddNode(DataNode parent, int currentGroup, TemplateNode template, ItemData item)
{
if (currentGroup >= template.GroupBy.Count)
{
// add node to bottom level
DataNode node = new DataNode();
node.DerivedFrom = template;
node.Parent = parent;
parent.Children.Add(node);
node.ID = item.Id;
node.Data = item.Data;
node.Text = item.ReplacePlaceholders (template.Text);
//node.IsMatch = results.Contains(item.Id); // TODO
}
else
{
// add group node if it doesn't already exist and recurse
var field = item.Subject[template.GroupBy[currentGroup].FieldSourceName];
var format = (!String.IsNullOrEmpty(field.DisplayFormat) ? String.Concat("{0:", field.DisplayFormat, "}") : "{0}");
var groupName = String.Format(format, (item.Data[field] ?? ""));
var groupNode = parent.Children.Find(n => n.Text.Equals(groupName));
if (groupNode == null)
{
groupNode = new DataNode();
groupNode.DerivedFrom = template;
groupNode.Parent = parent;
parent.Children.Add(groupNode);
groupNode.GroupIndex = currentGroup;
//node.ID = item.Id;
//node.Data = item.Data;
groupNode.Text = groupName;
}
AddNode(groupNode, currentGroup + 1, template, item);
}
}