@@ -50,19 +50,22 @@ public AddinModel SelectedCommandItem
5050 {
5151 get
5252 {
53- if ( selectedCommandItem != null && selectedCommandItem . IsParentTree == true && IsTabCmdSelected )
54- {
55- IsCanRun = false ;
56- MAddinManagerBase . ActiveCmd = selectedCommandItem . Addin ;
57- }
58- else if ( selectedCommandItem != null && selectedCommandItem . IsParentTree == false && IsTabCmdSelected )
53+ if ( IsTabCmdSelected )
5954 {
60- IsCanRun = true ;
61- MAddinManagerBase . ActiveCmdItem = selectedCommandItem . AddinItem ;
62- MAddinManagerBase . ActiveCmd = selectedCommandItem . Addin ;
63- VendorDescription = MAddinManagerBase . ActiveCmdItem . Description ;
55+ if ( selectedCommandItem != null && selectedCommandItem . IsParentTree == true )
56+ {
57+ IsCanRun = false ;
58+ MAddinManagerBase . ActiveCmd = selectedCommandItem . Addin ;
59+ }
60+ else if ( selectedCommandItem != null && selectedCommandItem . IsParentTree == false )
61+ {
62+ IsCanRun = true ;
63+ MAddinManagerBase . ActiveCmdItem = selectedCommandItem . AddinItem ;
64+ MAddinManagerBase . ActiveCmd = selectedCommandItem . Addin ;
65+ VendorDescription = MAddinManagerBase . ActiveCmdItem . Description ;
66+ }
67+ else IsCanRun = false ;
6468 }
65- else IsCanRun = false ;
6669
6770 return selectedCommandItem ;
6871 }
@@ -88,15 +91,21 @@ public AddinModel SelectedAppItem
8891 {
8992 get
9093 {
91- if ( selectedAppItem != null && selectedAppItem . IsParentTree == true && IsTabAppSelected )
92- {
93- MAddinManagerBase . ActiveApp = selectedAppItem . Addin ;
94- }
95- else if ( selectedAppItem != null && selectedAppItem . IsParentTree == false && IsTabAppSelected )
94+ if ( IsTabAppSelected )
9695 {
97- MAddinManagerBase . ActiveAppItem = selectedAppItem . AddinItem ;
98- MAddinManagerBase . ActiveApp = selectedAppItem . Addin ;
99- VendorDescription = MAddinManagerBase . ActiveAppItem . Description ;
96+ if ( selectedAppItem != null && selectedAppItem . IsParentTree == true )
97+ {
98+ IsCanRun = false ;
99+ MAddinManagerBase . ActiveApp = selectedAppItem . Addin ;
100+ }
101+ else if ( selectedAppItem != null && selectedAppItem . IsParentTree == false )
102+ {
103+ IsCanRun = true ;
104+ MAddinManagerBase . ActiveAppItem = selectedAppItem . AddinItem ;
105+ MAddinManagerBase . ActiveApp = selectedAppItem . Addin ;
106+ VendorDescription = MAddinManagerBase . ActiveAppItem . Description ;
107+ }
108+ else IsCanRun = false ;
100109 }
101110
102111 return selectedAppItem ;
@@ -197,11 +206,7 @@ public bool IsTabCmdSelected
197206
198207 public bool IsTabAppSelected
199208 {
200- get
201- {
202- if ( isTabAppSelected ) IsCanRun = false ;
203- return isTabAppSelected ;
204- }
209+ get => isTabAppSelected ;
205210 set => OnPropertyChanged ( ref isTabAppSelected , value ) ;
206211 }
207212
@@ -339,17 +344,35 @@ public void ExecuteAddinCommandClick()
339344 {
340345 try
341346 {
342- if ( SelectedCommandItem ? . IsParentTree == false )
347+ if ( IsTabCmdSelected )
343348 {
344- MAddinManagerBase . ActiveCmd = SelectedCommandItem . Addin ;
345- MAddinManagerBase . ActiveCmdItem = SelectedCommandItem . AddinItem ;
346- CheckCountSelected ( CommandItems , out var result ) ;
347- if ( result > 0 )
349+ if ( SelectedCommandItem ? . IsParentTree == false )
348350 {
349- App . FrmAddInManager . Close ( ) ;
350- RevitEvent . Run ( Execute , false , null , false ) ;
351+ MAddinManagerBase . ActiveCmd = SelectedCommandItem . Addin ;
352+ MAddinManagerBase . ActiveCmdItem = SelectedCommandItem . AddinItem ;
353+ CheckCountSelected ( CommandItems , out var result ) ;
354+ if ( result > 0 )
355+ {
356+ App . FrmAddInManager . Close ( ) ;
357+ RevitEvent . Run ( Execute , false , null , false ) ;
358+ }
359+ }
360+ }
361+ else if ( IsTabAppSelected )
362+ {
363+ if ( SelectedAppItem ? . IsParentTree == false )
364+ {
365+ MAddinManagerBase . ActiveApp = SelectedAppItem . Addin ;
366+ MAddinManagerBase . ActiveAppItem = SelectedAppItem . AddinItem ;
367+ CheckCountSelected ( ApplicationItems , out var result ) ;
368+ if ( result > 0 )
369+ {
370+ App . FrmAddInManager . Close ( ) ;
371+ RevitEvent . Run ( Execute , false , null , false ) ;
372+ }
351373 }
352374 }
375+
353376 }
354377 catch ( Exception e )
355378 {
@@ -360,11 +383,23 @@ public void ExecuteAddinCommandClick()
360383 private void Execute ( )
361384 {
362385 string message = Message ;
363- #if R19 || R20 || R21 || R22 || R23 || R24
364- MAddinManagerBase . RunActiveCommand ( this , ExternalCommandData , ref message , Elements ) ;
365- #else
366- MAddinManagerBase . RunActiveCommand ( ExternalCommandData , ref message , Elements ) ;
367- #endif
386+ if ( IsTabCmdSelected )
387+ {
388+ #if R19 || R20 || R21 || R22 || R23 || R24
389+ MAddinManagerBase . RunActiveCommand ( this , ExternalCommandData , ref message , Elements ) ;
390+ #else
391+ MAddinManagerBase . RunActiveCommand ( ExternalCommandData , ref message , Elements ) ;
392+ #endif
393+ }
394+ else if ( IsTabAppSelected )
395+ {
396+ #if R19 || R20 || R21 || R22 || R23 || R24
397+ MAddinManagerBase . RunActiveApp ( this , App . UIControlledApplication ) ;
398+ #else
399+ MAddinManagerBase . RunActiveApp ( App . UIControlledApplication ) ;
400+ #endif
401+ }
402+
368403 }
369404
370405 private void OpenLcAssemblyCommandClick ( )
0 commit comments