示例#1
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;
 }
示例#2
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")
            });

            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());
        }
示例#3
0
        public SettingsForm(IGeneralConfigService configService, IOperatingSystem operatingSystem, IMessageBox messageBox, IVBESettings vbeSettings, SettingsViews activeView = SettingsViews.GeneralSettings) : this()
        {
            var config = configService.LoadConfiguration();

            ViewModel = new SettingsControlViewModel(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 WindowSettings(new WindowSettingsViewModel(config)),
                View    = SettingsViews.WindowSettings
            },
                                                     activeView);

            ViewModel.OnWindowClosed += ViewModel_OnWindowClosed;
        }