SolutionExtensions.InfoBarService.OnActionItemClicked C# (CSharp) Method

OnActionItemClicked() public method

public OnActionItemClicked ( IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem ) : void
infoBarUIElement IVsInfoBarUIElement
actionItem IVsInfoBarActionItem
return void
        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);
            }
        }