Listen to ArcCatalog Events in .NET

10-22-2012 07:01 AM
Occasional Contributor
Hi All,

I would like listen to the ArcCatalog application event IGxApplicationEvents.OnViewChanged() in a Desktop 10.0 .NET extension, but how do I get this event? According to I would expect:

using ESRI.ArcGIS.ArcCatalog;
using ESRI.ArcGIS.Catalog;
using ESRI.ArcGIS.CatalogUI;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Framework;

        private void registerEvents(IGxApplication app)
            IGxApplicationEvents_Event events = (IGxApplicationEvents_Event)app;
            events.OnViewChanged += this.onAppViewChanged;

However, I cannot find an interface IGxApplicationEvents_Event. Am I missing something...? There is IGxApplicationEvents in ESRI.ArcGIS.CatalogUI, sure, but that doesn't seem to allow me to register an event, just to fire it.
0 Kudos
2 Replies
Regular Contributor II
IGxApplicationEvents_Event won't show up in intellisense, or any where else but it should still compile and work.  Some quirk of outbound interfaces I have been told.
0 Kudos
Occasional Contributor
IGxApplicationEvents_Event won't show up in intellisense, or anywhere else but it should still compile and work.

Hi Alex,

Unfortunately that's not the case. If I declare

        private ESRI.ArcGIS.ArcCatalog.IGxDocumentEvents_Event _docEvents;
        private ESRI.ArcGIS.CatalogUI.IGxApplicationEvents_Event _events;

the second line will cause a build failure, but the first line will not. Also, the IGxDocumentEvents_Event interface is shown by intellisense and marked green by Resharper, while the 2nd line is not shown and marked red. Also, I can see the IGxApplicationEvents interface in the CatalogUI library.

Did Esri forget to expose the outbound interface of IGxApplicationEvents??
0 Kudos