VB.NET Addin for ArcMap 10.3 may be causing my Table of Contents to constantly refresh. I have a custom toolbar with a few buttons. I want all of the buttons to be disabled when in Data View and only be enabled in Layout View. I believe that this code works, but is there a better way to do this?
Instead of putting this code on each button, can it be applied to the whole toolbar instead? I put a line of code to write a snippet of text to a log file when the OnUpdate routine is called and the file quickly got huge. That leads me to believe that this code is constantly running.
Public Class btn_DrawBorder Inherits ESRI.ArcGIS.Desktop.AddIns.Button Private m_Application As IApplication Private m_MxDoc As IMxDocument Public Sub New() m_Application = My.ArcMap.Application m_MxDoc = My.ArcMap.Document End Sub Protected Overrides Sub OnUpdate() If TypeOf m_MxDoc.ActiveView Is IPageLayout Then Enabled = True ElseIf TypeOf m_MxDoc.ActiveView Is IMap Then Enabled = False End If End Sub End Class