Skip to content

Commit 0c2e7f9

Browse files
committed
Close #2023
1 parent e18f999 commit 0c2e7f9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

RetailCoder.VBE/UI/Inspections/InspectionResultsViewModel.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Threading;
99
using System.Threading.Tasks;
1010
using System.Windows;
11-
using System.Windows.Input;
1211
using Microsoft.Vbe.Interop;
1312
using NLog;
1413
using Rubberduck.Common;
@@ -45,8 +44,8 @@ public InspectionResultsViewModel(RubberduckParserState state, IInspector inspec
4544
_refreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), async param => await Task.Run(() => ExecuteRefreshCommandAsync()), CanExecuteRefreshCommand);
4645
_disableInspectionCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
4746
_quickFixCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
48-
_quickFixInModuleCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand);
49-
_quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand);
47+
_quickFixInModuleCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => _state.Status == ParserState.Ready);
48+
_quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => _state.Status == ParserState.Ready);
5049
_copyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
5150
_openSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);
5251

@@ -224,7 +223,15 @@ private set
224223
}
225224

226225
private bool _canQuickFix;
227-
public bool CanQuickFix { get { return _canQuickFix; } set { _canQuickFix = value; OnPropertyChanged(); } }
226+
public bool CanQuickFix
227+
{
228+
get { return _canQuickFix; }
229+
set
230+
{
231+
_canQuickFix = value;
232+
OnPropertyChanged();
233+
}
234+
}
228235

229236
private bool _isBusy;
230237
public bool IsBusy { get { return _isBusy; } set { _isBusy = value; OnPropertyChanged(); } }
@@ -335,7 +342,7 @@ private void ExecuteQuickFixCommand(object parameter)
335342
private bool CanExecuteQuickFixCommand(object parameter)
336343
{
337344
var quickFix = parameter as CodeInspectionQuickFix;
338-
return !IsBusy && quickFix != null;
345+
return !IsBusy && quickFix != null && _state.Status == ParserState.Ready;
339346
}
340347

341348
private bool _canExecuteQuickFixInModule;

0 commit comments

Comments
 (0)