<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Event Monitor in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610672#M53404</link>
    <description>&lt;P&gt;Bit of a long shot here, but does anyone know of an application or piece of code which monitors AutoCAD and reports when events are triggered?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to see when events are triggered in relation to each other and wonder if anyone else has attempted anything like this in the past?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
    <pubDate>Fri, 07 Sep 2012 10:28:04 GMT</pubDate>
    <dc:creator>dbrblg</dc:creator>
    <dc:date>2012-09-07T10:28:04Z</dc:date>
    <item>
      <title>Event Monitor</title>
      <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610672#M53404</link>
      <description>&lt;P&gt;Bit of a long shot here, but does anyone know of an application or piece of code which monitors AutoCAD and reports when events are triggered?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to see when events are triggered in relation to each other and wonder if anyone else has attempted anything like this in the past?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 10:28:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610672#M53404</guid>
      <dc:creator>dbrblg</dc:creator>
      <dc:date>2012-09-07T10:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Event Monitor</title>
      <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610764#M53405</link>
      <description>&lt;P&gt;Are you talking about watching events internally to AutoCAD or externally from a systems' standpoint?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 11:45:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610764#M53405</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-07T11:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Event Monitor</title>
      <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610802#M53406</link>
      <description>&lt;P&gt;Watching events internally to AutoCAD, although if the latter existed i'd have that too&amp;nbsp;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 12:10:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610802#M53406</guid>
      <dc:creator>dbrblg</dc:creator>
      <dc:date>2012-09-07T12:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Event Monitor</title>
      <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610936#M53407</link>
      <description>&lt;P&gt;Cool... I just didn't want to mention anything that doesn't apply.&amp;nbsp; You can find some things on it here: &lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/"&gt;http://adndevblog.typepad.com/autocad/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After doing a search I found these specifically:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/2012/08/managing-events-at-a-per-document-level.html"&gt;http://adndevblog.typepad.com/autocad/2012/08/managing-events-at-a-per-document-level.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://adndevblog.typepad.com/autocad/2012/05/handling-events-in-vbnet.html"&gt;http://adndevblog.typepad.com/autocad/2012/05/handling-events-in-vbnet.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;(there was more so who knows there may be something more specific to what you're looking for.&amp;nbsp; Also, I didn't look at these in any great detail so hopefully their accurate).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's something I did some time back in a project where I needed to track a few application-level events... specifically window moved and sized events as well as determining whether or not AutoCAD is quiescent before moving on to a specific process.&amp;nbsp; I've modified it so that you can use it to illustrate in your own project (no command is necessary... just netload and try a few things out in AutoCAD).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Internal.Reactors;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;

[assembly: ExtensionApplication(typeof(AutoCADEvents.CADApplicationExtension))]

namespace AutoCADEvents
{

    public sealed class CADApplicationExtension : IExtensionApplication
    {

        #region IExtensionApplication Interface Implementation To Register/Deregister Events

        void IExtensionApplication.Initialize()
        {
            ApplicationEventManager appEventMgr = ApplicationEventManager.Instance();
            appEventMgr.ApplicationMainWindowMoved += new ApplicationMainWindowMovedEventHandler(appEventMgr_ApplicationMainWindowMoved);
            appEventMgr.ApplicationMainWindowSized += new ApplicationMainWindowSizedEventHandler(appEventMgr_ApplicationMainWindowSized);


            Application.DocumentManager.DocumentBecameCurrent += new DocumentCollectionEventHandler(DocumentManager_DocumentBecameCurrent);
            Application.DocumentManager.DocumentToBeDeactivated += new DocumentCollectionEventHandler(DocumentManager_DocumentToBeDeactivated);
            Application.DocumentManager.DocumentToBeDestroyed += new DocumentCollectionEventHandler(DocumentManager_DocumentToBeDestroyed);
            Application.DocumentManager.DocumentDestroyed += new DocumentDestroyedEventHandler(DocumentManager_DocumentDestroyed);

            Document activeDoc = Application.DocumentManager.MdiActiveDocument;
            activeDoc.Editor.EnteringQuiescentState += new EventHandler(ed_EnteringQuiescentState);
            activeDoc.Editor.LeavingQuiescentState += new EventHandler(ed_LeavingQuiescentState);
            activeDoc.CommandCancelled += new CommandEventHandler(Document_CommandCancelled);
        }


