Exemplo n.º 1
0
        public void Init()
        {
            try
            {
                _isInit = true;
                XCamera cam = XCamera.GetInstance();
                //cam.SetAeMode(XAeModeDefine.AdjustExpGainAndTime);
                XCameraAePara aePara;
                if (cam.GetAePara(out aePara))
                {
                    _checkBoxEnableAE.Checked = aePara.AeState;
                    if (aePara.AeMode == XAeModeDefine.AdjustExpGainAndTime)
                    {
                        _comboBoxEditAEMode.SelectedIndex = 0;
                    }
                    else if (aePara.AeMode == XAeModeDefine.AdjustExpGain)
                    {
                        _comboBoxEditAEMode.SelectedIndex = 1;
                    }
                    else if (aePara.AeMode == XAeModeDefine.AdjustExpGain)
                    {
                        _comboBoxEditAEMode.SelectedIndex = 2;
                    }

                    UpdateControlsByAePara(aePara);
                    InitExpTargetAndGainCtrls(aePara);
                    ulong minExpTime = aePara.ExposureTimeParaRange.MinValue / 10000; //将单位转换为ms
                    ulong maxExpTime = aePara.ExposureTimeParaRange.MaxValue / 10000; //将单位转换为ms
                    ulong curExpTime = aePara.CurExposureTime / 10000;                //将单位转换为ms
                    InitExpTimeCtrls(minExpTime, maxExpTime, curExpTime);
                    InitAntiFlickCtrls();
                    InitFrameSpeedCtrls();
                    InitResolutionCombo();
                }

                //在初始化之后绑定事件响应方法,
                _checkBoxEnableAE.CheckedChanged            += _checkEditEnableAe_CheckedChanged;
                _comboBoxEditAEMode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
                _comboBoxEditAEMode.SelectedIndexChanged    += _comboBoxEditAEMode_SelectedIndexChanged;
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
            finally
            {
                _isInit = false;
            }
        }