IsFileTypeIgnored() public static method

public static IsFileTypeIgnored ( IEnumerable fileTypes ) : bool
fileTypes IEnumerable
return bool
コード例 #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")
            {
                Settings.IgnoreFileType(_suggestionResult.Matches, true);
            }
        }
コード例 #2
0
        public void ShowInfoBar(SuggestionResult result, string fileType)
        {
            if (Settings.IsFileTypeIgnored(result.Matches))
            {
                return;
            }

            _fileType = fileType;
            int count = result.Extensions.Count(e => e.Category != SuggestionFileModel.GENERAL);

            var host = GetInfoBarHost();

            if (host != null)
            {
                string matches = string.Join(", ", result.Matches);
                string message = $"{count} extensions supporting {matches} files are found";

                if (result.Extensions.Count() == 1)
                {
                    message = $"{count} extension supporting {matches} files is found";
                }

                _suggestionResult = result;
                CreateInfoBar(host, message);
            }
        }
コード例 #3
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 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);
            }
        }
コード例 #4
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);
            }
        }