Пример #1
0
        public override void RenderLines(EntityOmniboxResult result, InlineCollection lines)
        {
            lines.AddMatch(result.TypeMatch);

            lines.Add(" ");

            if (result.Id == null && result.ToStr == null)
            {
                lines.Add("...");
            }
            else
            {
                if (result.Id != null)
                {
                    lines.Add(result.Id.ToString());
                    lines.Add(": ");
                    if (result.Lite == null)
                    {
                        lines.Add(new Run(OmniboxMessage.NotFound.NiceToString())
                        {
                            Foreground = Brushes.Gray
                        });
                    }
                    else
                    {
                        string str = result.Lite?.ToString();
                        if (str.HasText())
                        {
                            lines.Add(str);
                        }
                    }
                }
                else
                {
                    if (result.Lite == null)
                    {
                        lines.Add("\"");
                        lines.Add(result.ToStr);
                        lines.Add("\": ");
                        lines.Add(new Run(OmniboxMessage.NotFound.NiceToString())
                        {
                            Foreground = Brushes.Gray
                        });
                    }
                    else
                    {
                        lines.Add(result.Lite.Id.ToString());
                        lines.Add(": ");
                        lines.AddMatch(result.ToStrMatch);
                    }
                }
            }
        }
Пример #2
0
        public override void RenderLines(ChartOmniboxResult result, InlineCollection lines)
        {
            lines.AddMatch(result.KeywordMatch);

            if (result.QueryNameMatch != null)
            {
                lines.Add(" ");
                lines.AddMatch(result.QueryNameMatch);
            }
            else
            {
                lines.Add(new Run(" " + OmniboxMessage.Omnibox_Query.NiceToString() + "...")
                {
                    Foreground = Brushes.LightGray
                });
            }
        }
Пример #3
0
 public override void RenderLines(DashboardOmniboxResult result, InlineCollection lines)
 {
     lines.AddMatch(result.ToStrMatch);
 }
Пример #4
0
        public override void RenderLines(DynamicQueryOmniboxResult result, InlineCollection lines)
        {
            lines.AddMatch(result.QueryNameMatch);


            foreach (var item in result.Filters)
            {
                lines.Add(" ");

                QueryToken last = null;
                if (item.QueryTokenMatches != null)
                {
                    foreach (var tokenMatch in item.QueryTokenMatches)
                    {
                        if (last != null)
                        {
                            lines.Add(".");
                        }

                        lines.AddMatch(tokenMatch);

                        last = (QueryToken)tokenMatch.Value;
                    }
                }

                if (item.QueryToken != last)
                {
                    if (last != null)
                    {
                        lines.Add(".");
                    }

                    lines.Add(new Run(item.QueryToken.Key)
                    {
                        Foreground = Brushes.Gray
                    });
                }

                if (item.CanFilter.HasText())
                {
                    lines.Add(new Run(item.CanFilter)
                    {
                        Foreground = Brushes.Red
                    });
                }
                else if (item.Operation != null)
                {
                    lines.Add(new Bold(new Run(FilterValueConverter.ToStringOperation(item.Operation.Value))));

                    if ((item.Value as string) == DynamicQueryOmniboxResultGenerator.UnknownValue)
                    {
                        lines.Add(new Run(OmniboxMessage.Unknown.NiceToString())
                        {
                            Foreground = Brushes.Red
                        });
                    }
                    else if (item.ValueMatch != null)
                    {
                        lines.AddMatch(item.ValueMatch);
                    }
                    else if (item.Syntax != null && item.Syntax.Completion == FilterSyntaxCompletion.Complete)
                    {
                        lines.Add(new Bold(new Run(DynamicQueryOmniboxResultGenerator.ToStringValue(item.Value))));
                    }
                    else
                    {
                        lines.Add(new Run(DynamicQueryOmniboxResultGenerator.ToStringValue(item.Value))
                        {
                            Foreground = Brushes.Gray
                        });
                    }
                }
            }
        }
Пример #5
0
 public override void RenderLines(UserQueryOmniboxResult result, InlineCollection lines)
 {
     lines.AddMatch(result.ToStrMatch);
 }
Пример #6
0
 public override void RenderLines(SpecialOmniboxResult result, InlineCollection lines)
 {
     lines.Add("!");
     lines.AddMatch(result.Match);
 }