Example #1
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     if (_InfoBarUI != null)
     {
         _InfoBarUI.Unadvise(_Cookie);
     }
 }
Example #2
0
        public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            infoBarUIElement?.Unadvise(_cookie);
            _cookie = 0;
            _action = null;
        }
Example #3
0
        public void Dispose()
        {
            VsAppShell.Current.AssertIsOnMainThread();

            _infoBarHost.RemoveInfoBar(_infoBar);
            _infoBar.Unadvise(_cookie);
            _infoBar.Close();
        }
Example #4
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     if (_InfoBarUI != null)
     {
         _InfoBarUI.Unadvise(_Cookie);
     }
 }
Example #5
0
        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;
            }
        }
Example #6
0
        public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
        {
            var context = Convert.ToString(actionItem.ActionContext);

            switch (context)
            {
            case nameof(HyperlinkCommands.Configure):
                _ = infoBarUIElement.Unadvise(_cookie);
                var configWindow = new ConfigurationControl();
                configWindow.ShowDialog();
                break;

            case nameof(HyperlinkCommands.Later):
                _ = infoBarUIElement.Unadvise(_cookie);
                break;

            case nameof(HyperlinkCommands.No):
                NotificationService.PopMessage("Click Action", "You clicked No");
                break;

            case nameof(HyperlinkCommands.Ok):
                NotificationService.PopMessage("Click Action", "You clicked Ok");
                break;

            case nameof(HyperlinkCommands.Yes):
                NotificationService.PopMessage("Click Action", "You clicked Yes");
                break;

            default:
                //close the thingy by default
                //or throw error maybe and display to the user???

                _ = infoBarUIElement.Unadvise(_cookie);
                break;
            }
        }
Example #7
0
        public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
        {
            if (_infoBar != null)
            {
                if (_infoBarAdviseCookie != 0)
                {
                    _infoBar.Unadvise(_infoBarAdviseCookie);
                    _infoBarAdviseCookie = 0;
                }

                if (!_missingDependencies)
                {
                    // Save this for later time
                    CookiecutterPackage.Instance.ShowHelp = false;
                }

                RemoveInfoBar(_infoBar);
                _infoBar.Close();
                _infoBar = null;
            }
        }
Example #8
0
 /// <inheritdoc/>
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     this.isInfoBarOpen = false;
     infoBarUIElement.Unadvise(this.uiCookie);
 }
Example #9
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_adviseCookie);
     _infoBar = null;
 }
Example #10
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     infoBarUIElement.Unadvise(cookie);
 }
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
Example #13
0
 /// <summary>
 /// Called when the bar has been closed.
 /// </summary>
 /// <param name="infoBarUIElement"></param>
 protected virtual void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
Example #14
0
        public void OnClosed(IVsInfoBarUIElement infoBarUiElement)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            infoBarUiElement.Unadvise(_cookie);
        }
Example #15
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     this.infoBar.Close();
     uiElement.Unadvise(this.cookie);
 }
Example #16
0
        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();
                }
            }
        }