SolutionExtensions.Settings.IsFileTypeIgnored C# (CSharp) Method

IsFileTypeIgnored() public static method

public static IsFileTypeIgnored ( IEnumerable fileTypes ) : bool
fileTypes IEnumerable
return bool
        public static bool IsFileTypeIgnored(IEnumerable<string> fileTypes)
        {
            SettingsStore store = _settings.GetReadOnlySettingsStore(SettingsScope.UserSettings);

            foreach (string fileType in fileTypes.Where(f => !string.IsNullOrEmpty(f)))
            {
                if (store.PropertyExists(Vsix.Name, fileType.ToLowerInvariant()))
                    return true;
            }

            return false;
        }

Usage Example

コード例 #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);
            }
        }
All Usage Examples Of SolutionExtensions.Settings::IsFileTypeIgnored