public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
Application app = uiapp.Application;
if( null == _handler )
{
_handler
= new EventHandler<DocumentChangedEventArgs>(
OnDocumentChanged );
// Subscribe to DocumentChanged event
app.DocumentChanged += _handler;
}
else
{
app.DocumentChanged -= _handler;
_handler = null;
}
return Result.Succeeded;
}