19
19
using System . Threading . Tasks ;
20
20
using System . Windows . Forms ;
21
21
using Rubberduck . UI . SourceControl ;
22
+ using Rubberduck . VBEditor . Extensions ;
22
23
23
24
namespace Rubberduck
24
25
{
@@ -216,7 +217,7 @@ public void Shutdown()
216
217
#region sink handlers. todo: move to another class
217
218
async void sink_ProjectRemoved ( object sender , DispatcherEventArgs < VBProject > e )
218
219
{
219
- if ( ! _handleSinkEvents ) { return ; }
220
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
220
221
221
222
if ( e . Item . Protection == vbext_ProjectProtection . vbext_pp_locked )
222
223
{
@@ -256,7 +257,7 @@ async void sink_ProjectRemoved(object sender, DispatcherEventArgs<VBProject> e)
256
257
257
258
async void sink_ProjectAdded ( object sender , DispatcherEventArgs < VBProject > e )
258
259
{
259
- if ( ! _handleSinkEvents ) { return ; }
260
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
260
261
261
262
_logger . Debug ( "Project '{0}' was added." , e . Item . Name ) ;
262
263
if ( e . Item . Protection == vbext_ProjectProtection . vbext_pp_locked )
@@ -313,7 +314,7 @@ private void RegisterComponentsEventSink(VBComponents components, string project
313
314
314
315
async void sink_ComponentSelected ( object sender , DispatcherEventArgs < VBComponent > e )
315
316
{
316
- if ( ! _handleSinkEvents ) { return ; }
317
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
317
318
318
319
if ( ! _parser . State . AllDeclarations . Any ( ) )
319
320
{
@@ -326,7 +327,7 @@ async void sink_ComponentSelected(object sender, DispatcherEventArgs<VBComponent
326
327
327
328
async void sink_ComponentRenamed ( object sender , DispatcherRenamedEventArgs < VBComponent > e )
328
329
{
329
- if ( ! _handleSinkEvents ) { return ; }
330
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
330
331
331
332
if ( ! _parser . State . AllDeclarations . Any ( ) )
332
333
{
@@ -342,7 +343,7 @@ async void sink_ComponentRenamed(object sender, DispatcherRenamedEventArgs<VBCom
342
343
343
344
async void sink_ComponentRemoved ( object sender , DispatcherEventArgs < VBComponent > e )
344
345
{
345
- if ( ! _handleSinkEvents ) { return ; }
346
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
346
347
347
348
if ( ! _parser . State . AllDeclarations . Any ( ) )
348
349
{
@@ -357,7 +358,7 @@ async void sink_ComponentRemoved(object sender, DispatcherEventArgs<VBComponent>
357
358
358
359
async void sink_ComponentReloaded ( object sender , DispatcherEventArgs < VBComponent > e )
359
360
{
360
- if ( ! _handleSinkEvents ) { return ; }
361
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
361
362
362
363
if ( ! _parser . State . AllDeclarations . Any ( ) )
363
364
{
@@ -370,7 +371,7 @@ async void sink_ComponentReloaded(object sender, DispatcherEventArgs<VBComponent
370
371
371
372
async void sink_ComponentAdded ( object sender , DispatcherEventArgs < VBComponent > e )
372
373
{
373
- if ( ! _handleSinkEvents ) { return ; }
374
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
374
375
375
376
if ( ! _parser . State . AllDeclarations . Any ( ) )
376
377
{
@@ -385,7 +386,7 @@ async void sink_ComponentAdded(object sender, DispatcherEventArgs<VBComponent> e
385
386
386
387
async void sink_ComponentActivated ( object sender , DispatcherEventArgs < VBComponent > e )
387
388
{
388
- if ( ! _handleSinkEvents ) { return ; }
389
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
389
390
390
391
if ( ! _parser . State . AllDeclarations . Any ( ) )
391
392
{
@@ -398,7 +399,7 @@ async void sink_ComponentActivated(object sender, DispatcherEventArgs<VBComponen
398
399
399
400
async void sink_ProjectRenamed ( object sender , DispatcherRenamedEventArgs < VBProject > e )
400
401
{
401
- if ( ! _handleSinkEvents ) { return ; }
402
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
402
403
403
404
if ( ! _parser . State . AllDeclarations . Any ( ) )
404
405
{
@@ -415,7 +416,7 @@ async void sink_ProjectRenamed(object sender, DispatcherRenamedEventArgs<VBProje
415
416
416
417
async void sink_ProjectActivated ( object sender , DispatcherEventArgs < VBProject > e )
417
418
{
418
- if ( ! _handleSinkEvents ) { return ; }
419
+ if ( ! _handleSinkEvents || ! _vbe . IsInDesignMode ( ) ) { return ; }
419
420
420
421
if ( ! _parser . State . AllDeclarations . Any ( ) )
421
422
{
0 commit comments