Arcobjects 10.3.1: Stop items from being deleted from the TOC

المشرف العام

Administrator
طاقم الإدارة
I am writting addin using arcobjects C#. I have setup the following listeners, but they are not being hit. Any suggestions in what is wrong would be great.

// at the top of the addin.Extension class

...private static IActiveViewEvents_ItemAddedEventHandler tocAddHandler;private static IActiveViewEvents_ItemDeletedEventHandler tocDeleteHandler;...protected override void OnStartup(){ WireDocumentEvents(); }.... private void WireDocumentEvents(){ArcMap.Events.OpenDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(PostMxDLoad);}...private void PostMxDLoad(){... some other stuff tocDeleteHandler = new IActiveViewEvents_ItemDeletedEventHandler(SettingsMgr.TableofContents.OnTOCItemDeleted);((IActiveViewEvents_Event)ArcMap.Document.FocusMap).ItemDeleted += tocDeleteHandler;tocAddHandler = new IActiveViewEvents_ItemAddedEventHandler(SettingsMgr.TableofContents.OnTOCItemAdded);((IActiveViewEvents_Event)ArcMap.Document.FocusMap).ItemAdded += tocAddHandler;}

أكثر...
 
أعلى