Пример #1
0
        public SettingsForm(IGeneralConfigService configService,
                            IMessageBox messageBox,
                            ISettingsViewModelFactory viewModelFactory,
                            SettingsViews activeView = SettingsViews.GeneralSettings)
            : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(messageBox, configService,
                                                     config,
                                                     new SettingsView
            {
                Control = new GeneralSettings(viewModelFactory.Create <Rubberduck.Settings.GeneralSettings>(config)),
                View    = SettingsViews.GeneralSettings
            },
                                                     new SettingsView
            {
                Control = new TodoSettings(viewModelFactory.Create <ToDoListSettings>(config)),
                View    = SettingsViews.TodoSettings
            },
                                                     new SettingsView
            {
                Control = new InspectionSettings(viewModelFactory.Create <CodeInspectionSettings>(config)),
                View    = SettingsViews.InspectionSettings
            },
                                                     new SettingsView
            {
                Control = new UnitTestSettings(viewModelFactory.Create <Rubberduck.UnitTesting.Settings.UnitTestSettings>(config)),
                View    = SettingsViews.UnitTestSettings
            },
                                                     new SettingsView
            {
                Control = new IndenterSettings(viewModelFactory.Create <SmartIndenter.IndenterSettings>(config)),
                View    = SettingsViews.IndenterSettings
            },
                                                     new SettingsView
            {
                Control = new AutoCompleteSettings(viewModelFactory.Create <Rubberduck.Settings.AutoCompleteSettings>(config)),
                View    = SettingsViews.AutoCompleteSettings
            },
                                                     new SettingsView
            {
                Control = new WindowSettings(viewModelFactory.Create <Rubberduck.Settings.WindowSettings>(config)),
                View    = SettingsViews.WindowSettings
            },
                                                     new SettingsView
            {
                Control = new AddRemoveReferencesUserSettings(viewModelFactory.Create <ReferenceSettings>()),
                View    = SettingsViews.ReferenceSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }
Пример #2
0
        public void ShowSettings()
        {
            var viewModel = _settingsFactory.Create();

            _windowManager.ShowDialog(viewModel);
        }