diff --git a/RetailCoder.VBE/UI/Inspections/InspectionResultsViewModel.cs b/RetailCoder.VBE/UI/Inspections/InspectionResultsViewModel.cs index 1fb5c73d6a..2f46fe130e 100644 --- a/RetailCoder.VBE/UI/Inspections/InspectionResultsViewModel.cs +++ b/RetailCoder.VBE/UI/Inspections/InspectionResultsViewModel.cs @@ -8,7 +8,6 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; -using System.Windows.Input; using Microsoft.Vbe.Interop; using NLog; using Rubberduck.Common; @@ -45,8 +44,8 @@ public InspectionResultsViewModel(RubberduckParserState state, IInspector inspec _refreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), async param => await Task.Run(() => ExecuteRefreshCommandAsync()), CanExecuteRefreshCommand); _disableInspectionCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand); _quickFixCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand); - _quickFixInModuleCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand); - _quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand); + _quickFixInModuleCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => _state.Status == ParserState.Ready); + _quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => _state.Status == ParserState.Ready); _copyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand); _openSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings); @@ -224,7 +223,15 @@ private set } private bool _canQuickFix; - public bool CanQuickFix { get { return _canQuickFix; } set { _canQuickFix = value; OnPropertyChanged(); } } + public bool CanQuickFix + { + get { return _canQuickFix; } + set + { + _canQuickFix = value; + OnPropertyChanged(); + } + } private bool _isBusy; public bool IsBusy { get { return _isBusy; } set { _isBusy = value; OnPropertyChanged(); } } @@ -335,7 +342,7 @@ private void ExecuteQuickFixCommand(object parameter) private bool CanExecuteQuickFixCommand(object parameter) { var quickFix = parameter as CodeInspectionQuickFix; - return !IsBusy && quickFix != null; + return !IsBusy && quickFix != null && _state.Status == ParserState.Ready; } private bool _canExecuteQuickFixInModule;