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")
            {
                var props = new Dictionary <string, string> {
                    { "matches", string.Join(", ", _suggestionResult.Matches) }
                };
                infoBarUIElement.Close();
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
Esempio n. 2
0
 public void HideInfoBar()
 {
     if (_currentInfoBar != null && TryGetInfoBarData(out var _))
     {
         _currentInfoBar.Close();
     }
 }
        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")
            {
                var props = new Dictionary<string, string> { { "matches", string.Join(", ", _suggestionResult.Matches) } };
                infoBarUIElement.Close();
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
Esempio n. 4
0
        public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
        {
            var projectGuid = _vcProjectService.UnloadProject(_project);

            _vcProjectService.ReloadProject(projectGuid);
            ThreadHelper.ThrowIfNotOnUIThread();
            infoBarUIElement.Close();
        }
Esempio n. 5
0
        public void Dispose()
        {
            VsAppShell.Current.AssertIsOnMainThread();

            _infoBarHost.RemoveInfoBar(_infoBar);
            _infoBar.Unadvise(_cookie);
            _infoBar.Close();
        }
Esempio n. 6
0
 /// <summary>
 /// Signals this bar that it should close.
 /// </summary>
 public void Close()
 {
     if (_element == null)
     {
         return;
     }
     _element.Close();
     _tcs.SetResult(_result);
 }
Esempio n. 7
0
        public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
        {
            var item = _infoBarActions.FirstOrDefault(i => i.Title == actionItem.Text);

            if (item != null)
            {
                _resulTaskCompletionSource.SetResult(item.Type);
                infoBarUIElement.Close();
            }
        }
Esempio n. 8
0
 public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
 {
     try
     {
         ProjectService.Reload(_serviceProvider, _project);
         infoBarUIElement.Close();
     }
     catch (System.Exception ex)
     {
         System.Diagnostics.Debug.Write(ex);
     }
 }
Esempio n. 9
0
            public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
            {
                if (actionItem.Equals(s_enableItem))
                {
                    _onEnableClicked();
                }

                if (actionItem.Equals(s_enableAndIgnoreItem))
                {
                    _onEnableAndIgnoreClicked();
                }

                infoBarUIElement.Close();
            }
Esempio n. 10
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;
            }
        }
            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();
            }
Esempio n. 12
0
        public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
        {
            string context = actionItem.ActionContext as string;

            switch (context)
            {
            case "New": {
                Process.Start("https://github.com/wmjordan/Codist/releases");
                break;
            }

            case "More":
                Process.Start("https://github.com/wmjordan/Codist");
                break;

            case "Close": break;
            }
            _InfoBarUI.Close();
        }
Esempio n. 13
0
        public void CloseInfoBar()
        {
            if (element != null)
            {
                var shell = _serviceProvider.GetService(typeof(SVsShell)) as IVsShell;
                if (shell != null)
                {
                    shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var obj);
                    var host = (IVsInfoBarHost)obj;

                    if (host == null)
                    {
                        return;
                    }
                    element.Close();
                    host.RemoveInfoBar(element);
                    element = null;
                }
            }
        }
Esempio n. 14
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;
            }
        }
            public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
            {
                if (actionItem.Equals(s_enableItem))
                {
                    _onEnableClicked?.Invoke();
                }

                if (actionItem.Equals(s_enableAndIgnoreItem))
                {
                    _onEnableAndIgnoreClicked?.Invoke();
                }

                infoBarUIElement.Close();
            }
Esempio n. 16
0
 protected void Close()
 {
     _infoBar?.Close();
 }
Esempio n. 17
0
 public void Dispose()
 {
     _infoBar?.Close();
     _idleManager.OnIdle -= OnIdle;
     _idleManager.Dispose();
 }
            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();
            }