コード例 #1
0
            public void Show()
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                if (Factory == null)
                {
                    return;
                }
                if (UIElement != null) // Message already shown
                {
                    return;
                }
                var textSpans = Enumerable.Empty <InfoBarTextSpan>();

                if (Text != null)
                {
                    textSpans = Text
                                .Select(x => new InfoBarTextSpan(x.Text, x.Bold, x.Italic, x.Underline));
                }
                var hyperlinks = Enumerable.Empty <InfoBarHyperlink>();

                if (Hyperlinks != null)
                {
                    hyperlinks = Hyperlinks
                                 .Select(x => new InfoBarHyperlink(x.Text, x));
                }
                var model = new InfoBarModel(textSpans, hyperlinks, Icon, true);

                UIElement = Factory.CreateInfoBar(model);
                if (UIElement != null)
                {
                    UIElement.Advise(this, out cookie);
                    VsShell.InfoBarHost?.AddInfoBar(UIElement);
                }
            }