I am converting some old tools to the new Add-In format and have noticed that the constructor is no longer being called during startup, instead it is being called when the tool is clicked for the first time (second and subsequent call OnActivate only).
This particular tool is in a toolbar add-in and is of type ESRI.ArcGIS.Desktop.AddIns.Tool and should only be enabled if ArcMap is currently editing. Previously the constructor was called and set the tool.enabled = false arbitrarily (as you can't be editing on startup) and added an event handler for IEditEvents_OnStartEditingEventHandler which set the too.enabled = true (and stop editing too, enabled = false).
Now that the tool is made into an add in I discovered by step-debugging that the constructor for the tool isn't called until the tool is clicked. After clicking the tool behaves in the intended manner as the events are wired. Is there a way to call the constructors during ArcMap startup, soon after or does anybody know of any other workaround?
Answer
In config.esriaddinx
, set the tool's onDemand
property to false
. Similarly, if you have any extensions that need to be initialized at startup, set its autoLoad
property to true
.
No comments:
Post a Comment