本文整理汇总了C#中IController.GetDynamicLinkType方法的典型用法代码示例。如果您正苦于以下问题:C# IController.GetDynamicLinkType方法的具体用法?C# IController.GetDynamicLinkType怎么用?C# IController.GetDynamicLinkType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IController
的用法示例。
在下文中一共展示了IController.GetDynamicLinkType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildDynamicFromSplitIDs
private String BuildDynamicFromSplitIDs(IController controller, String linkType, String[] idsToParse)
{
StringBuilder combinedID = new StringBuilder(5); // 2 hyphens, 3 dynamic IDs, can be more or less
for (int i = 0; i < idsToParse.Length; i++)
{
combinedID.Append(componentHolder[idsToParse[i]]);
if (i < idsToParse.Length - 1)
{
combinedID.Append("-");
}
}
return controller.GetDynamicLinkType(linkType, combinedID.ToString());
}
示例2: getLink
private String getLink(IController controller, String name)
{
if (name.Contains(Delimitter))
{
Int32 index = name.IndexOf(Delimitter);
String linkType = name.Substring(0, index);
String componentId = name.Substring(index + Delimitter.Length);
if (!componentId.Contains("-"))
{
return controller.GetDynamicLinkType(linkType, componentHolder[componentId].ToString());
}
else
{
String[] idsToParse = componentId.Split('-');
// see if everything we split is an ID
bool splitOK = true;
for (int i = 0; i < idsToParse.Length; i++)
{
if (!componentHolder.ContainsKey(idsToParse[i]))
{
splitOK = false;
break;
}
}
if (!splitOK)
{
// it's possible the name itself just has a hyphen in it, check that
if (componentHolder.ContainsKey(componentId))
{
return controller.GetDynamicLinkType(linkType, componentHolder[componentId].ToString());
}
else // the difficult case, we need to try and build IDs now from the split strings
{
List<String> idList = new List<String>();
idList.AddRange(idsToParse);
bool looking = true;
while (looking)
{
int listIndex = -1;
String thisValue = "";
String nextValue = "";
bool lookingTest = false;
for (int i = 0; i < idList.Count; i++)
{
String test = idList[i];
if (!componentHolder.ContainsKey(test))
{
lookingTest = true;
// try combining this value with the next value
if (i + 1 < idList.Count)
{
thisValue = test;
nextValue = idList[i + 1];
listIndex = i;
break;
}
else // we've hit the end of the list, give up
{
lookingTest = false;
}
}
}
looking = lookingTest;
if (listIndex != -1)
{
idList[listIndex] = thisValue + "-"+ nextValue;
idList.RemoveAt(listIndex + 1);
}
}
return BuildDynamicFromSplitIDs(controller, linkType, idList.ToArray());
}
}
else // build the dynamic from the split IDs
{
return BuildDynamicFromSplitIDs(controller, linkType, idsToParse);
}
}
}
else
{
return name;
}
}