Esempio n. 1
0
 public InternalsVisibleToSuggestionProvider(ProjectModelElementPresentationService presentationService)
 {
     this.presentationService = presentationService;
 }
Esempio n. 2
0
 public GenericSettingsSuggestionProvider(ProjectModelElementPresentationService presentationService)
 {
     _presentationService = presentationService;
 }
Esempio n. 3
0
        public ConfigurationSenseOptionsPage(
            [NotNull] Lifetime lifetime,
            [NotNull] OptionsSettingsSmartContext optionsSettingsSmartContext,
            IComponentContainer componentContainer,
            ProjectModelElementPresentationService presentationService,
            IUIApplication iuiApplication)
            : base(lifetime, optionsSettingsSmartContext)
        {
            var solution = componentContainer.TryGetComponent <ISolution>();

            if (solution == null)
            {
                AddHeader("To edit the list of additional configuration files you should open a solution.");
                return;
            }

            var editItemViewModelFactory = new FilesAndDirsCollectionEditItemViewModelFactory(iuiApplication.ShellLocks, presentationService);
            var buttonProviderFactory    = new FilesAndDirsButtonProviderFactory(
                lifetime,
                iuiApplication.ShellLocks,
                solution,
                editItemViewModelFactory,
                false);

            var customConfigurationFiles = new StringCollectionEditViewModel(
                lifetime,
                @"Additional configuration files. 
You don't need to add appsettings.json, web.config and app.config to the list, they're scanned by default. 
Only *.json and *.xml files are supported.",
                buttonProviderFactory,
                editItemViewModelFactory);

            using (ReadLockCookie.Create())
            {
                foreach (var x in optionsSettingsSmartContext.GetAdditionalConfigurationFiles(solution.GetId()))
                {
                    var element = solution.FindElementByPersistentID(x);
                    if (element == null)
                    {
                        continue;
                    }

                    customConfigurationFiles.AddItem(element.Name, behindValue: element);
                }
            }

            customConfigurationFiles.Items.CollectionChanged += (o, e) =>
            {
                var hashSet = new HashSet <string>();
                foreach (var item in customConfigurationFiles.Items)
                {
                    var filesAndDirsItem = (FilesAndDirsItemViewModel)item;
                    if (filesAndDirsItem.ProjectElement is IProjectFile projectFile &&
                        (projectFile.LanguageType.Is <JsonProjectFileType>() ||
                         projectFile.LanguageType.Is <XmlProjectFileType>()))
                    {
                        hashSet.Add(projectFile.GetPersistentID());
                    }
                }

                OptionsSettingsSmartContext.SaveCustomConfigurationFiles(solution.GetId(), hashSet);
            };

            AddHeader("Configuration files");
            AddCustomOption(customConfigurationFiles);
        }