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")
            {
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
        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")
            {
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
        public async Task ShowDialog(ExtensionFileModel model)
        {
            var extensions = model.Extensions.SelectMany(e => e.Value);

            InstallerDialog dialog = new InstallerDialog(extensions);

            dialog.Title = "Solution specific extensions";
            dialog.NeverShowAgainForSolution = Settings.IsSolutionIgnored();

            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.IgnoreSolution(dialog.NeverShowAgainForSolution);

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            ExtensionInstaller installer = new ExtensionInstaller(_serviceProvider, _repository, _manager);
            await installer.InstallExtensions(dialog.SelectedExtensions);
        }
        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 result = dialog.ShowDialog();

                Settings.IgnoreFileType(_suggestionResult.Matches, dialog.NeverShowAgainForSolution);

                if (!result.HasValue || !result.Value)
                {
                    return;
                }

                ExtensionInstaller installer = new ExtensionInstaller(_repository, _manager);
                await installer.InstallExtensions(dialog.SelectedExtensions);
            }
            else if (context == "ignore")
            {
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
        public async Task ShowDialog(ExtensionFileModel model)
        {
            var extensions = model.Extensions.SelectMany(e => e.Value);

            InstallerDialog dialog = new InstallerDialog(extensions);
            dialog.Title = "Solution specific extensions";
            dialog.NeverShowAgainForSolution = Settings.IsSolutionIgnored();

            var result = dialog.ShowDialog();

            Settings.IgnoreSolution(dialog.NeverShowAgainForSolution);

            if (!result.HasValue || !result.Value)
                return;

            ExtensionInstaller installer = new ExtensionInstaller(_repository, _manager);
            await installer.InstallExtensions(dialog.SelectedExtensions);
        }
Esempio n. 6
0
        private async System.Threading.Tasks.Task ShowSuggestions(object sender, EventArgs e)
        {
            var dte = ServiceProvider.GetService(typeof(DTE)) as DTE2;

            SuggestionResult result;

            if (dte.ActiveDocument != null && !string.IsNullOrEmpty(dte.ActiveDocument.FullName))
            {
                string fileName = Path.GetFileName(dte.ActiveDocument.FullName);
                IEnumerable <string> fileTypes;
                result = SuggestionHandler.Instance.GetSuggestions(fileName, out fileTypes);
            }
            else
            {
                result = new SuggestionResult
                {
                    Extensions = SuggestionHandler.Instance.GetCurrentFileModel().Extensions[SuggestionFileModel.GENERAL],
                    Matches    = new string[0]
                };
            }

            if (result != null)
            {
                InstallerDialog       dialog = new InstallerDialog(result.Extensions);
                var                   hwnd   = new IntPtr(dte.MainWindow.HWnd);
                System.Windows.Window window = (System.Windows.Window)HwndSource.FromHwnd(hwnd).RootVisual;
                dialog.Owner = window;
                dialog.NeverShowAgainForSolution = Settings.IsFileTypeIgnored(result.Matches);
                var test = dialog.ShowDialog();

                Settings.IgnoreFileType(result.Matches, dialog.NeverShowAgainForSolution);

                if (!test.HasValue || !test.Value)
                {
                    return;
                }

                ExtensionInstaller installer = new ExtensionInstaller(_package, _repository, _manager);
                await installer.InstallExtensions(dialog.SelectedExtensions);
            }
        }
Esempio n. 7
0
        public async Task ShowDialog(ExtensionFileModel model)
        {
            var extensions = model.Extensions.SelectMany(e => e.Value);

            InstallerDialog dialog = new InstallerDialog(extensions);

            dialog.Title = "Solution specific extensions";
            dialog.NeverShowAgainForSolution = Settings.IsSolutionIgnored();

            var result = dialog.ShowDialog();

            Settings.IgnoreSolution(dialog.NeverShowAgainForSolution);

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            ExtensionInstaller installer = new ExtensionInstaller(_repository, _manager);
            await installer.InstallExtensions(dialog.SelectedExtensions);
        }
        private async System.Threading.Tasks.Task ShowSuggestions(object sender, EventArgs e)
        {
            var dte = ServiceProvider.GetService(typeof(DTE)) as DTE2;

            SuggestionResult result;

            if (dte.ActiveDocument != null && !string.IsNullOrEmpty(dte.ActiveDocument.FullName))
            {
                string fileName = Path.GetFileName(dte.ActiveDocument.FullName);
                IEnumerable<string> fileTypes;
                result = SuggestionHandler.Instance.GetSuggestions(fileName, out fileTypes);
            }
            else
            {
                result = new SuggestionResult
                {
                    Extensions = SuggestionHandler.Instance.GetCurrentFileModel().Extensions[SuggestionFileModel.GENERAL],
                    Matches = new string[0]
                };
            }

            if (result != null)
            {
                InstallerDialog dialog = new InstallerDialog(result.Extensions);
                var hwnd = new IntPtr(dte.MainWindow.HWnd);
                System.Windows.Window window = (System.Windows.Window)HwndSource.FromHwnd(hwnd).RootVisual;
                dialog.Owner = window;
                dialog.NeverShowAgainForSolution = Settings.IsFileTypeIgnored(result.Matches);
                var test = dialog.ShowDialog();

                Settings.IgnoreFileType(result.Matches, dialog.NeverShowAgainForSolution);

                if (!test.HasValue || !test.Value)
                    return;

                ExtensionInstaller installer = new ExtensionInstaller(_package, _repository, _manager);
                await installer.InstallExtensions(dialog.SelectedExtensions);
            }
        }
        public async Task ShowDialog(ExtensionFileModel model)
        {
            var extensions = model.Extensions.SelectMany(e => e.Value);

            InstallerDialog dialog = new InstallerDialog(extensions);
            dialog.Title = "Solution specific extensions";
            dialog.NeverShowAgainForSolution = Settings.IsSolutionIgnored();

            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.IgnoreSolution(dialog.NeverShowAgainForSolution);

            if (!result.HasValue || !result.Value)
                return;

            ExtensionInstaller installer = new ExtensionInstaller(_serviceProvider, _repository, _manager);
            await installer.InstallExtensions(dialog.SelectedExtensions);
        }
        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 result = dialog.ShowDialog();

                Settings.IgnoreFileType(_suggestionResult.Matches, dialog.NeverShowAgainForSolution);

                if (!result.HasValue || !result.Value)
                    return;

                ExtensionInstaller installer = new ExtensionInstaller(_repository, _manager);
                await installer.InstallExtensions(dialog.SelectedExtensions);
            }
            else if (context == "ignore")
            {
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }