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

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

            _infoBarHost.RemoveInfoBar(_infoBar);
            _infoBar.Unadvise(_cookie);
            _infoBar.Close();
        }
예제 #4
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     if (_InfoBarUI != null)
     {
         _InfoBarUI.Unadvise(_Cookie);
     }
 }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #8
0
 /// <inheritdoc/>
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     this.isInfoBarOpen = false;
     infoBarUIElement.Unadvise(this.uiCookie);
 }
예제 #9
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_adviseCookie);
     _infoBar = null;
 }
예제 #10
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     infoBarUIElement.Unadvise(cookie);
 }
예제 #12
0
 public void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
예제 #13
0
 /// <summary>
 /// Called when the bar has been closed.
 /// </summary>
 /// <param name="infoBarUIElement"></param>
 protected virtual void OnClosed(IVsInfoBarUIElement infoBarUIElement)
 {
     infoBarUIElement.Unadvise(_cookie);
 }
예제 #14
0
        public void OnClosed(IVsInfoBarUIElement infoBarUiElement)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

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