SolutionExtensions.Settings.IgnoreFileType C# (CSharp) Method

IgnoreFileType() public static method

public static IgnoreFileType ( IEnumerable fileTypes, bool ignore ) : void
fileTypes IEnumerable
ignore bool
return void
        public static void IgnoreFileType(IEnumerable<string> fileTypes, bool ignore)
        {
            WritableSettingsStore wstore = _settings.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!wstore.CollectionExists(Vsix.Name))
                wstore.CreateCollection(Vsix.Name);

            foreach (string fileType in fileTypes.Distinct())
            {
                string property = fileType.ToLowerInvariant();

                if (ignore)
                {
                    wstore.SetInt32(Vsix.Name, property, 1);
                }
                else
                {
                    wstore.DeleteProperty(Vsix.Name, property);
                }
            }
        }

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::IgnoreFileType