public IInfoBar AttachInfoBar(Guid toolWindowGuid, string message, SonarLintImageMoniker imageMoniker) { if (string.IsNullOrWhiteSpace(message)) { throw new ArgumentNullException(nameof(message)); } return(AttachInfoBarImpl(toolWindowGuid, message, null, imageMoniker)); }
public ConfigurableInfoBar(string message, SonarLintImageMoniker imageMoniker) { message.Should().NotBeNull("Message is null"); imageMoniker.Should().NotBeNull("image moniker is null"); this.Message = message; this.ButtonText = null; this.Image = imageMoniker; }
IInfoBar IInfoBarManager.AttachInfoBar(Guid toolWindowGuid, string message, SonarLintImageMoniker imageMoniker) { this.attached.Should().NotContainKey(toolWindowGuid, "Info bar is already attached to tool window {0}", toolWindowGuid); var infoBar = new ConfigurableInfoBar(message, imageMoniker); this.attached[toolWindowGuid] = infoBar; return(infoBar); }
private static InfoBarModel CreateModel(string message, string buttonText, SonarLintImageMoniker imageMoniker) { var vsImageMoniker = new ImageMoniker { Guid = imageMoniker.Guid, Id = imageMoniker.Id }; return(new InfoBarModel(message, actionItems: buttonText != null ? new[] { new InfoBarButton(buttonText) } : new IVsInfoBarActionItem[0], image: vsImageMoniker, isCloseButtonVisible: true)); }
private IInfoBar AttachInfoBarImpl(Guid toolWindowGuid, string message, string buttonText, SonarLintImageMoniker imageMoniker) { ThreadHelper.ThrowIfNotOnUIThread(); IVsUIShell shell = serviceProvider.GetService <SVsUIShell, IVsUIShell>(); IVsWindowFrame frame = GetToolWindowFrame(shell, toolWindowGuid); InfoBarModel model = CreateModel(message, buttonText, imageMoniker); IVsInfoBarUIFactory infoBarUIFactory = serviceProvider.GetService <SVsInfoBarUIFactory, IVsInfoBarUIFactory>(); IVsInfoBarUIElement uiElement; if (TryCreateInfoBarUI(infoBarUIFactory, model, out uiElement) && TryAddInfoBarToFrame(frame, uiElement)) { return(new PrivateInfoBarWrapper(frame, uiElement)); } return(null); }