コード例 #1
0
        override public bool Init(HardWareInfoBase infoHardWare)
        {
            // Global.logger.Info("初始化雷塞IO卡");
            LEISAIInputOutputInfo tempInfo = (LEISAIInputOutputInfo)infoHardWare;

            if (nCardTotal > 0)
            {
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK  = true;
                    usCardNo = (ushort)tempInfo.iCardNo;
                }
                else
                {
                    bInitOK = false;
                    return(false);
                }
            }
            else
            {
                nCardTotal = LTDIO.ioc_board_init();
                if (nCardTotal <= 0)//控制卡初始化
                {
                    //  Global.logger.Error("初始化雷塞IO卡失败");
                    bInitOK = false;
                    return(false);
                }
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    //    Global.logger.Info("初始化雷塞IO卡成功");
                    bInitOK  = true;
                    usCardNo = (ushort)tempInfo.iCardNo;
                }
                else
                {
                    //     Global.logger.Error("初始化雷塞IO卡失败");
                    bInitOK = false;
                    return(false);
                }
            }
            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
コード例 #2
0
ファイル: FormHardSetting.cs プロジェクト: houxpGit/12
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (textBoxHardWareName.Text == "")
     {
         return;
     }
     try
     {
         #region Demo
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.Demo)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputCard)
             {
                 DemoInputInfo demoInputInfo = new DemoInputInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputOutputCard)
             {
                 DemoInputOutputInfo demoInfo = new DemoInputOutputInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 DemoMCInfo demoInfo = new DemoMCInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.OutputCard)
             {
                 DemoOutputInfo demoInfo = new DemoOutputInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
         }
         #endregion
         #region LEISAI
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.LEADTECH)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputCard)
             {
                 LEISAIInputInfo demoInputInfo = new LEISAIInputInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputOutputCard)
             {
                 LEISAIInputOutputInfo demoInfo = new LEISAIInputOutputInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 LEISAIMCInfo demoInfo = new LEISAIMCInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.OutputCard)
             {
                 LEISAIOutputInfo demoInfo = new LEISAIOutputInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
         }
         #endregion
         #region GOOGOL
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.GOOGOL)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 GoogoTechMCInfo demoInfo = new GoogoTechMCInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.ExpansionModule)
             {
                 GoogolTechExtCardInfo demoInfo = new GoogolTechExtCardInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
         }
         #endregion
         #region ADVANCE
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.ADVANTECH)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputCard)
             {
                 AdvanceInputInfo demoInputInfo = new AdvanceInputInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.OutputCard)
             {
                 AdvanceOutputInfo demoInfo = new AdvanceOutputInfo();
                 demoInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInfo.hardwareName, demoInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInfo.hardwareName);
                 lvi.SubItems.Add(demoInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInfo.hardwareTpye.ToString());
             }
         }
         #endregion
         #region ADLINK
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.ADLINK)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 ADLINKTechMCInfo demoInputInfo = new ADLINKTechMCInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputOutputCard)
             {
                 ADLINKInputOutputInfo demoInputInfo = new ADLINKInputOutputInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.InputCard)
             {
                 ADLINKInputInfo demoInputInfo = new ADLINKInputInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
         }
         #endregion
         #region Softservo
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.SOFTSERVO)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 SoftservoControlerInfo demoInputInfo = new SoftservoControlerInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
         }
         if ((HardWardVender)comboBoxVender.SelectedItem == HardWardVender.BECKHOFF)
         {
             if ((HardWardType)comboBoxType.SelectedItem == HardWardType.MotionCard)
             {
                 BeckhoffADSInfo demoInputInfo = new BeckhoffADSInfo();
                 demoInputInfo.hardwareName   = textBoxHardWareName.Text;
                 demoInputInfo.hardwareVender = (HardWardVender)comboBoxVender.SelectedItem;
                 demoInputInfo.hardwareTpye   = (HardWardType)comboBoxType.SelectedItem;
                 HardwareManage.hardDoc.m_HardWareDictionary.Add(demoInputInfo.hardwareName, demoInputInfo);
                 HardwareManage.hardDoc.m_HardWareList.Add(demoInputInfo);
                 ListViewItem lvi = listViewNFHardWare.Items.Add(demoInputInfo.hardwareName);
                 lvi.SubItems.Add(demoInputInfo.hardwareVender.ToString());
                 lvi.SubItems.Add(demoInputInfo.hardwareTpye.ToString());
             }
         }
         #endregion
     }
     catch
     {
     }
 }
コード例 #3
0
 public LEISAIInputOutputInfoForm(LEISAIInputOutputInfo Info)
 {
     InitializeComponent();
     hardInfo = Info;
 }