当前位置: 首页>>代码示例>>C#>>正文


C# QueryToken.FullKey方法代码示例

本文整理汇总了C#中QueryToken.FullKey方法的典型用法代码示例。如果您正苦于以下问题:C# QueryToken.FullKey方法的具体用法?C# QueryToken.FullKey怎么用?C# QueryToken.FullKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryToken的用法示例。


在下文中一共展示了QueryToken.FullKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryTokenCombo

        static MvcHtmlString QueryTokenCombo(this HtmlHelper helper, QueryToken previous, QueryToken selected, int index, Context context, QueryTokenBuilderSettings settings)
        {
            if (previous != null && AllowSubTokens != null && !AllowSubTokens(previous))
                return MvcHtmlString.Create("");

            var queryTokens = previous.SubTokens(settings.QueryDescription, settings.CanAggregate);

            if (queryTokens.IsEmpty())
                return new HtmlTag("input")
                .Attr("type", "hidden")
                .IdName(context.Compose("ddlTokensEnd_" + index))
                .Attr("disabled", "disabled")
                .Attr("data-parenttoken", previous == null ? "" : previous.FullKey());

            var options = new HtmlStringBuilder();
            options.AddLine(new HtmlTag("option").Attr("value", "").SetInnerText("-").ToHtml());
            foreach (var qt in queryTokens)
            {
                var option = new HtmlTag("option")
                    .Attr("value", previous == null ? qt.FullKey() : qt.Key)
                    .SetInnerText((previous == null && qt.Parent != null ? " - " : "") + qt.ToString());

                if (selected != null && qt.Key == selected.Key)
                    option.Attr("selected", "selected");

                option.Attr("title", qt.NiceTypeName);
                option.Attr("style", "color:" + qt.TypeColor);

                if (settings.Decorators != null)
                    settings.Decorators(qt, option); 

                options.AddLine(option.ToHtml());
            }

            HtmlTag dropdown = new HtmlTag("select")
                .Class("form-control")
                .IdName(context.Compose("ddlTokens_" + index))
                .InnerHtml(options.ToHtml()) 
                .Attr("data-parenttoken", previous == null ? "" : previous.FullKey());

            if (selected != null)
            {
                dropdown.Attr("title", selected.NiceTypeName);
                dropdown.Attr("style", "color:" + selected.TypeColor);
            }

            return dropdown.ToHtml();
        }
开发者ID:nuub666,项目名称:framework,代码行数:48,代码来源:QueryTokenHelper.cs

示例2: 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(".");
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:45,代码来源:QueryTokenSynchronizer.cs

示例3: GetTokenFilters

 static FilterOption GetTokenFilters(QueryToken queryToken, object p)
 {
     return new FilterOption(queryToken.FullKey(), p);
 }
开发者ID:JackWangCUMT,项目名称:extensions,代码行数:4,代码来源:ChartRenderer.xaml.cs

示例4: SetTokens

        private void SetTokens(QueryToken token)
        {
            itemsControl.ItemsSource = token.Follow(a => a.Parent).Reverse().ToArray();

            AutomationProperties.SetName(this, token.FullKey());
        }
开发者ID:rondoo,项目名称:framework,代码行数:6,代码来源:QueryTokenRenderer.xaml.cs

示例5: QueryTokenTS

 public QueryTokenTS(QueryToken qt, bool recursive)
 {
     this.toString = qt.ToString();
     this.niceName = qt.NiceName();
     this.key = qt.Key;
     this.fullKey = qt.FullKey();
     this.type = new TypeReferenceTS(qt.Type, qt.GetImplementations());
     this.filterType = QueryUtils.TryGetFilterType(qt.Type);
     this.format = qt.Format;
     this.unit = qt.Unit;
     this.typeColor = qt.TypeColor;
     this.niceTypeName = qt.NiceTypeName;
     this.queryTokenType = GetQueryTokenType(qt);
     this.isGroupable = qt.IsGroupable;
     this.propertyRoute = qt.GetPropertyRoute()?.ToString();
     if (recursive && qt.Parent != null)
         this.parent = new QueryTokenTS(qt.Parent, recursive);
 }
开发者ID:signumsoftware,项目名称:framework,代码行数:18,代码来源:QueryController.cs


注:本文中的QueryToken.FullKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。