File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 15
15
16
16
namespace Rubberduck . UI . Command
17
17
{
18
+ [ ComVisible ( false ) ]
19
+ public class ReparseCancellationFlag
20
+ {
21
+ public bool Canceled { get ; set ; }
22
+ }
23
+
18
24
[ ComVisible ( false ) ]
19
25
public class ReparseCommand : CommandBase
20
26
{
@@ -50,13 +56,21 @@ protected override void OnExecute(object parameter)
50
56
{
51
57
if ( ! VerifyCompileOnDemand ( ) )
52
58
{
59
+ if ( parameter is ReparseCancellationFlag cancellation )
60
+ {
61
+ cancellation . Canceled = true ;
62
+ }
53
63
return ;
54
64
}
55
65
56
66
if ( AreAllProjectsCompiled ( out var failedNames ) )
57
67
{
58
68
if ( ! PromptUserToContinue ( failedNames ) )
59
69
{
70
+ if ( parameter is ReparseCancellationFlag cancellation )
71
+ {
72
+ cancellation . Canceled = true ;
73
+ }
60
74
return ;
61
75
}
62
76
}
Original file line number Diff line number Diff line change @@ -94,7 +94,12 @@ public InspectionResultsViewModel(
94
94
{
95
95
IsRefreshing = true ;
96
96
IsBusy = true ;
97
- reparseCommand . Execute ( o ) ;
97
+ var cancellation = new ReparseCancellationFlag ( ) ;
98
+ reparseCommand . Execute ( cancellation ) ;
99
+ if ( cancellation . Canceled )
100
+ {
101
+ IsBusy = false ;
102
+ }
98
103
} ,
99
104
o => ! IsBusy && reparseCommand . CanExecute ( o ) ) ;
100
105
@@ -340,8 +345,6 @@ public bool Unparsed
340
345
private bool _runInspectionsOnReparse ;
341
346
private void HandleStateChanged ( object sender , ParserStateEventArgs e )
342
347
{
343
- Unparsed = false ;
344
-
345
348
if ( ! IsRefreshing && ( _state . Status == ParserState . Pending || _state . Status == ParserState . Error || _state . Status == ParserState . ResolverError ) )
346
349
{
347
350
IsBusy = false ;
@@ -391,6 +394,8 @@ private async void RefreshInspections(CancellationToken token)
391
394
stopwatch . Stop ( ) ;
392
395
LogManager . GetCurrentClassLogger ( ) . Trace ( "Inspection results returned in {0}ms" , stopwatch . ElapsedMilliseconds ) ;
393
396
397
+ Unparsed = false ;
398
+
394
399
_uiDispatcher . Invoke ( ( ) =>
395
400
{
396
401
stopwatch = Stopwatch . StartNew ( ) ;
You can’t perform that action at this time.
0 commit comments