Пример #1
0
        private void ShowCamParam()
        {
            try
            {
                CameraParam cam = _actionData.listCamParam[cmbDefaultCameraList.SelectedIndex];

                //相机设定
                tbShutterSpeed.Text = cam.iShutterSpeed.ToString();
                tbGain.Text         = cam.iGain.ToString();

                radBtnIOCtrl.Checked        = cam.ledCtrl == LedControl.IO ? true : false;
                radBtnLedController.Checked = !radBtnIOCtrl.Checked;

                if (cmbCtrlCard.Items.Count > 0)
                {
                    int index = cmbCtrlCard.FindStringExact(cam.strControlCardName);
                    cmbCtrlCard.SelectedIndex = index > -1 ? index : -1;
                }
                tbIONum.Text = cam.iIoNum.ToString();

                if (cmbLedController.Items.Count > 0)
                {
                    int index = cmbLedController.FindStringExact(cam.strLedControllerName);
                    cmbLedController.SelectedIndex = index > -1 ? index : -1;
                }
                tbLumiance.Text = cam.iLuminance.ToString();
                tbChannel.Text  = cam.iChannel.ToString();

                if (cmbCameraBinding.Items.Count > 0)
                {
                    int index = cmbCameraBinding.FindStringExact(cam.strCamBingding);
                    cmbCameraBinding.SelectedIndex = index > -1 ? index : -1;
                }

                tbWhiteBalanceR.Text = cam.iWhiteBalanceR.ToString();
                tbWhiteBalanceG.Text = cam.iWhiteBalanceG.ToString();
                tbWhiteBalanceB.Text = cam.iWhiteBalanceB.ToString();

                radBtnImageSrcLocal.Checked  = _actionData.eimageSrc == ImageSource.Local ? true : false;
                radBtnImageSrcCamera.Checked = !radBtnImageSrcLocal.Checked;
                tbPath.Text = _actionData.strLocalImgSrcPath;
                if (_actionData.iSrcCamIndex < -1 || _actionData.iSrcCamIndex >= VisionManage.MaxCameraCount)
                {
                    _actionData.iSrcCamIndex = -1;
                }
                cmbCamSel.SelectedIndex = _actionData.iSrcCamIndex;
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
        private bool SaveSetting()
        {
            try
            {
                CameraParam cam = _actionData.listCamParam[cmbDefaultCameraList.SelectedIndex];

                int.TryParse(tbShutterSpeed.Text, out cam.iShutterSpeed);
                int.TryParse(tbGain.Text, out cam.iGain);

                cam.ledCtrl = radBtnIOCtrl.Checked ? LedControl.IO : LedControl.LedController;
                if (null != cmbCtrlCard.SelectedItem)
                {
                    cam.strControlCardName = cmbCtrlCard.SelectedItem.ToString();
                }
                int.TryParse(tbIONum.Text, out cam.iIoNum);

                if (null != cmbLedController.SelectedItem)
                {
                    cam.strLedControllerName = cmbLedController.SelectedItem.ToString();
                }
                int.TryParse(tbLumiance.Text, out cam.iLuminance);
                int.TryParse(tbChannel.Text, out cam.iChannel);

                if (null != cmbCameraBinding.SelectedItem)
                {
                    cam.strCamBingding = cmbCameraBinding.SelectedItem.ToString();
                }

                int.TryParse(tbWhiteBalanceR.Text, out cam.iWhiteBalanceR);
                int.TryParse(tbWhiteBalanceG.Text, out cam.iWhiteBalanceG);
                int.TryParse(tbWhiteBalanceB.Text, out cam.iWhiteBalanceB);

                _actionData.eimageSrc          = radBtnImageSrcLocal.Checked ? ImageSource.Local : ImageSource.Camera;
                _actionData.strLocalImgSrcPath = tbPath.Text;
                _actionData.iSrcCamIndex       = cmbCamSel.SelectedIndex;
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }