本文整理汇总了C#中QueryToken.Follow方法的典型用法代码示例。如果您正苦于以下问题:C# QueryToken.Follow方法的具体用法?C# QueryToken.Follow怎么用?C# QueryToken.Follow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryToken
的用法示例。
在下文中一共展示了QueryToken.Follow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateTokenList
private void UpdateTokenList(QueryToken queryToken)
{
if (queryToken == null)
tokens = new List<QueryToken>();
else
tokens = queryToken.Follow(a => a.Parent).Reverse().ToList();
UpdateCombo();
}
示例2: QueryTokenBuilderOptions
public static MvcHtmlString QueryTokenBuilderOptions(this HtmlHelper helper, QueryToken queryToken, Context context, QueryTokenBuilderSettings settings)
{
var tokenPath = queryToken.Follow(qt => qt.Parent).Reverse().NotNull().ToList();
HtmlStringBuilder sb = new HtmlStringBuilder();
for (int i = 0; i < tokenPath.Count; i++)
{
sb.AddLine(helper.QueryTokenCombo(i == 0 ? null : tokenPath[i - 1], tokenPath[i], i, context, settings));
}
sb.AddLine(helper.QueryTokenCombo(queryToken, null, tokenPath.Count, context, settings));
return sb.ToHtml();
}
示例3: Remember
static void Remember(Replacements replacements, string tokenString, QueryToken token)
{
List<QueryToken> tokenList = token.Follow(a => a.Parent).Reverse().ToList();
string[] oldParts = tokenString.Split('.');
string[] newParts = token.FullKey().Split('.');
List<string> oldPartsList = oldParts.ToList();
List<string> newPartsList = newParts.ToList();
Func<string, string> rep = str =>
{
if (Replacements.AutoReplacement == null)
return null;
Replacements.Selection? sel = Replacements.AutoReplacement(str, null);
if (sel == null || sel.Value.NewValue == null)
return null;
return sel.Value.NewValue;
};
int pos = -1;
while (oldPartsList.Count > 0 && newPartsList.Count > 0 &&
(oldPartsList[0] == newPartsList[0] ||
rep(oldPartsList[0]) == newPartsList[0]))
{
oldPartsList.RemoveAt(0);
newPartsList.RemoveAt(0);
pos++;
}
while (oldPartsList.Count > 0 && newPartsList.Count > 0 &&
(oldPartsList[oldPartsList.Count - 1] == newPartsList[newPartsList.Count - 1] ||
rep(oldPartsList[oldPartsList.Count - 1]) == newPartsList[newPartsList.Count - 1]))
{
oldPartsList.RemoveAt(oldPartsList.Count - 1);
newPartsList.RemoveAt(newPartsList.Count - 1);
}
string key = pos == -1 ? QueryKey(tokenList[0].QueryName) : TypeKey(tokenList[pos].Type);
replacements.GetOrCreate(key)[oldPartsList.ToString(".")] = newPartsList.ToString(".");
}
示例4: SetTokens
private void SetTokens(QueryToken token)
{
itemsControl.ItemsSource = token.Follow(a => a.Parent).Reverse().ToArray();
AutomationProperties.SetName(this, token.FullKey());
}