        void IExtensionApplication.Terminate()
        {
            Application.DocumentManager.DocumentBecameCurrent -= new DocumentCollectionEventHandler(DocumentManager_DocumentBecameCurrent);
            Application.DocumentManager.DocumentToBeDeactivated -= new DocumentCollectionEventHandler(DocumentManager_DocumentToBeDeactivated);
            Application.DocumentManager.DocumentToBeDestroyed -= new DocumentCollectionEventHandler(DocumentManager_DocumentToBeDestroyed);
            Application.DocumentManager.DocumentDestroyed -= new DocumentDestroyedEventHandler(DocumentManager_DocumentDestroyed);

        }

        #endregion

        #region A Couple Window Events


        void appEventMgr_ApplicationMainWindowSized(object sender, EventArgs e)
        {
            try
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage("\nAutoCAD's window size just changed.\n");
            }
            catch { }
        }

        void appEventMgr_ApplicationMainWindowMoved(object sender, EventArgs e)
        {
            try
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage("\nAutoCAD's window was just moved.\n");
            }
            catch { }
        }

        #endregion

        #region Some Document Events Used to Determine Application Quiescence In This Example

        void DocumentManager_DocumentBecameCurrent(object sender, DocumentCollectionEventArgs e)
        {
            Editor ed = e.Document.Editor;
            ed.EnteringQuiescentState += new EventHandler(ed_EnteringQuiescentState);
            ed.LeavingQuiescentState += new EventHandler(ed_LeavingQuiescentState);
            e.Document.CommandCancelled += new CommandEventHandler(Document_CommandCancelled);
        }

        void DocumentManager_DocumentToBeDeactivated(object sender, DocumentCollectionEventArgs e)
        {
            Editor ed = e.Document.Editor;
            ed.EnteringQuiescentState -= new EventHandler(ed_EnteringQuiescentState);
            ed.LeavingQuiescentState -= new EventHandler(ed_LeavingQuiescentState);
            e.Document.CommandCancelled -= new CommandEventHandler(Document_CommandCancelled);
        }

        void DocumentManager_DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e)
        {
            Editor ed = e.Document.Editor;
            ed.EnteringQuiescentState -= new EventHandler(ed_EnteringQuiescentState);
            ed.LeavingQuiescentState -= new EventHandler(ed_LeavingQuiescentState);
            e.Document.CommandCancelled -= new CommandEventHandler(Document_CommandCancelled);

        }

        void DocumentManager_DocumentDestroyed(object sender, DocumentDestroyedEventArgs e)
        {
            //If in Zero-Document state, create new drawing to make active

        }



        #endregion

        #region Event Handlers

        public static void ed_EnteringQuiescentState(object sender, EventArgs e)
        {
            Editor ed = sender as Editor;
            ed.WriteMessage("\nEntering Quiescence");
        }

        void ed_LeavingQuiescentState(object sender, EventArgs e)
        {
            Editor ed = sender as Editor;
            ed.WriteMessage("\nLeaving Quiescence");
        }

        void Document_CommandCancelled(object sender, CommandEventArgs e)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            ed.WriteMessage("\nA command was just cancelled.");
        }

        #endregion

    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 13:28:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3610936#M53407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-07T13:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Event Monitor</title>
      <link>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3611178#M53408</link>
      <description>&lt;P&gt;Mgddbg has functionality to print events and some details to command line if you have not looked at that.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2012 15:54:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/event-monitor/m-p/3611178#M53408</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2012-09-07T15:54:07Z</dc:date>
    </item>
  </channel>
</rss>

