public GeneralSettingsViewModel(
            Configuration config,
            IOperatingSystem operatingSystem,
            IMessageBox messageBox,
            IVbeSettings vbeSettings,
            IExperimentalTypesProvider experimentalTypesProvider,
            IFilePersistanceService <Rubberduck.Settings.GeneralSettings> service,
            IFilePersistanceService <HotkeySettings> hotkeyService)
            : base(service)
        {
            _operatingSystem          = operatingSystem;
            _messageBox               = messageBox;
            _vbeSettings              = vbeSettings;
            _experimentalFeatureTypes = experimentalTypesProvider.ExperimentalTypes;

            Languages = new ObservableCollection <DisplayLanguageSetting>(Locales.AvailableCultures
                                                                          .OrderBy(locale => locale.NativeName)
                                                                          .Select(locale => new DisplayLanguageSetting(locale.Name)));

            LogLevels = new ObservableCollection <MinimumLogLevel>(
                LogLevelHelper.LogLevels.Select(l => new MinimumLogLevel(l.Ordinal, l.Name)));
            TransferSettingsToView(config.UserSettings.GeneralSettings, config.UserSettings.HotkeySettings);

            ShowLogFolderCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowLogFolder());
            ExportButtonCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ExportSettings(GetCurrentGeneralSettings()));
            ImportButtonCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ImportSettings());

            _hotkeyService = hotkeyService;
        }
Exemplo n.º 2
0
 public ReparseCommand(IVBE vbe, IConfigProvider <GeneralSettings> settingsProvider, RubberduckParserState state, IVBETypeLibsAPI typeLibApi, IVbeSettings vbeSettings, IMessageBox messageBox) : base(LogManager.GetCurrentClassLogger())
 {
     _vbe         = vbe;
     _vbeSettings = vbeSettings;
     _typeLibApi  = typeLibApi;
     _state       = state;
     _settings    = settingsProvider.Create();
     _messageBox  = messageBox;
 }
Exemplo n.º 3
0
        public ReparseCommand(
            IVBE vbe,
            IConfigurationService <GeneralSettings> settingsProvider,
            RubberduckParserState state,
            IVBETypeLibsAPI typeLibApi,
            IVbeSettings vbeSettings,
            IMessageBox messageBox,
            IVbeEvents vbeEvents)
            : base(vbeEvents)
        {
            _vbe         = vbe;
            _vbeSettings = vbeSettings;
            _typeLibApi  = typeLibApi;
            _state       = state;
            _settings    = settingsProvider.Read();
            _messageBox  = messageBox;

            AddToCanExecuteEvaluation(SpecialEvaluateCanExecute);
        }
Exemplo n.º 4
0
        public GeneralSettingsViewModel(Configuration config, IOperatingSystem operatingSystem, IMessageBox messageBox, IVbeSettings vbeSettings, IEnumerable <Type> experimentalFeatureTypes)
        {
            _operatingSystem          = operatingSystem;
            _messageBox               = messageBox;
            _vbeSettings              = vbeSettings;
            _experimentalFeatureTypes = experimentalFeatureTypes.ToList().AsReadOnly();
            Languages = new ObservableCollection <DisplayLanguageSetting>(
                new[]
            {
                new DisplayLanguageSetting("en-US"),
                new DisplayLanguageSetting("fr-CA"),
                new DisplayLanguageSetting("de-DE"),
                new DisplayLanguageSetting("cs-CZ")
            });

            LogLevels = new ObservableCollection <MinimumLogLevel>(LogLevelHelper.LogLevels.Select(l => new MinimumLogLevel(l.Ordinal, l.Name)));
            TransferSettingsToView(config.UserSettings.GeneralSettings, config.UserSettings.HotkeySettings);

            ShowLogFolderCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ShowLogFolder());
            ExportButtonCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ExportSettings());
            ImportButtonCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => ImportSettings());
        }
Exemplo n.º 5
0
        public SettingsForm(IGeneralConfigService configService,
                            IOperatingSystem operatingSystem,
                            IMessageBox messageBox,
                            IVbeSettings vbeSettings,
                            IConfigProvider <ReferenceSettings> referencesProvider,
                            IFileSystemBrowserFactory browserFactory,
                            SettingsViews activeView = SettingsViews.GeneralSettings) : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(messageBox, configService,
                                                     config,
                                                     new SettingsView
            {
                // FIXME inject types marked as ExperimentalFeatures

                /*
                 * These ExperimentalFeatureTypes were originally obtained by directly calling into the IoC container
                 * (since only it knows, which Assemblies have been loaded as Plugins). The code is preserved here for easy access.
                 * RubberduckIoCInstaller.AssembliesToRegister()
                 *     .SelectMany(s => s.DefinedTypes)
                 *     .Where(w => Attribute.IsDefined(w, typeof(ExperimentalAttribute)))
                 */
                Control = new GeneralSettings(new GeneralSettingsViewModel(config, operatingSystem, messageBox, vbeSettings, new List <Type>())),
                View    = SettingsViews.GeneralSettings
            },
                                                     new SettingsView
            {
                Control = new TodoSettings(new TodoSettingsViewModel(config)),
                View    = SettingsViews.TodoSettings
            },
                                                     new SettingsView
            {
                Control = new InspectionSettings(new InspectionSettingsViewModel(config)),
                View    = SettingsViews.InspectionSettings
            },
                                                     new SettingsView
            {
                Control = new UnitTestSettings(new UnitTestSettingsViewModel(config)),
                View    = SettingsViews.UnitTestSettings
            },
                                                     new SettingsView
            {
                Control = new IndenterSettings(new IndenterSettingsViewModel(config)),
                View    = SettingsViews.IndenterSettings
            },
                                                     new SettingsView
            {
                Control = new AutoCompleteSettings(new AutoCompleteSettingsViewModel(config)),
                View    = SettingsViews.AutoCompleteSettings
            },
                                                     new SettingsView
            {
                Control = new WindowSettings(new WindowSettingsViewModel(config)),
                View    = SettingsViews.WindowSettings
            },
                                                     new SettingsView
            {
                Control = new AddRemoveReferencesUserSettings(new AddRemoveReferencesUserSettingsViewModel(referencesProvider, browserFactory)),
                View    = SettingsViews.ReferenceSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }