コード例 #1
0
ファイル: PCI1754.cs プロジェクト: chouju6666/StripMach
 //【重载】创建PCI1754更新输入类的实例
 /// <summary>
 /// 【重载】创建PCI1754更新输入类的实例
 /// </summary>
 /// <param name="TargetCard">目标PCI1754卡【窗体控件的形式】</param>
 /// <param name="DLLPassword">使用此DLL的密码</param>
 public PCI1754(ref Automation.BDaq.InstantDiCtrl TargetCard)
 {
     SuccessBuiltNew   = false;
     PasswordIsCorrect = false;
     try
     {
         TargetPCI1754Card = TargetCard;
         if (TargetPCI1754Card.Initialized == true)
         {
             NeedFormControlFlag = true;
             SuccessBuiltNew     = true;
         }
         else
         {
             MessageBox.Show("参数'TargetCard'传递的PCI1754控件初始化失败,没有选择设备或者是设备打开失败,请检查具体原因。", "错误");
             SuccessBuiltNew = false;
             return;
         }
     }
     catch (Exception ex)
     {
         SuccessBuiltNew = false;
         MessageBox.Show("创建类的实例时出现错误!\r\n" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
コード例 #2
0
        //【重载】创建PCI1754更新输入状态窗体类的实例
        /// <summary>
        /// 【重载】创建PCI1754更新输入状态窗体类的实例
        /// 【软件作者:彭东南, [email protected]】
        /// </summary>
        /// <param name="TargetCard">目标PCI1754卡【窗体控件的形式】</param>
        /// <param name="DLLPassword">使用此DLL的密码</param>
        public frmPCI1754(ref Automation.BDaq.InstantDiCtrl TargetCard, string DLLPassword)
        {
            SuccessBuiltNew = false;
            PasswordIsCorrect = false;
            try
            {
                NewPCI1754 = new PCI1754(ref TargetCard);

                //if (NewPCI1754.SuccessBuilt == false)
                //    {
                //    SuccessBuiltNew = false;
                //    throw new Exception("Error: Failed to open the PCI1754 card: " + TargetCard.SelectedDevice.DeviceNumber
                //        + "\r\n错误:打开PCI1754卡【 " + TargetCard.SelectedDevice.DeviceNumber + " 】 失败,请检查卡是否存在或者已经正确安装。");
                //    }

                InitializeComponent();//*********
                if (AddPicAndLabelArrayControls() == false)
                {
                    throw new Exception("Failed to initial the controls of form.\r\n"
                        + "初始化窗体控件失败。");
                }
                SuccessBuiltNew = true;
                NeedFormControlFlag = false;
            }
            catch (Exception ex)
            {
                SuccessBuiltNew = false;
                MessageBox.Show("创建类的实例时出现错误!\r\n" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.Dispose();
                return;
            }
        }
コード例 #3
0
 public void InstantDi()
 {
     for (int i = 0; i < 10; i++)
     {
         portData[i] = 0;
     }
     this.instantDiCtrl1 = new Automation.BDaq.InstantDiCtrl();
     this.instantDiCtrl1.SelectedDevice = new DeviceInformation(conf.deviceDescription);
 }
コード例 #4
0
 public void InstantDi(System.ComponentModel.IContainer components)
 {
     for (int i = 0; i < 10; i++)
     {
         portData[i] = 0;
     }
     this.instantDiCtrl1 = new Automation.BDaq.InstantDiCtrl(components);
     this.instantDiCtrl1.SelectedDevice = new DeviceInformation(conf.deviceDescription);
 }
コード例 #5
0
        //【重载】创建PCI1754更新输入状态窗体类的实例
        /// <summary>
        /// 【重载】创建PCI1754更新输入状态窗体类的实例
        /// 【软件作者:彭东南, [email protected]】
        /// </summary>
        /// <param name="TargetCard">目标PCI1754卡【窗体控件的形式】</param>
        /// <param name="DLLPassword">使用此DLL的密码</param>
        public frmPCI1754(ref Automation.BDaq.InstantDiCtrl TargetCard, string DLLPassword)
            {
            SuccessBuiltNew = false;
            PasswordIsCorrect = false;
            try
                {
                if (DLLPassword == "ThomasPeng" || (DLLPassword == "pengdongnan")
                    || (DLLPassword == "彭东南"))
                    {
                    PasswordIsCorrect = true;

                    NewPCI1754 = new PCI1754(ref TargetCard, "彭东南");

                    //if (NewPCI1754.SuccessBuilt == false)
                    //    {
                    //    SuccessBuiltNew = false;
                    //    throw new Exception("Error: Failed to open the PCI1754 card: " + TargetCard.SelectedDevice.DeviceNumber
                    //        + "\r\n错误:打开PCI1754卡【 " + TargetCard.SelectedDevice.DeviceNumber + " 】 失败,请检查卡是否存在或者已经正确安装。");
                    //    }

                    InitializeComponent();//*********
                    if (AddPicAndLabelArrayControls() == false)
                        {
                        throw new Exception("Failed to initial the controls of form.\r\n"
                            + "初始化窗体控件失败。");
                        }
                    SuccessBuiltNew = true;
                    NeedFormControlFlag = false;
                    }
                else
                    {
                    PasswordIsCorrect = false;
                    SuccessBuiltNew = false;
                    MessageBox.Show("Right Prohibited.\return\n     You don't have the given right to use this DLL library, please contact with ThomasPeng.\r\n你未得到授权的密码,无法使用此DLL进行软件开发!请与作者彭东南联系:[email protected]\r\n                                                                版权所有: 彭东南", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                    }
                }
            catch (Exception ex)
                {
                SuccessBuiltNew = false;
                MessageBox.Show("创建类的实例时出现错误!\r\n" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.Dispose();
                return;
                }
            }
コード例 #6
0
 //【重载】创建PCI1754更新输入类的实例
 /// <summary>
 /// 【重载】创建PCI1754更新输入类的实例
 /// </summary>
 /// <param name="TargetCard">目标PCI1754卡【窗体控件的形式】</param>
 /// <param name="DLLPassword">使用此DLL的密码</param>
 public PCI1754(ref Automation.BDaq.InstantDiCtrl TargetCard, string DLLPassword)
     {
     SuccessBuiltNew = false;
     PasswordIsCorrect = false;
     try
         {
         if (DLLPassword == "ThomasPeng" || (DLLPassword == "pengdongnan")
             || (DLLPassword == "彭东南"))
             {
             PasswordIsCorrect = true;
             TargetPCI1754Card = TargetCard;
             if (TargetPCI1754Card.Initialized == true)
                 {
                 NeedFormControlFlag = true;
                 SuccessBuiltNew = true;
                 }
             else
                 {
                 MessageBox.Show("参数'TargetCard'传递的PCI1754控件初始化失败,没有选择设备或者是设备打开失败,请检查具体原因。", "错误");
                 SuccessBuiltNew = false;
                 return;
                 }
             }
         else
             {
             PasswordIsCorrect = false;
             SuccessBuiltNew = false;
             MessageBox.Show("Right Prohibited.\return\n     You don't have the given right to use this DLL library, please contact with ThomasPeng.\r\n你未得到授权的密码,无法使用此DLL进行软件开发!请与作者彭东南联系:[email protected]\r\n                                                                版权所有: 彭东南", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
             }
         }
     catch (Exception ex)
         {
         SuccessBuiltNew = false;
         MessageBox.Show("创建类的实例时出现错误!\r\n" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
         }
     }