Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ 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;
//_hooks = hooks;
_logger = LogManager.GetCurrentClassLogger();

//_hooks.MessageReceived += hooks_MessageReceived;
_configService.SettingsChanged += _configService_SettingsChanged;
_configService.LanguageChanged += ConfigServiceLanguageChanged;
_parser.State.StateChanged += Parser_StateChanged;
_stateBar.Refresh += _stateBar_Refresh;

Expand Down Expand Up @@ -177,7 +177,7 @@ private void CleanReloadConfig()
Setup();
}

private void _configService_SettingsChanged(object sender, EventArgs e)
private void ConfigServiceLanguageChanged(object sender, EventArgs e)
{
CleanReloadConfig();
}
Expand Down Expand Up @@ -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();

Expand Down
33 changes: 15 additions & 18 deletions RetailCoder.VBE/AutoSave/AutoSave.cs
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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();
Expand Down
59 changes: 0 additions & 59 deletions RetailCoder.VBE/AutoSave/AutoSaveSettings.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Antlr4.Runtime;
using Rubberduck.Parsing.Grammar;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion RetailCoder.VBE/Inspections/IInspector.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Rubberduck.Parsing.VBA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using Antlr4.Runtime;
using Rubberduck.Parsing.Symbols;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Antlr4.Runtime;
using Rubberduck.Common;
using Rubberduck.Parsing.Symbols;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Symbols;
using Rubberduck.Parsing.VBA;
using Rubberduck.UI;

namespace Rubberduck.Inspections
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Symbols;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions RetailCoder.VBE/Inspections/InspectionResultBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Antlr4.Runtime;
using Rubberduck.Parsing;
Expand Down
6 changes: 3 additions & 3 deletions RetailCoder.VBE/Inspections/Inspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public Inspector(IGeneralConfigService configService, IEnumerable<IInspection> 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();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ protected virtual void Dispose(bool disposing)

if (_configService != null)
{
_configService.SettingsChanged -= ConfigServiceSettingsChanged;
_configService.LanguageChanged -= ConfigServiceLanguageChanged;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Antlr4.Runtime;
using Rubberduck.Parsing.VBA;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Rubberduck.Parsing;
using Rubberduck.Parsing.Symbols;
using Rubberduck.Parsing.VBA;
using Rubberduck.UI;

namespace Rubberduck.Inspections
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Antlr4.Runtime;
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Antlr4.Runtime;
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
1 change: 0 additions & 1 deletion RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using Rubberduck.Parsing;
using Rubberduck.Parsing.VBA;
using Rubberduck.UI;

namespace Rubberduck.Inspections
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Symbols;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
1 change: 0 additions & 1 deletion RetailCoder.VBE/Inspections/OptionExplicitInspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Symbols;
using Rubberduck.Parsing.VBA;
using Rubberduck.UI;

namespace Rubberduck.Inspections
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Antlr4.Runtime;
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Nodes;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Antlr4.Runtime;
using Rubberduck.Parsing.Grammar;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Antlr4.Runtime;
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Antlr4.Runtime;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Antlr4.Runtime;
using Rubberduck.UI;
using Rubberduck.VBEditor;

namespace Rubberduck.Inspections
Expand Down
Loading