private void SetTargetLayer() { try { if (m_schematicLayer == null) { IExtension extention = null; IExtensionManager extensionManager; extensionManager = (IExtensionManager)m_app; extention = extensionManager.FindExtension("SchematicUI.SchematicExtension"); if (extention == null) { Enabled = false; } else { m_schematicExtension = extention; ISchematicTarget target = m_schematicExtension as ISchematicTarget; if (target != null) { m_schematicLayer = target.SchematicTarget; } } } } catch (System.Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); } }
/// <summary> /// Returns the editor /// </summary> /// <param name="mxApplication"></param> /// <returns>the editor</returns> public IEditor3 GetEditorFromArcMap(IMxApplication mxApplication) { if (mxApplication == null) { return(null); } ESRI.ArcGIS.esriSystem.UID uid = new ESRI.ArcGIS.esriSystem.UIDClass(); uid.Value = "{F8842F20-BB23-11D0-802B-0000F8037368}"; ESRI.ArcGIS.Framework.IApplication application = mxApplication as ESRI.ArcGIS.Framework.IApplication; // Dynamic Cast ESRI.ArcGIS.esriSystem.IExtension extension = application.FindExtensionByCLSID(uid); ESRI.ArcGIS.Editor.IEditor3 editor3 = extension as ESRI.ArcGIS.Editor.IEditor3; // Dynamic Cast return(editor3); }
private void SetTargetLayer() { try { if (m_schematicLayer == null) { IExtension extention = null; IExtensionManager extensionManager; extensionManager = (IExtensionManager)m_app; extention = extensionManager.FindExtension("SchematicUI.SchematicExtension"); if (extention == null) Enabled = false; else { m_schematicExtension = extention; ISchematicTarget target = m_schematicExtension as ISchematicTarget; if (target != null) m_schematicLayer = target.SchematicTarget; } } } catch (System.Exception e) { System.Windows.Forms.MessageBox.Show(e.Message); } }