コード例 #1
0
        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);
            }
        }
コード例 #2
0
        protected override void OnUpdate()
        {
            if (m_schematicTarget == null)
            {
                IExtension        extention = null;
                IExtensionManager extensionManager;

                extensionManager = (IExtensionManager)m_application;
                for (int i = 0; i < extensionManager.ExtensionCount; i++)
                {
                    extention = extensionManager.get_Extension(i);
                    if (extention.Name.ToLower() == "esri schematic extension")
                    {
                        break;
                    }
                }

                if (extention != null)
                {
                    SchematicExtension schematicExtension = extention as SchematicExtension;
                    m_schematicTarget = schematicExtension as ISchematicTarget;
                }
            }

            if (m_schematicTarget != null)
            {
                ISchematicLayer schematicLayer;
                schematicLayer = m_schematicTarget.SchematicTarget;

                if (schematicLayer == null)
                {
                    Enabled = false;
                    if (m_formAuto != null)
                    {
                        m_formAuto.SetAutoOff(true);
                    }
                }
                else if (schematicLayer.IsEditingSchematicDiagram())
                {
                    Enabled = true;
                }
                else
                {
                    Enabled = false;
                    if (m_formAuto != null)
                    {
                        m_formAuto.SetAutoOff(true);
                    }
                }
            }
            else
            {
                Enabled = false;
                if (m_formAuto != null)
                {
                    m_formAuto.SetAutoOff(true);
                }
            }
        }
コード例 #3
0
		protected override void OnUpdate()
		{
			if (m_schematicTarget == null)
			{
				IExtension extention = null;
				IExtensionManager extensionManager;

				extensionManager = (IExtensionManager)m_application;
				for (int i = 0; i < extensionManager.ExtensionCount; i++)
				{
					extention = extensionManager.get_Extension(i);
                    if (extention.Name.ToLower() == "esri schematic extension")
                        break;
				}

				if (extention != null)
				{
					SchematicExtension schematicExtension = extention as SchematicExtension;
					m_schematicTarget = schematicExtension as ISchematicTarget;
				}
			}

			if (m_schematicTarget != null)
			{
				ISchematicLayer schematicLayer;
				schematicLayer = m_schematicTarget.SchematicTarget;

				if (schematicLayer == null)
				{
					Enabled = false;
					if (m_formAuto != null) m_formAuto.SetAutoOff(true);
				}
				else if (schematicLayer.IsEditingSchematicDiagram())
					Enabled = true;
				else
				{
					Enabled = false;
					if (m_formAuto != null) m_formAuto.SetAutoOff(true);
				}
			}
			else
			{
				Enabled = false;
				if (m_formAuto != null) m_formAuto.SetAutoOff(true);
			}
		}