ArcMap Interaction

517
1
09-27-2011 12:00 PM
JamesVillanueva
New Contributor III
Are there any samples which show interaction with ArcMap such as getting a reference to IApplication and interacting with things such as selected features?
0 Kudos
1 Reply
JamesVillanueva
New Contributor III
I managed to solve the issue. Here is my solution:      

                ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = null;
                ESRI.ArcGIS.Framework.IApplication app = null;

                //get instance of the running AppRot
                ESRI.ArcGIS.Framework.IAppROT appRot = new ESRI.ArcGIS.Framework.AppROTClass();
               
                //Loop through running application
                for (int i = 0; i < appRot.Count; i++)
                {
                    app = (ESRI.ArcGIS.Framework.IApplication)appRot.get_Item(i);
                    mxDoc = app.Document as ESRI.ArcGIS.ArcMapUI.IMxDocument;

                    //find correct instance by job name in application caption
                    if (mxDoc != null && app.Caption.ToLower().Contains("job_" + JobID))
                    {
                        i = appRot.Count;
                    }
                    else
                    {
                        app = null;
                        mxDoc = null;
                    }

                }
0 Kudos