public void ShowInsight(string funcName)
        {
            //if (!funcName.EndsWith("(")) return;
            funcName = funcName.TrimEnd('(');

            ADOTabularFunction f = Document.Connection.FunctionGroups.GetByName(funcName);

            if (f != null)
            {
                try
                {
                    Log.Verbose("Showing InsightWindow for {function}", f.Caption);
                    //var insight = _editor.InsightWindow;
                    //if (_editor.InsightWindow == null )
                    //{
                    _editor.InsightWindow = null;
                    _editor.InsightWindow = new InsightWindow(_editor.TextArea);
                    //insight.ExpectInsertionBeforeStart = true;
                    //}
                    //_editor.InsightWindow.MaxWidth = 200;

                    _editor.InsightWindow.Content = BuildInsightContent(f, 400);

                    _editor.InsightWindow.Show();
                }
                catch (Exception ex)
                {
                    Log.Error("{class} {method} {message}", "DaxIntellisenseProvider", "ShowInsight", ex.Message);
                }
            }
        }
        private UIElement BuildInsightContent(ADOTabularFunction f, int maxWidth)
        {
            var grd = new Grid();

            grd.ColumnDefinitions.Add(new ColumnDefinition()
            {
                MaxWidth = maxWidth
            });
            var tb = new TextBlock();

            tb.TextWrapping = TextWrapping.Wrap;
            var caption = new Run(f.DaxName);

            //caption.Foreground = Brushes.Blue;
            tb.Inlines.Add(new Bold(caption));
            tb.Inlines.Add("\n");
            tb.Inlines.Add(f.Description);
            //tb.Inlines.Add("\n");
            //tb.Inlines.Add(new Italic(new Run(f.DaxName)));
            var docLink = new Hyperlink();

            docLink.Inlines.Add($"https://dax.guide/{f.Caption}");
            docLink.NavigateUri      = new Uri($"https://dax.guide/{f.Caption}");
            docLink.RequestNavigate += InsightHyperLinkNavigate;
            tb.Inlines.Add("\n");
            tb.Inlines.Add(docLink);
            Grid.SetColumn(tb, 0);
            grd.Children.Add(tb);
            return(grd);
        }
Example #3
0
 public FilterableTreeViewItem(ADOTabularFunction function, GetChildrenDelegate getChildren, IGlobalOptions options, IEventAggregator eventAggregator, IMetadataPane metadataPane)
 {
     _eventAggregator = eventAggregator;
     _options         = options;
     _tabularObject   = function;
     _getChildren     = getChildren;
     MetadataPane     = metadataPane;
 }
Example #4
0
 public TreeViewFunction(ADOTabularFunction function, GetChildrenDelegate getChildren, IGlobalOptions options, IEventAggregator eventAggregator, IMetadataPane metadataPane) : base(function, getChildren, options, eventAggregator, metadataPane)
 {
     _eventAggregator = eventAggregator;
     Function         = function;
     Options          = options;
     Description      = function.Description;
     MetadataImage    = function.MetadataImage;
 }
        private UIElement BuildInsightContent(ADOTabularFunction f, int maxWidth)
        {
            var grd = new Grid();

            grd.ColumnDefinitions.Add(new ColumnDefinition()
            {
                MaxWidth = maxWidth
            });
            var tb = new TextBlock();

            tb.TextWrapping = TextWrapping.Wrap;
            var caption = new Run(f.DaxName);

            //caption.Foreground = Brushes.Blue;
            tb.Inlines.Add(new Bold(caption));
            tb.Inlines.Add("\n");
            tb.Inlines.Add(f.Description);
            //tb.Inlines.Add("\n");
            //tb.Inlines.Add(new Italic(new Run(f.DaxName)));
            Grid.SetColumn(tb, 0);
            grd.Children.Add(tb);
            return(grd);
        }