예제 #1
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;
            }
        }
예제 #2
0
        //创建PCI1754更新输入状态窗体类的实例
        /// <summary>
        /// 创建PCI1754更新输入状态窗体类的实例
        /// 【软件作者:彭东南, [email protected]】
        /// </summary>
        /// <param name="TargetDeviceNumber">目标PCI1754设备卡号</param>
        /// <param name="DLLPassword">使用此DLL的密码</param>
        public frmPCI1754(int TargetDeviceNumber)
        {
            SuccessBuiltNew = false;
            PasswordIsCorrect = false;

            try
            {
                if (TargetDeviceNumber < 0)
                {
                    MessageBox.Show("'TargetDeviceNumber'设备卡号不能小于0,请改为正确参数。",
                        "参数错误");
                    return;
                }

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

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

                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;
            }

        }