Example #1
0
        /// <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();
        }
Example #2
0
        /// <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)
        {
            Package = package;
            Pages   = new OptionsPageViewModel[]
            {
                new GeneralViewModel(package),
                new CleaningParentViewModel(package)
                {
                    Children = new OptionsPageViewModel[]
                    {
                        new CleaningGeneralViewModel(package),
                        new CleaningFileTypesViewModel(package),
                        new CleaningVisualStudioViewModel(package),
                        new CleaningInsertViewModel(package),
                        new CleaningRemoveViewModel(package),
                        new CleaningUpdateViewModel(package)
                    }
                },
                new CollapsingViewModel(package),
                new DiggingViewModel(package),
                new FindingViewModel(package),
                new FormattingViewModel(package),
                new ProgressingViewModel(package),
                new ReorganizingParentViewModel(package)
                {
                    Children = new OptionsPageViewModel[]
                    {
                        new ReorganizingGeneralViewModel(package),
                        new ReorganizingTypesViewModel(package),
                        new ReorganizingRegionsViewModel(package)
                    }
                },
                new SwitchingViewModel(package),
                new ThirdPartyViewModel(package)
            };

            SelectedPage = Pages.Flatten().FirstOrDefault(x => x.GetType() == (initiallySelectedPageType ?? typeof(GeneralViewModel)));
        }
Example #3
0
        /// <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)
        {
            Package = package;
            Pages = new OptionsPageViewModel[]
                        {
                            new GeneralViewModel(package),
                            new CleaningParentViewModel(package)
                                {
                                    Children = new OptionsPageViewModel[]
                                    {
                                        new CleaningGeneralViewModel(package),
                                        new CleaningFileTypesViewModel(package),
                                        new CleaningVisualStudioViewModel(package),
                                        new CleaningInsertViewModel(package),
                                        new CleaningRemoveViewModel(package),
                                        new CleaningUpdateViewModel(package)
                                    }
                                },
                            new CollapsingViewModel(package),
                            new DiggingViewModel(package),
                            new FormattingViewModel(package),
                            new ProgressingViewModel(package),
                            new ReorganizingParentViewModel(package)
                            {
                                Children = new OptionsPageViewModel[]
                                {
                                    new ReorganizingGeneralViewModel(package),
                                    new ReorganizingTypesViewModel(package),
                                    new ReorganizingRegionsViewModel(package)
                                }
                            },
                            new SwitchingViewModel(package),
                            new CompatibilityViewModel(package)
                        };

            SelectedPage = Pages.Flatten().FirstOrDefault(x => x.GetType() == (initiallySelectedPageType ?? typeof(GeneralViewModel)));
        }
Example #4
0
 /// <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;
 }
Example #5
0
        /// <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),
                            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();
        }