If the "onDemand" in the xml config is set to false ...
<Button id="Microsoft_ArcMapAddin1_ArcGISAddin1" onDemand="false"
class="ArcGISAddin1" message="Add-in command generated by Visual Studio project wizard."
caption="My Button" tip="Add-in command tooltip."
category="Add-In Controls" image="Images\ArcGISAddin1.png" />
The tool gets instantiated when Arcmap starts up (instead of when the first time the button is clicked), resulting in the OnUpdate being called every 300 or so millisecs ...
protected override void OnUpdate()
{
IEditor m_Editor = (ESRI.ArcGIS.Editor.IEditor)ArcMap.Application.FindExtensionByName("ESRI Object Editor");
if (m_Editor.EditState == ESRI.ArcGIS.Editor.esriEditState.esriStateEditing)
this.Enabled = true;
else
this.Enabled = false;
}
OnDemand is another word for "just in time". It seems natural that a tool that is in a disabled state at startup should be a just-in-time tool, however that doesn't appear possible. It would be useful if Esri enhanced this so that an Enabled could be set at design time in the xml.