/// <summary>
        /// SECTION: Remove the event handlers for all of the IActiveViewEvents
        /// </summary>
        /// <param name="map">An IMap interface for which Event Handlers to remove.</param>
        /// <remarks>You do not have to remove Event Handlers for every event. You can pick and
        /// choose which ones you want to use.</remarks>
        private void RemoveSetUpDocumentEvents(ESRI.ArcGIS.Framework.IDocument myDocument)
        {
            //parameter check
            if (myDocument == null)
            {
                return;
            }
            //ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event docEvents = myDocument as ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event;
            m_docEvents = myDocument as IDocumentEvents_Event;

            // Remove ItemAdded and ItemDeletd and ItemReordered and ContentsChanged Event Handler
            m_docEvents.NewDocument  -= m_DocumentEventNewDocument;
            m_docEvents.OpenDocument -= m_DocumentEventOpenDocument;
        }
        /// <summary>
        /// Set up the wiring of the events.
        /// </summary>
        /// <param name="myDocument"></param>
        /// <remarks></remarks>
        private void SetupEvents(ESRI.ArcGIS.Framework.IDocument myDocument)
        {
            //parameter check:
            if (myDocument == null)
            {
                return;
            }
            //IDocumentEvents_Event docEvents = myDocument as ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event;
            m_docEvents = myDocument as IDocumentEvents_Event;

            //// Create an instance of the delegate, add it to NewDocument event:
            m_DocumentEventNewDocument = new IDocumentEvents_NewDocumentEventHandler(OnNewDocument);
            m_docEvents.NewDocument   += m_DocumentEventNewDocument;

            //// Create an instance of the delegate, add it to OpenDocument event:
            m_DocumentEventOpenDocument = new IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument);
            m_docEvents.OpenDocument   += m_DocumentEventOpenDocument;
        }
Example #3
0
 private void SetUpDocumentEvent(ESRI.ArcGIS.Framework.IDocument myDocument)
 {
     m_docEvents               = myDocument as ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event;
     m_docEvents.NewDocument  += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_NewDocumentEventHandler(OnNewDocument);
     m_docEvents.OpenDocument += new ESRI.ArcGIS.ArcMapUI.IDocumentEvents_OpenDocumentEventHandler(OnOpenDocument);
 }