Ejemplo n.º 1
0
        /// <summary>
        /// When select any I/O Modules, replace related APAX I/O module (usercontrol) at rignt panel
        /// </summary>
        /// <param name="e"></param>
        private void AfterSelect_LocalSlot(TreeNode e)
        {
            string strSelectModuleId = string.Empty;
            int    iSlot;
            int    iCmpLength = 4;
            Form   IO_Module;

            iSlot             = Convert.ToInt32(e.Tag);
            strSelectModuleId = m_szSlotInfo[iSlot].ToUpper();

            DialogResult dialogResult = MessageBox.Show("Do you want to demo APAX-" + e.Text + "?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (dialogResult == DialogResult.No)
            {
                return;
            }

            if ((string.Compare(e.Text, 0, "Local System", 0, (iCmpLength + 1)) == 0))
            {
                return;
            }

            if (IsApaxCouplerSupportModule(strSelectModuleId) == false)
            {
                MessageBox.Show(("Not support device APAX-" + e.Text), "Warn");
                return;
            }

            if (strSelectModuleId == APAX_5013_STR)
            {
                IO_Module = new Form_APAX_5013(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5017_STR)
            {
                IO_Module = new Form_APAX_5017(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5017H_STR)
            {
                IO_Module = new Form_APAX_5017H(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5017PE_STR)
            {
                IO_Module = new Form_APAX_5017PE(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5018_STR)
            {
                IO_Module = new Form_APAX_5018(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5028_STR)
            {
                IO_Module = new Form_APAX_5028(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5040_STR)
            {
                IO_Module = new Form_APAX_5040(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5040PE_STR)
            {
                IO_Module = new Form_APAX_5040PE(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5045_STR)
            {
                IO_Module = new Form_APAX_5045(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5046_STR)
            {
                IO_Module = new Form_APAX_5046(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5046SO_STR)
            {
                IO_Module = new Form_APAX_5046SO(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5060_STR)
            {
                IO_Module = new Form_APAX_5060(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5060PE_STR)
            {
                IO_Module = new Form_APAX_5060PE(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5080_STR)
            {
                IO_Module = new Form_APAX_5080(iSlot, m_ScanTime_LocalSys);
            }
            else if (strSelectModuleId == APAX_5082_STR)
            {
                IO_Module = new Form_APAX_5082(iSlot, m_ScanTime_LocalSys);
            }
            else
            {
                MessageBox.Show(("Not support device APAX-" + e.Text), "Warn");
                return;
            }

            IO_Module.TopMost = true;
            IO_Module.ShowDialog();
            IO_Module = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// When select any I/O Modules, show related APAX I/O module at rignt Form
        /// </summary>
        /// <param name="e"></param>
        private void AfterSelect_CouplerSlot(TreeNode e)
        {
            string strSelectModuleId = string.Empty;
            int    iSlot;

            iSlot = Convert.ToInt32(e.Tag);
            Form apaxModule;

            strSelectModuleId = m_szSlotInfo[iSlot].ToUpper();

            if ((MessageBox.Show("Do you want to demo APAX-" + e.Text + "?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No))
            {
                return;
            }

            if (IsApaxCouplerSupportModule(strSelectModuleId) == false)
            {
                MessageBox.Show(("Not support APAX" + (e.Text + " module")), "Error");
                return;
            }

            if (strSelectModuleId == APAX_5013_STR)
            {
                apaxModule = new Form_APAX_5013(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5017_STR)
            {
                apaxModule = new Form_APAX_5017(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5017H_STR)
            {
                apaxModule = new Form_APAX_5017H(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5017PE_STR)
            {
                apaxModule = new Form_APAX_5017PE(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5018_STR)
            {
                apaxModule = new Form_APAX_5018(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5028_STR)
            {
                apaxModule = new Form_APAX_5028(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5040_STR)
            {
                apaxModule = new Form_APAX_5040(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5040PE_STR)
            {
                apaxModule = new Form_APAX_5040PE(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5045_STR)
            {
                apaxModule = new Form_APAX_5045(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5046_STR)
            {
                apaxModule = new Form_APAX_5046(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5046SO_STR)
            {
                apaxModule = new Form_APAX_5046SO(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5060_STR)
            {
                apaxModule = new Form_APAX_5060(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5060PE_STR)
            {
                apaxModule = new Form_APAX_5060PE(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5080_STR)
            {
                apaxModule = new Form_APAX_5080(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if (strSelectModuleId == APAX_5082_STR)
            {
                apaxModule = new Form_APAX_5082(m_szIP, ((byte)(iSlot)), m_ScanTime_LocalSys[0], adamType);
            }
            else if ((adamType == AdamType.Apax5070) && (strSelectModuleId == APAX_5090_STR) && (m_adamObject.HardwareType[0] != 0x01 && m_adamObject.HardwareType[1] != 0x01))
            {
                apaxModule = new Form_APAX_5090(m_szIP, ((byte)(iSlot)), adamType);
            }
            else
            {
                MessageBox.Show(("Not support APAX" + (e.Text + " module")), "Error");
                return;
            }

            apaxModule.ShowDialog();
            apaxModule = null;
            GC.Collect();
        }