diff --git a/RetailCoder.VBE/App.cs b/RetailCoder.VBE/App.cs index c5d18a64cd..d3e8ee8591 100644 --- a/RetailCoder.VBE/App.cs +++ b/RetailCoder.VBE/App.cs @@ -53,8 +53,8 @@ public App(VBE vbe, IMessageBox messageBox, _parserErrorsPresenterFactory = parserErrorsPresenterFactory; _parser = parser; _inspectorFactory = inspectorFactory; - _autoSave = new AutoSave.AutoSave(_vbe, new AutoSaveSettings()); _configService = configService; + _autoSave = new AutoSave.AutoSave(_vbe, _configService); _appMenus = appMenus; _stateBar = stateBar; _indenter = indenter; @@ -62,7 +62,7 @@ public App(VBE vbe, IMessageBox messageBox, _logger = LogManager.GetCurrentClassLogger(); //_hooks.MessageReceived += hooks_MessageReceived; - _configService.SettingsChanged += _configService_SettingsChanged; + _configService.LanguageChanged += ConfigServiceLanguageChanged; _parser.State.StateChanged += Parser_StateChanged; _stateBar.Refresh += _stateBar_Refresh; @@ -177,7 +177,7 @@ private void CleanReloadConfig() Setup(); } - private void _configService_SettingsChanged(object sender, EventArgs e) + private void ConfigServiceLanguageChanged(object sender, EventArgs e) { CleanReloadConfig(); } @@ -211,7 +211,7 @@ private void Setup() public void Dispose() { //_hooks.MessageReceived -= hooks_MessageReceived; - _configService.SettingsChanged -= _configService_SettingsChanged; + _configService.LanguageChanged -= ConfigServiceLanguageChanged; _parser.State.StateChanged -= Parser_StateChanged; _autoSave.Dispose(); diff --git a/RetailCoder.VBE/AutoSave/AutoSave.cs b/RetailCoder.VBE/AutoSave/AutoSave.cs index d1dd49a9d2..839a02771a 100644 --- a/RetailCoder.VBE/AutoSave/AutoSave.cs +++ b/RetailCoder.VBE/AutoSave/AutoSave.cs @@ -1,44 +1,41 @@ using System; -using System.ComponentModel; using System.IO; using System.Linq; using System.Timers; using Microsoft.Vbe.Interop; +using Rubberduck.Settings; namespace Rubberduck.AutoSave { public class AutoSave : IDisposable { private readonly VBE _vbe; - private readonly IAutoSaveSettings _settings; + private readonly IGeneralConfigService _configService; private readonly Timer _timer = new Timer(); + private Configuration _config; private const int VbeSaveCommandId = 3; - public AutoSave(VBE vbe, IAutoSaveSettings settings) + public AutoSave(VBE vbe, IGeneralConfigService configService) { _vbe = vbe; - _settings = settings; + _configService = configService; + _config = _configService.LoadConfiguration(); - _settings.PropertyChanged += _settings_PropertyChanged; + _configService.SettingsChanged += ConfigServiceSettingsChanged; - _timer.Enabled = _settings.IsEnabled; - _timer.Interval = _settings.TimerDelay; + _timer.Enabled = _config.UserSettings.GeneralSettings.AutoSaveEnabled; + _timer.Interval = _config.UserSettings.GeneralSettings.AutoSavePeriod * 1000; _timer.Elapsed += _timer_Elapsed; } - private void _settings_PropertyChanged(object sender, PropertyChangedEventArgs e) + void ConfigServiceSettingsChanged(object sender, EventArgs e) { - switch (e.PropertyName) - { - case "IsEnabled": - _timer.Enabled = _settings.IsEnabled; - break; - case "TimerDelay": - _timer.Interval = _settings.TimerDelay; - break; - } + _config = _configService.LoadConfiguration(); + + _timer.Enabled = _config.UserSettings.GeneralSettings.AutoSaveEnabled; + _timer.Interval = _config.UserSettings.GeneralSettings.AutoSavePeriod * 1000; } private void _timer_Elapsed(object sender, ElapsedEventArgs e) @@ -61,7 +58,7 @@ private void _timer_Elapsed(object sender, ElapsedEventArgs e) public void Dispose() { - _settings.PropertyChanged -= _settings_PropertyChanged; + _configService.LanguageChanged -= ConfigServiceSettingsChanged; _timer.Elapsed -= _timer_Elapsed; _timer.Dispose(); diff --git a/RetailCoder.VBE/AutoSave/AutoSaveSettings.cs b/RetailCoder.VBE/AutoSave/AutoSaveSettings.cs deleted file mode 100644 index cd4d112493..0000000000 --- a/RetailCoder.VBE/AutoSave/AutoSaveSettings.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.ComponentModel; -using System.Runtime.CompilerServices; - -namespace Rubberduck.AutoSave -{ - public interface IAutoSaveSettings : INotifyPropertyChanged - { - bool IsEnabled { get; set; } - double TimerDelay { get; set; } - } - - public class AutoSaveSettings : IAutoSaveSettings - { - public AutoSaveSettings(bool isEnabled = false, int timerDelay = 600000) - { - IsEnabled = isEnabled; - TimerDelay = timerDelay; - } - - private bool _isEnabled; - public bool IsEnabled - { - get { return _isEnabled; } - set - { - if (_isEnabled != value) - { - _isEnabled = value; - OnPropertyChanged(); - } - } - } - - private double _timerDelay; - public double TimerDelay - { - get { return _timerDelay; } - set - { - if (Math.Abs(_timerDelay - value) > .1) - { - _timerDelay = value; - OnPropertyChanged(); - } - } - } - - public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - var handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(propertyName)); - } - } - } -} diff --git a/RetailCoder.VBE/Inspections/AssignedByValParameterInspectionResult.cs b/RetailCoder.VBE/Inspections/AssignedByValParameterInspectionResult.cs index fd637e305f..8eb2eb815c 100644 --- a/RetailCoder.VBE/Inspections/AssignedByValParameterInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/AssignedByValParameterInspectionResult.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs b/RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs index 3a54e01d7e..0097574be8 100644 --- a/RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; diff --git a/RetailCoder.VBE/Inspections/IInspector.cs b/RetailCoder.VBE/Inspections/IInspector.cs index ffa74c65d2..16722041d2 100644 --- a/RetailCoder.VBE/Inspections/IInspector.cs +++ b/RetailCoder.VBE/Inspections/IInspector.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Rubberduck.Parsing.VBA; diff --git a/RetailCoder.VBE/Inspections/IdentifierNotAssignedInspectionResult.cs b/RetailCoder.VBE/Inspections/IdentifierNotAssignedInspectionResult.cs index 1d8c999ffd..673cc05410 100644 --- a/RetailCoder.VBE/Inspections/IdentifierNotAssignedInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/IdentifierNotAssignedInspectionResult.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.Symbols; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/IdentifierNotUsedInspectionResult.cs b/RetailCoder.VBE/Inspections/IdentifierNotUsedInspectionResult.cs index 860ed8b32f..1e7dec002c 100644 --- a/RetailCoder.VBE/Inspections/IdentifierNotUsedInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/IdentifierNotUsedInspectionResult.cs @@ -2,7 +2,6 @@ using Antlr4.Runtime; using Rubberduck.Common; using Rubberduck.Parsing.Symbols; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs b/RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs index 75e5f8ce6c..c0676c5f4a 100644 --- a/RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs +++ b/RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs @@ -3,7 +3,6 @@ using System.Linq; using Microsoft.Vbe.Interop; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; using Rubberduck.VBEditor.Extensions; using Rubberduck.VBEditor.VBEHost; diff --git a/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs b/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs index c50a620d17..ef79d7aead 100644 --- a/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs +++ b/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspection.cs @@ -5,7 +5,6 @@ using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; namespace Rubberduck.Inspections { diff --git a/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspectionResult.cs b/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspectionResult.cs index bbc65094d7..74f5c17914 100644 --- a/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ImplicitByRefParameterInspectionResult.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ImplicitPublicMemberInspectionResult.cs b/RetailCoder.VBE/Inspections/ImplicitPublicMemberInspectionResult.cs index bbddc28e7d..b63cac07bb 100644 --- a/RetailCoder.VBE/Inspections/ImplicitPublicMemberInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ImplicitPublicMemberInspectionResult.cs @@ -3,7 +3,6 @@ using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Symbols; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspectionResult.cs b/RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspectionResult.cs index 10818f3235..b8b3c9c634 100644 --- a/RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ImplicitVariantReturnTypeInspectionResult.cs @@ -3,7 +3,6 @@ using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.VBA.Nodes; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/InspectionResultBase.cs b/RetailCoder.VBE/Inspections/InspectionResultBase.cs index 2a3250c012..8716977c48 100644 --- a/RetailCoder.VBE/Inspections/InspectionResultBase.cs +++ b/RetailCoder.VBE/Inspections/InspectionResultBase.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Antlr4.Runtime; using Rubberduck.Parsing; diff --git a/RetailCoder.VBE/Inspections/Inspector.cs b/RetailCoder.VBE/Inspections/Inspector.cs index c1415367ad..a4ab3cbe8c 100644 --- a/RetailCoder.VBE/Inspections/Inspector.cs +++ b/RetailCoder.VBE/Inspections/Inspector.cs @@ -24,11 +24,11 @@ public Inspector(IGeneralConfigService configService, IEnumerable i _inspections = inspections; _configService = configService; - configService.SettingsChanged += ConfigServiceSettingsChanged; + configService.LanguageChanged += ConfigServiceLanguageChanged; UpdateInspectionSeverity(); } - private void ConfigServiceSettingsChanged(object sender, EventArgs e) + private void ConfigServiceLanguageChanged(object sender, EventArgs e) { UpdateInspectionSeverity(); } @@ -103,7 +103,7 @@ protected virtual void Dispose(bool disposing) if (_configService != null) { - _configService.SettingsChanged -= ConfigServiceSettingsChanged; + _configService.LanguageChanged -= ConfigServiceLanguageChanged; } } } diff --git a/RetailCoder.VBE/Inspections/MakeSingleLineParameterQuickFix.cs b/RetailCoder.VBE/Inspections/MakeSingleLineParameterQuickFix.cs index 580ac570aa..c87efeb00a 100644 --- a/RetailCoder.VBE/Inspections/MakeSingleLineParameterQuickFix.cs +++ b/RetailCoder.VBE/Inspections/MakeSingleLineParameterQuickFix.cs @@ -1,6 +1,5 @@ using Antlr4.Runtime; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/MultilineParameterInspection.cs b/RetailCoder.VBE/Inspections/MultilineParameterInspection.cs index b13292c640..bdd7182da2 100644 --- a/RetailCoder.VBE/Inspections/MultilineParameterInspection.cs +++ b/RetailCoder.VBE/Inspections/MultilineParameterInspection.cs @@ -3,7 +3,6 @@ using Rubberduck.Parsing; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; namespace Rubberduck.Inspections { diff --git a/RetailCoder.VBE/Inspections/MultipleDeclarationsInspectionResult.cs b/RetailCoder.VBE/Inspections/MultipleDeclarationsInspectionResult.cs index 4aff2a800b..59e587200c 100644 --- a/RetailCoder.VBE/Inspections/MultipleDeclarationsInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/MultipleDeclarationsInspectionResult.cs @@ -3,7 +3,6 @@ using Antlr4.Runtime; using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ObsoleteCommentSyntaxInspectionResult.cs b/RetailCoder.VBE/Inspections/ObsoleteCommentSyntaxInspectionResult.cs index d0c109a85c..d2fca1a76f 100644 --- a/RetailCoder.VBE/Inspections/ObsoleteCommentSyntaxInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ObsoleteCommentSyntaxInspectionResult.cs @@ -3,7 +3,6 @@ using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Nodes; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ObsoleteLetStatementUsageInspectionResult.cs b/RetailCoder.VBE/Inspections/ObsoleteLetStatementUsageInspectionResult.cs index 56d78d2aff..210f66a44e 100644 --- a/RetailCoder.VBE/Inspections/ObsoleteLetStatementUsageInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ObsoleteLetStatementUsageInspectionResult.cs @@ -2,7 +2,6 @@ using Antlr4.Runtime; using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs b/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs index 1a61027a2b..2ef4ac5b79 100644 --- a/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs +++ b/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs @@ -2,7 +2,6 @@ using System.Linq; using Rubberduck.Parsing; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; namespace Rubberduck.Inspections { diff --git a/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspectionResult.cs b/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspectionResult.cs index 40cf2cb577..96c85c39eb 100644 --- a/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ObsoleteTypeHintInspectionResult.cs @@ -6,7 +6,6 @@ using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Symbols; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/OptionExplicitInspection.cs b/RetailCoder.VBE/Inspections/OptionExplicitInspection.cs index a2dc3f2a90..f105a88f52 100644 --- a/RetailCoder.VBE/Inspections/OptionExplicitInspection.cs +++ b/RetailCoder.VBE/Inspections/OptionExplicitInspection.cs @@ -3,7 +3,6 @@ using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; namespace Rubberduck.Inspections { diff --git a/RetailCoder.VBE/Inspections/OptionExplicitInspectionResult.cs b/RetailCoder.VBE/Inspections/OptionExplicitInspectionResult.cs index b2b49c4299..a59dd2820c 100644 --- a/RetailCoder.VBE/Inspections/OptionExplicitInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/OptionExplicitInspectionResult.cs @@ -3,7 +3,6 @@ using Antlr4.Runtime; using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Nodes; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ParameterCanBeByValInspectionResult.cs b/RetailCoder.VBE/Inspections/ParameterCanBeByValInspectionResult.cs index 9a6506738b..f0f0e19582 100644 --- a/RetailCoder.VBE/Inspections/ParameterCanBeByValInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ParameterCanBeByValInspectionResult.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ParameterNotUsedInspectionResult.cs b/RetailCoder.VBE/Inspections/ParameterNotUsedInspectionResult.cs index e9c1922345..d75b1342ae 100644 --- a/RetailCoder.VBE/Inspections/ParameterNotUsedInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/ParameterNotUsedInspectionResult.cs @@ -1,9 +1,7 @@ -using System; using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.VBA; using Rubberduck.Refactorings.RemoveParameters; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs b/RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs index 3ad651d271..4ad3bc5a6e 100644 --- a/RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs +++ b/RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs @@ -5,7 +5,6 @@ using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/RemoveExplicitCallStatmentQuickFix.cs b/RetailCoder.VBE/Inspections/RemoveExplicitCallStatmentQuickFix.cs index 55cf30e46e..0624cfb8fb 100644 --- a/RetailCoder.VBE/Inspections/RemoveExplicitCallStatmentQuickFix.cs +++ b/RetailCoder.VBE/Inspections/RemoveExplicitCallStatmentQuickFix.cs @@ -2,7 +2,6 @@ using Antlr4.Runtime; using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/UnassignedVariableUsageInspectionResult.cs b/RetailCoder.VBE/Inspections/UnassignedVariableUsageInspectionResult.cs index 802df2f3b6..aaa713bc59 100644 --- a/RetailCoder.VBE/Inspections/UnassignedVariableUsageInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/UnassignedVariableUsageInspectionResult.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using Antlr4.Runtime; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/UntypedFunctionUsageInspectionResult.cs b/RetailCoder.VBE/Inspections/UntypedFunctionUsageInspectionResult.cs index 95cdaa80c1..00e8b094bf 100644 --- a/RetailCoder.VBE/Inspections/UntypedFunctionUsageInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/UntypedFunctionUsageInspectionResult.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using Antlr4.Runtime; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/VariableTypeNotDeclaredInspectionResult.cs b/RetailCoder.VBE/Inspections/VariableTypeNotDeclaredInspectionResult.cs index 5362241808..89248be2a9 100644 --- a/RetailCoder.VBE/Inspections/VariableTypeNotDeclaredInspectionResult.cs +++ b/RetailCoder.VBE/Inspections/VariableTypeNotDeclaredInspectionResult.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using Antlr4.Runtime; using Rubberduck.Parsing.Grammar; -using Rubberduck.UI; using Rubberduck.VBEditor; namespace Rubberduck.Inspections diff --git a/RetailCoder.VBE/Inspections/WriteOnlyPropertyInspection.cs b/RetailCoder.VBE/Inspections/WriteOnlyPropertyInspection.cs index 2851d0396e..eca20b9455 100644 --- a/RetailCoder.VBE/Inspections/WriteOnlyPropertyInspection.cs +++ b/RetailCoder.VBE/Inspections/WriteOnlyPropertyInspection.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using Rubberduck.Parsing.Symbols; diff --git a/RetailCoder.VBE/Root/CommandBarsModule.cs b/RetailCoder.VBE/Root/CommandBarsModule.cs index 91d210a4b4..b8fa638744 100644 --- a/RetailCoder.VBE/Root/CommandBarsModule.cs +++ b/RetailCoder.VBE/Root/CommandBarsModule.cs @@ -156,7 +156,7 @@ private IEnumerable GetRubberduckMenuItems() return new IMenuItem[] { _kernel.Get(), - _kernel.Get(), + _kernel.Get(), _kernel.Get(), _kernel.Get(), GetUnitTestingParentMenu(), diff --git a/RetailCoder.VBE/Rubberduck.csproj b/RetailCoder.VBE/Rubberduck.csproj index dd2000e509..8749129523 100644 --- a/RetailCoder.VBE/Rubberduck.csproj +++ b/RetailCoder.VBE/Rubberduck.csproj @@ -274,7 +274,6 @@ - @@ -488,8 +487,8 @@ - - + + diff --git a/RetailCoder.VBE/Settings/ConfigurationLoader.cs b/RetailCoder.VBE/Settings/ConfigurationLoader.cs index cd3aa1351d..61b641cd57 100644 --- a/RetailCoder.VBE/Settings/ConfigurationLoader.cs +++ b/RetailCoder.VBE/Settings/ConfigurationLoader.cs @@ -139,7 +139,8 @@ private GeneralSettings GetDefaultGeneralSettings() { new Hotkey{Name="IndentProcedure", IsEnabled=true, KeyDisplaySymbol="CTRL-P"}, new Hotkey{Name="IndentModule", IsEnabled=true, KeyDisplaySymbol="CTRL-M"} - }); + }, + false, 10); } public ToDoMarker[] GetDefaultTodoMarkers() diff --git a/RetailCoder.VBE/Settings/GeneralSettings.cs b/RetailCoder.VBE/Settings/GeneralSettings.cs index 3af09116f1..3c233203b8 100644 --- a/RetailCoder.VBE/Settings/GeneralSettings.cs +++ b/RetailCoder.VBE/Settings/GeneralSettings.cs @@ -6,6 +6,8 @@ interface IGeneralSettings { DisplayLanguageSetting Language { get; set; } Hotkey[] HotkeySettings { get; set; } + bool AutoSaveEnabled { get; set; } + int AutoSavePeriod { get; set; } } [XmlType(AnonymousType = true)] @@ -15,16 +17,21 @@ public class GeneralSettings : IGeneralSettings [XmlArrayItem("Hotkey", IsNullable = false)] public Hotkey[] HotkeySettings { get; set; } + + public bool AutoSaveEnabled { get; set; } + public int AutoSavePeriod { get; set; } public GeneralSettings() { //empty constructor needed for serialization } - public GeneralSettings(DisplayLanguageSetting language, Hotkey[] hotkeySettings) + public GeneralSettings(DisplayLanguageSetting language, Hotkey[] hotkeySettings, bool autoSaveEnabled, int autoSavePeriod) { Language = language; HotkeySettings = hotkeySettings; + AutoSaveEnabled = autoSaveEnabled; + AutoSavePeriod = autoSavePeriod; } } } \ No newline at end of file diff --git a/RetailCoder.VBE/Settings/IConfigurationService.cs b/RetailCoder.VBE/Settings/IConfigurationService.cs index d72577c82d..71395d33fc 100644 --- a/RetailCoder.VBE/Settings/IConfigurationService.cs +++ b/RetailCoder.VBE/Settings/IConfigurationService.cs @@ -7,6 +7,7 @@ public interface IConfigurationService T LoadConfiguration(); void SaveConfiguration(T toSerialize); void SaveConfiguration(T toSerialize, bool languageChanged); + event EventHandler LanguageChanged; event EventHandler SettingsChanged; } } diff --git a/RetailCoder.VBE/Settings/XmlConfigurationServiceBase.cs b/RetailCoder.VBE/Settings/XmlConfigurationServiceBase.cs index 3b834cfb9c..bf846d5df4 100644 --- a/RetailCoder.VBE/Settings/XmlConfigurationServiceBase.cs +++ b/RetailCoder.VBE/Settings/XmlConfigurationServiceBase.cs @@ -6,6 +6,16 @@ namespace Rubberduck.Settings { public abstract class XmlConfigurationServiceBase : IConfigurationService { + public event EventHandler LanguageChanged; + protected virtual void OnLanguageChanged(EventArgs e) + { + var handler = LanguageChanged; + if (handler != null) + { + handler(this, e); + } + } + public event EventHandler SettingsChanged; protected virtual void OnSettingsChanged(EventArgs e) { @@ -37,8 +47,10 @@ public void SaveConfiguration(T toSerialize, bool languageChanged) if (languageChanged) { - OnSettingsChanged(EventArgs.Empty); + OnLanguageChanged(EventArgs.Empty); } + + OnSettingsChanged(EventArgs.Empty); } /// diff --git a/RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/RubberduckParentMenu.cs b/RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/RubberduckParentMenu.cs index 10719b7f04..63e2fa8488 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/RubberduckParentMenu.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/ParentMenus/RubberduckParentMenu.cs @@ -17,7 +17,7 @@ public enum RubberduckMenuItemDisplayOrder Navigate, CodeInspections, SourceControl, - Options, + Settings, About } } diff --git a/RetailCoder.VBE/UI/Command/MenuItems/OptionsCommandMenuItem.cs b/RetailCoder.VBE/UI/Command/MenuItems/SettingsCommandMenuItem.cs similarity index 64% rename from RetailCoder.VBE/UI/Command/MenuItems/OptionsCommandMenuItem.cs rename to RetailCoder.VBE/UI/Command/MenuItems/SettingsCommandMenuItem.cs index 40051f7e8e..a3756ae955 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/OptionsCommandMenuItem.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/SettingsCommandMenuItem.cs @@ -3,14 +3,14 @@ namespace Rubberduck.UI.Command.MenuItems { - public class OptionsCommandMenuItem : CommandMenuItemBase + public class SettingsCommandMenuItem : CommandMenuItemBase { - public OptionsCommandMenuItem(ICommand command) : base(command) + public SettingsCommandMenuItem(ICommand command) : base(command) { } - public override string Key { get { return "RubberduckMenu_Options"; } } + public override string Key { get { return "RubberduckMenu_Settings"; } } public override bool BeginGroup { get { return true; } } - public override int DisplayOrder { get { return (int)RubberduckMenuItemDisplayOrder.Options; } } + public override int DisplayOrder { get { return (int)RubberduckMenuItemDisplayOrder.Settings; } } } } \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Command/MenuItems/ToDoExplorerCommandMenuItem.cs b/RetailCoder.VBE/UI/Command/MenuItems/ToDoExplorerCommandMenuItem.cs index 800160412b..947e959b4a 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/ToDoExplorerCommandMenuItem.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/ToDoExplorerCommandMenuItem.cs @@ -11,7 +11,7 @@ public ToDoExplorerCommandMenuItem(ICommand command) { } - public override string Key { get { return "RubberduckMenu_ToDoItems"; } } + public override string Key { get { return "RubberduckMenu_TodoItems"; } } public override int DisplayOrder { get { return (int)NavigationMenuItemDisplayOrder.ToDoExplorer; } } public override bool EvaluateCanExecute(RubberduckParserState state) diff --git a/RetailCoder.VBE/UI/Command/OptionsCommand.cs b/RetailCoder.VBE/UI/Command/SettingsCommand.cs similarity index 83% rename from RetailCoder.VBE/UI/Command/OptionsCommand.cs rename to RetailCoder.VBE/UI/Command/SettingsCommand.cs index 9578ceb68a..9eb7b84e7d 100644 --- a/RetailCoder.VBE/UI/Command/OptionsCommand.cs +++ b/RetailCoder.VBE/UI/Command/SettingsCommand.cs @@ -8,10 +8,10 @@ namespace Rubberduck.UI.Command /// A command that displays the Options dialog. /// [ComVisible(false)] - public class OptionsCommand : CommandBase + public class SettingsCommand : CommandBase { private readonly IGeneralConfigService _service; - public OptionsCommand(IGeneralConfigService service) + public SettingsCommand(IGeneralConfigService service) { _service = service; } diff --git a/RetailCoder.VBE/UI/Controls/GroupingGrid.xaml b/RetailCoder.VBE/UI/Controls/GroupingGrid.xaml index bdd2568028..7e7eeede57 100644 --- a/RetailCoder.VBE/UI/Controls/GroupingGrid.xaml +++ b/RetailCoder.VBE/UI/Controls/GroupingGrid.xaml @@ -28,7 +28,7 @@ - + diff --git a/RetailCoder.VBE/UI/RubberduckUI.Designer.cs b/RetailCoder.VBE/UI/RubberduckUI.Designer.cs index 54169a211b..e8e72e94d6 100644 --- a/RetailCoder.VBE/UI/RubberduckUI.Designer.cs +++ b/RetailCoder.VBE/UI/RubberduckUI.Designer.cs @@ -249,15 +249,6 @@ public static string AllReferences_NoneFound { } } - /// - /// Looks up a localized string similar to ByVal parameter '{0}' is assigned. - /// - public static string ByValParameterIsAssigned_ { - get { - return ResourceManager.GetString("ByValParameterIsAssigned_", resourceCulture); - } - } - /// /// Looks up a localized string similar to Cancel. /// @@ -719,15 +710,6 @@ public static string Component { } } - /// - /// Looks up a localized string similar to Constant '{0}' is never used. - /// - public static string ConstantNotUsed_ { - get { - return ResourceManager.GetString("ConstantNotUsed_", resourceCulture); - } - } - /// /// Looks up a localized string similar to &Find all references.... /// @@ -1206,11 +1188,20 @@ public static string FormContextMenu_Rename { } /// - /// Looks up a localized string similar to Function '{0}' is never used. + /// Looks up a localized string similar to Enable Auto Save. + /// + public static string GeneralSettings_AutoSaveEnabled { + get { + return ResourceManager.GetString("GeneralSettings_AutoSaveEnabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Auto Save:. /// - public static string FunctionNotUsed_ { + public static string GeneralSettings_AutoSaveLabel { get { - return ResourceManager.GetString("FunctionNotUsed_", resourceCulture); + return ResourceManager.GetString("GeneralSettings_AutoSaveLabel", resourceCulture); } } @@ -1242,20 +1233,20 @@ public static string GeneralSettings_HotkeyKeyPress { } /// - /// Looks up a localized string similar to Display language:. + /// Looks up a localized string similar to Hotkeys:. /// - public static string GeneralSettings_LanguageLabel { + public static string GeneralSettings_HotkeysLabel { get { - return ResourceManager.GetString("GeneralSettings_LanguageLabel", resourceCulture); + return ResourceManager.GetString("GeneralSettings_HotkeysLabel", resourceCulture); } } /// - /// Looks up a localized string similar to Project '{0}' has generic name. + /// Looks up a localized string similar to Display language:. /// - public static string GenericProjectName_ { + public static string GeneralSettings_LanguageLabel { get { - return ResourceManager.GetString("GenericProjectName_", resourceCulture); + return ResourceManager.GetString("GeneralSettings_LanguageLabel", resourceCulture); } } @@ -1331,51 +1322,6 @@ public static string ImplementInterface_InvalidSelectionMessage { } } - /// - /// Looks up a localized string similar to '{0}' is an implicit reference to the active worksheet. - /// - public static string ImplicitActiveSheetReference_ { - get { - return ResourceManager.GetString("ImplicitActiveSheetReference_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to '{0}' is an implicit reference to the active workbook. - /// - public static string ImplicitActiveWorkbookReference_ { - get { - return ResourceManager.GetString("ImplicitActiveWorkbookReference_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Parameter '{0}' is passed ByRef implicitly. - /// - public static string ImplicitByRef_ { - get { - return ResourceManager.GetString("ImplicitByRef_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Member '{0}' is implicitly Public. - /// - public static string ImplicitPublicMember_ { - get { - return ResourceManager.GetString("ImplicitPublicMember_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Function '{0}' returns an implicit Variant. - /// - public static string ImplicitVariantReturnType_ { - get { - return ResourceManager.GetString("ImplicitVariantReturnType_", resourceCulture); - } - } - /// /// Looks up a localized string similar to Current module. /// @@ -2500,20 +2446,20 @@ public static string RubberduckMenu_Navigate { } /// - /// Looks up a localized string similar to &Options. + /// Looks up a localized string similar to &Refactor. /// - public static string RubberduckMenu_Options { + public static string RubberduckMenu_Refactor { get { - return ResourceManager.GetString("RubberduckMenu_Options", resourceCulture); + return ResourceManager.GetString("RubberduckMenu_Refactor", resourceCulture); } } /// - /// Looks up a localized string similar to &Refactor. + /// Looks up a localized string similar to S&ettings. /// - public static string RubberduckMenu_Refactor { + public static string RubberduckMenu_Settings { get { - return ResourceManager.GetString("RubberduckMenu_Refactor", resourceCulture); + return ResourceManager.GetString("RubberduckMenu_Settings", resourceCulture); } } @@ -2562,6 +2508,15 @@ public static string SelectAll_Button { } } + /// + /// Looks up a localized string similar to Settings. + /// + public static string Settings { + get { + return ResourceManager.GetString("Settings", resourceCulture); + } + } + /// /// Looks up a localized string similar to Rubberduck Settings. /// diff --git a/RetailCoder.VBE/UI/RubberduckUI.resx b/RetailCoder.VBE/UI/RubberduckUI.resx index 3f850c0f55..1e36b60c7f 100644 --- a/RetailCoder.VBE/UI/RubberduckUI.resx +++ b/RetailCoder.VBE/UI/RubberduckUI.resx @@ -331,8 +331,8 @@ Code &Inspections - - &Options + + S&ettings &Refactor @@ -471,27 +471,9 @@ Warning: All customized settings will be lost. Your old file will be saved in ' Warning - - ByVal parameter '{0}' is assigned - - - Constant '{0}' is never used - You've earned the "Continuator" badge! - - Function '{0}' is never used - - - Parameter '{0}' is passed ByRef implicitly - - - Member '{0}' is implicitly Public - - - Function '{0}' returns an implicit Variant - Module options should be specified first @@ -660,9 +642,6 @@ Warning: All customized settings will be lost. Your old file will be saved in ' Selected Tests - - Project '{0}' has generic name - Line @@ -1034,12 +1013,6 @@ Are you sure you want to proceed with this rename? Details - - '{0}' is an implicit reference to the active worksheet - - - '{0}' is an implicit reference to the active workbook - Make ActiveSheet reference explicit @@ -1326,4 +1299,16 @@ Are you sure you want to proceed with this rename? By outcome + + Auto Save: + + + Hotkeys: + + + Enable Auto Save + + + Settings + \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Settings/GeneralSettings.xaml b/RetailCoder.VBE/UI/Settings/GeneralSettings.xaml index 0d1411d91a..39f47dacee 100644 --- a/RetailCoder.VBE/UI/Settings/GeneralSettings.xaml +++ b/RetailCoder.VBE/UI/Settings/GeneralSettings.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:settings="clr-namespace:Rubberduck.UI.Settings" + xmlns:controls="clr-namespace:Rubberduck.UI.Controls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance {x:Type settings:GeneralSettingsViewModel}, IsDesignTimeCreatable=False}"> @@ -54,7 +55,12 @@ -