public async void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { string context = actionItem.ActionContext; if (context == "install") { InstallerDialog dialog = new InstallerDialog(_suggestionResult.Extensions); dialog.NeverShowAgainForSolution = Settings.IsFileTypeIgnored(_suggestionResult.Matches); var dte = _serviceProvider.GetService(typeof(DTE)) as DTE2; var hwnd = new IntPtr(dte.MainWindow.HWnd); System.Windows.Window window = (System.Windows.Window)HwndSource.FromHwnd(hwnd).RootVisual; dialog.Owner = window; var result = dialog.ShowDialog(); Settings.IgnoreFileType(_suggestionResult.Matches, dialog.NeverShowAgainForSolution); if (!result.HasValue || !result.Value) return; ExtensionInstaller installer = new ExtensionInstaller(_serviceProvider, _repository, _manager); await installer.InstallExtensions(dialog.SelectedExtensions); } else if (context == "ignore") { Settings.IgnoreFileType(_suggestionResult.Matches, true); } }
private bool TryCreateInfoBarUI(IVsInfoBar infoBar, out IVsInfoBarUIElement uiElement) { IVsInfoBarUIFactory infoBarUIFactory = (_provider.GetService(typeof(SVsInfoBarUIFactory)) as IVsInfoBarUIFactory); if (infoBarUIFactory == null) { uiElement = null; return false; } uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return uiElement != null; }
public async void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { string context = actionItem.ActionContext; if (context == "install") { InstallerDialog dialog = new InstallerDialog(_suggestionResult.Extensions); dialog.NeverShowAgainForSolution = Settings.IsFileTypeIgnored(_suggestionResult.Matches); var result = dialog.ShowDialog(); Settings.IgnoreFileType(_suggestionResult.Matches, dialog.NeverShowAgainForSolution); if (!result.HasValue || !result.Value) return; ExtensionInstaller installer = new ExtensionInstaller(_repository, _manager); await installer.InstallExtensions(dialog.SelectedExtensions); } else if (context == "ignore") { Settings.IgnoreFileType(_suggestionResult.Matches, true); } }
public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { if (actionItem.Equals(s_enableItem)) { _onEnableClicked?.Invoke(); } if (actionItem.Equals(s_enableAndIgnoreItem)) { _onEnableAndIgnoreClicked?.Invoke(); } infoBarUIElement.Close(); }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { infoBarUIElement.Unadvise(_cookie); }
public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { if (actionItem.Equals(_customizeInfoBarButton)) { var optionsCommand = new CommandID( VSConstants.GUID_VSStandardCommandSet97, VSConstants.cmdidToolsOptions); var menuCommandService = _provider.GetService(typeof(IMenuCommandService)) as MenuCommandService; string intelliSenseOptionsGuidString = typeof(NodejsIntellisenseOptionsPage).GUID.ToString(); menuCommandService.GlobalInvoke(optionsCommand, intelliSenseOptionsGuidString); } else if (actionItem.Equals(_typingsFolderHyperlink)) { Process.Start("http://go.microsoft.com/fwlink/?LinkID=808345"); } }
void IVsInfoBarUIEvents.OnActionItemClicked(IVsInfoBarUIElement uiElement, IVsInfoBarActionItem actionItem) { this.ButtonClick?.Invoke(this, EventArgs.Empty); }
private static bool TryCreateInfoBarUI(IServiceProvider serviceProvider, IVsInfoBar infoBar, out IVsInfoBarUIElement uiElement) { Debug.Assert(serviceProvider != null); Debug.Assert(infoBar != null); IVsInfoBarUIFactory infoBarUIFactory = serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) as IVsInfoBarUIFactory; if (infoBarUIFactory == null) { uiElement = null; return false; } uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return uiElement != null; }
void IVsInfoBarUIEvents.OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { this.ButtonClick?.Invoke(this, EventArgs.Empty); }
private static bool TryCreateInfoBarUI(IVsInfoBarUIFactory infoBarUIFactory, IVsInfoBar infoBar, out IVsInfoBarUIElement uiElement) { Debug.Assert(infoBar != null); if (infoBarUIFactory == null) { uiElement = null; return(false); } uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return(uiElement != null); }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { _isVisible = false; return; }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { // User does not want to reload now... }
public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) => (actionItem.ActionContext as Action)?.Invoke();
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) => this.OnClose();
public static void Show(NodejsProjectNode projectNode) { var serviceProvider = projectNode.Site; serviceProvider.GetUIThread().MustBeCalledFromUIThread(); var vsShell = (IVsShell)serviceProvider.GetService(typeof(SVsShell)); var infoBarUIFactory = (IVsInfoBarUIFactory)serviceProvider.GetService(typeof(SVsInfoBarUIFactory)); if (ErrorHandler.Failed(vsShell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var tmp))) { // we don't want to crash just because we can't show the error bar return; } var infoBarHost = (IVsInfoBarHost)tmp; // make sure we close the previous infobar CurrentInfoBarElement?.Close(); Action downloadNode = DownloadNode; Action openProjectProps = ShowProjectProperties; var actionItems = new[] { new InfoBarHyperlink(Resources.ConfigureProjectProperties, openProjectProps), new InfoBarHyperlink(Resources.DownloadNodejs, downloadNode), }; var infoBarModel = new InfoBarModel(Resources.NodejsNotInstalledInfoBar, actionItems, isCloseButtonVisible: true, image: KnownMonikers.StatusError); uint eventCookie = 0; CurrentInfoBarElement = infoBarUIFactory.CreateInfoBar(infoBarModel); CurrentInfoBarElement.Advise(new InfoBarUIEvents(OnClose), out eventCookie); infoBarHost.AddInfoBar(CurrentInfoBarElement); void OnClose() { CurrentInfoBarElement.Unadvise(eventCookie); } void DownloadNode() { const string url = @"https://aka.ms/downloadnode"; VsShellUtilities.OpenBrowser(url, (uint)__VSOSPFLAGS.OSP_LaunchNewBrowser); } void ShowProjectProperties() { // open Project Properties var logicalView = VSConstants.LOGVIEWID_Primary; if (ErrorHandler.Succeeded(projectNode.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int)VsHierarchyPropID.ProjectDesignerEditor, out var editorType)) && ErrorHandler.Succeeded(projectNode.OpenItemWithSpecific(VSConstants.VSITEMID_ROOT, 0, ref editorType, "", ref logicalView, (IntPtr)(-1), out var frame))) { frame?.Show(); } } }
private static bool TryCreateInfoBarUI(IServiceProvider serviceProvider, IVsInfoBar infoBar, out IVsInfoBarUIElement uiElement) { Debug.Assert(serviceProvider != null); Debug.Assert(infoBar != null); IVsInfoBarUIFactory infoBarUIFactory = serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) as IVsInfoBarUIFactory; if (infoBarUIFactory == null) { uiElement = null; return(false); } uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return(uiElement != null); }
private void AddInfoBar() { Action showHelp = () => Process.Start(UrlConstants.HelpUrl); var messages = new List<IVsInfoBarTextSpan>(); var actions = new List<InfoBarActionItem>(); messages.Add(new InfoBarTextSpan(Strings.InfoBarMessage)); actions.Add(new InfoBarHyperlink(Strings.InfoBarMessageLink, showHelp)); _infoBarModel = new InfoBarModel(messages, actions, KnownMonikers.StatusInformation, isCloseButtonVisible: true); _infoBar = _infoBarFactory.CreateInfoBar(_infoBarModel); AddInfoBar(_infoBar); _infoBar.Advise(this, out _infoBarAdviseCookie); }
protected virtual void OnInfoBarClosed(IVsInfoBarUIElement e) { InfoBarClosed?.Invoke(this, e); }
public PrivateInfoBarWrapper(IVsWindowFrame frame, IVsInfoBarUIElement uiElement) { Debug.Assert(frame != null); Debug.Assert(uiElement != null); this.InfoBarUIElement = uiElement; this.Frame = frame; this.Frame.ShowNoActivate(); this.Advise(); }
private static bool TryCreateInfoBarUI(IVsInfoBar infoBar, IVsInfoBarUIFactory infoBarUIFactory, out IVsInfoBarUIElement uiElement) { uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return(uiElement != null); }
void IVsInfoBarUIEvents.OnClosed(IVsInfoBarUIElement uiElement) { this.Unadvise(); this.isClosed = true; this.Closed?.Invoke(this, EventArgs.Empty); }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { infoBarUIElement.Unadvise(_adviseCookie); _infoBar = null; }
public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { var item = _items.FirstOrDefault(i => i.Title == actionItem.Text); if (item.IsDefault) { return; } item.Action?.Invoke(); if (!item.CloseAfterAction) { return; } infoBarUIElement.Close(); }
public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { ((Action)actionItem.ActionContext)(); }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { onClosed(); }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { if (_infoBar != null) { if (_infoBarAdviseCookie != 0) { _infoBar.Unadvise(_infoBarAdviseCookie); _infoBarAdviseCookie = 0; } // Remember this for next time CookiecutterPackage.Instance.ShowHelp = false; RemoveInfoBar(_infoBar); _infoBar.Close(); _infoBar = null; } }
private static bool TryCreateInfoBarUI(IVsInfoBarUIFactory infoBarUIFactory, IVsInfoBar infoBar, out IVsInfoBarUIElement uiElement) { uiElement = infoBarUIFactory.CreateInfoBar(infoBar); return uiElement != null; }
public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { _onClosed(); }
/// <inheritdoc/> public void OnClosed(IVsInfoBarUIElement infoBarUIElement) { this.isInfoBarOpen = false; infoBarUIElement.Unadvise(this.uiCookie); }