/// <summary> /// Initializes a new instance of the <see cref="OptionsViewModel" /> class. /// </summary> /// <param name="package">The hosting package.</param> /// <param name="initiallySelectedPageType">The type of the initially selected page.</param> public OptionsViewModel(CodeMaidPackage package, Type initiallySelectedPageType = null) { _settingsContextHelper = SettingsContextHelper.GetInstance(package); ActiveSettings = (Settings)SettingsBase.Synchronized(new Settings()); IsActiveSolutionSpecificSettings = _settingsContextHelper.LoadSolutionSpecificSettings(ActiveSettings); Package = package; Pages = new OptionsPageViewModel[] { new GeneralViewModel(package, ActiveSettings) { Children = new OptionsPageViewModel[] { new FeaturesViewModel(package, ActiveSettings) } }, new CleaningParentViewModel(package, ActiveSettings) { Children = new OptionsPageViewModel[] { new CleaningGeneralViewModel(package, ActiveSettings), new CleaningFileTypesViewModel(package, ActiveSettings), new CleaningVisualStudioViewModel(package, ActiveSettings), new CleaningInsertViewModel(package, ActiveSettings), new CleaningRemoveViewModel(package, ActiveSettings), new CleaningUpdateViewModel(package, ActiveSettings) } }, new CollapsingViewModel(package, ActiveSettings), new DiggingViewModel(package, ActiveSettings), new FindingViewModel(package, ActiveSettings), new FormattingViewModel(package, ActiveSettings), new ProgressingViewModel(package, ActiveSettings), new ReorganizingParentViewModel(package, ActiveSettings) { Children = new OptionsPageViewModel[] { new ReorganizingGeneralViewModel(package, ActiveSettings), new ReorganizingTypesViewModel(package, ActiveSettings), new ReorganizingRegionsViewModel(package, ActiveSettings) } }, new SwitchingViewModel(package, ActiveSettings), new ThirdPartyViewModel(package, ActiveSettings) }; SelectedPage = Pages.Flatten().FirstOrDefault(x => x.GetType() == (initiallySelectedPageType ?? typeof(GeneralViewModel))); ReloadPagesFromSettings(); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsToOptionsList"/> class. /// </summary> /// <param name="activeSettings">The active settings.</param> /// <param name="optionsPageViewModel">The options page view model.</param> public SettingsToOptionsList(Settings activeSettings, OptionsPageViewModel optionsPageViewModel) { ActiveSettings = activeSettings; OptionsPageViewModel = optionsPageViewModel; }