public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; Application app = uiapp.Application; if (null == _updater) { _updater = new ElevationWatcherUpdater( app.ActiveAddInId); // Register updater to react to view creation UpdaterRegistry.RegisterUpdater(_updater); ElementCategoryFilter f = new ElementCategoryFilter( BuiltInCategory.OST_Views); UpdaterRegistry.AddTrigger( _updater.GetUpdaterId(), f, Element.GetChangeTypeElementAddition()); } else { UpdaterRegistry.UnregisterUpdater( _updater.GetUpdaterId()); _updater = null; } return(Result.Succeeded); }
public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; Application app = uiapp.Application; if( null == _updater ) { _updater = new ElevationWatcherUpdater( app.ActiveAddInId ); // Register updater to react to view creation UpdaterRegistry.RegisterUpdater( _updater ); ElementCategoryFilter f = new ElementCategoryFilter( BuiltInCategory.OST_Views ); UpdaterRegistry.AddTrigger( _updater.GetUpdaterId(), f, Element.GetChangeTypeElementAddition() ); } else { UpdaterRegistry.UnregisterUpdater( _updater.GetUpdaterId() ); _updater = null; } return Result.Succeeded; }