本文整理汇总了C#中Path.SubPath方法的典型用法代码示例。如果您正苦于以下问题:C# Path.SubPath方法的具体用法?C# Path.SubPath怎么用?C# Path.SubPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path.SubPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertNode
/// <summary>
/// Insert a node to the proper depth using the path.
/// </summary>
public void InsertNode(FolderConfigurationNodeBase node, Path path)
{
// There is no recommended path. Add it immediately
if (path == null || path.Segments.Count == 0)
{
AddChildNode(node);
return;
}
var text = CollectionUtils.FirstElement(path.Segments).LocalizedText;
var childWithMatchingText = _subTree == null ? null : CollectionUtils.SelectFirst(_subTree.Items, child => child.Text == text);
if (childWithMatchingText == null)
{
if (path.Segments.Count == 1)
{
// There are no more depth to the path, add child now.
AddChildNode(node);
PropagateCheckStateUp(node.Parent);
}
else
{
// create a container node and insert into the container node's subtree
var containerNode = new ContainerNode(text);
AddChildNode(containerNode);
containerNode.InsertNode(node, path.SubPath(1, path.Segments.Count - 1));
}
}
else
{
if (path.Segments.Count == 1)
{
// There are no more depth to the path, add child now.
if (childWithMatchingText is ContainerNode)
ReplaceChildNode(childWithMatchingText, node);
else
AddChildNode(node);
PropagateCheckStateUp(node.Parent);
}
else
{
// insert this node child's subtree
childWithMatchingText.InsertNode(node, path.SubPath(1, path.Segments.Count - 1));
}
}
}
示例2: CreateLoadingPriorsAction
private static IClickAction CreateLoadingPriorsAction(ActionPlaceholder actionPlaceholder, string basePath, int number)
{
const string actionIdPrefix = "loadingPriors";
Path pathSuffix = new Path(basePath);
pathSuffix = pathSuffix.SubPath(1, pathSuffix.Segments.Count - 1);
pathSuffix = pathSuffix.Append(new PathSegment(actionIdPrefix));
string actionId = actionIdPrefix + number;
var action = actionPlaceholder.CreateMenuAction(actionId, pathSuffix.ToString(), ClickActionFlags.None, null);
action.Label = SR.LabelLoadingPriors;
action.SetClickHandler(delegate { });
return action;
}