예제 #1
0
        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);
            }
        }
예제 #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);
            }
        }
예제 #4
0
        public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
        {
            var projectGuid = _vcProjectService.UnloadProject(_project);

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

            _infoBarHost.RemoveInfoBar(_infoBar);
            _infoBar.Unadvise(_cookie);
            _infoBar.Close();
        }
예제 #6
0
 /// <summary>
 /// Signals this bar that it should close.
 /// </summary>
 public void Close()
 {
     if (_element == null)
     {
         return;
     }
     _element.Close();
     _tcs.SetResult(_result);
 }
예제 #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();
            }
        }
예제 #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);
     }
 }
예제 #9
0
            public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem)
            {
                if (actionItem.Equals(s_enableItem))
                {
                    _onEnableClicked();
                }

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

                infoBarUIElement.Close();
            }
예제 #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();
            }
예제 #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();
        }
예제 #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;
                }
            }
        }
예제 #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();
            }
예제 #16
0
 protected void Close()
 {
     _infoBar?.Close();
 }
예제 #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();
            }