예제 #1
0
        private void InitFrameSpeedCtrls()
        {
            try
            {
                emDSFrameSpeed frameSpeed;
                XCamera.GetInstance().GetFrameSpeed(out frameSpeed);
                switch (frameSpeed)
                {
                case emDSFrameSpeed.FRAME_SPEED_NORMAL:
                    _radioGroupFrameSpeed.SelectedIndex = 0;
                    break;

                case emDSFrameSpeed.FRAME_SPEED_HIGH:
                    _radioGroupFrameSpeed.SelectedIndex = 1;
                    break;

                case emDSFrameSpeed.FRAME_SPEED_SUPER:
                    _radioGroupFrameSpeed.SelectedIndex = 2;
                    break;

                default:
                    break;
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
예제 #2
0
 public void SetROI(Rectangle roi)
 {
     if (SetROIType == ROIType.AEROI)
     {
         //XCamera.GetInstance().SetAeState(false);
         System.Threading.Thread.Sleep(20);
         if (XCamera.GetInstance().SetAEWindow(roi.X, roi.Y, roi.Width, roi.Height))
         {
             //bool aeState;
             //XCamera.GetInstance().GetAeState(out aeState);
             //logger.Debug(string.Format("设置自动曝光窗口成功!roi: X: {0}, Y: {1}, W: {2}, H: {3}, scale: {4}", roi.X, roi.Y, roi.Width, roi.Height, scale));
             //_logger.Debug("aeState: " + aeState.ToString());
             //XCamera.GetInstance().SetAeState(true);
         }
     }
     else if (SetROIType == ROIType.WB_ROI)
     {
         XCamera.GetInstance().SetWBWindow(roi.X, roi.Y, roi.Width, roi.Height);
         XCamera.GetInstance().SetOnceWB();
     }
     else if (SetROIType == ROIType.PVW_ROI)
     {
         XCamera.GetInstance().SetPreviewROI(roi.X, roi.Y, roi.Width, roi.Height);
         XCamera.GetInstance().Play();
     }
 }
예제 #3
0
        private void ZoomWindow(double factor, bool fitScreen = false)
        {
            int workAreaWidth = this.ClientRectangle.Width;
            int workAreaHeight = this.ClientRectangle.Height;
            int previewWidth, previewHeight;

            if (!XCamera.GetInstance().GetPreviewSize(out previewWidth, out previewHeight))
            {
                return;
            }
            Size realSize = new Size(previewWidth, previewHeight);

            if (fitScreen)
            {
                double widthFactor  = Convert.ToDouble(workAreaWidth) / Convert.ToDouble(realSize.Width);
                double heightFactor = Convert.ToDouble(workAreaHeight) / Convert.ToDouble(realSize.Height);
                factor = Math.Min(widthFactor, heightFactor);
            }
            else
            {
                factor = _funcLimitedZoom(factor);
            }
            //_zoomFactor = factor;
            _imageBox.ZoomFactor = factor;
            _imageBox.Width      = Convert.ToInt32(realSize.Width * factor);
            _imageBox.Height     = Convert.ToInt32(realSize.Height * factor);
            _imageBox.Left       = (workAreaWidth > _imageBox.Width) ? (workAreaWidth - _imageBox.Width) / 2 : 0;
            _imageBox.Top        = (workAreaHeight > _imageBox.Height) ? (workAreaHeight - _imageBox.Height) / 2 : 0;
            XCamera.GetInstance().SetDisplaySize(_imageBox.Width, _imageBox.Height);

            SyncImageBack();
        }
예제 #4
0
 /// <summary>
 /// 设置连拍定时器
 /// </summary>
 public void StartMutiCap()
 {
     _captureCnt = 0;
     _timerMutiCapture.Interval = XCamera.GetInstance().CapturePara.MutiCaptureTimeStep;
     _timerMutiCapture.Elapsed += _timerMutiCapture_Tick;
     _timerMutiCapture.Start();
 }
예제 #5
0
        //private Size GetPreviewWindowRealSize()
        //{
        //    tDSImageSize tmpsize = new tDSImageSize();
        //    int m_iRelsel = 0;
        //    int nWidth = 640, nHeight = 480;
        //    tDSCameraCapability dscapability = new tDSCameraCapability();
        //    XCamera.CameraGetCapability(1, ref dscapability);
        //    if (XCamera.CameraGetImageSizeSel(1, ref m_iRelsel, false) == emDSCameraStatus.STATUS_OK)
        //    {
        //        Byte[] arrtmp = new Byte[4];
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 52, 4);
        //        nWidth = BitConverter.ToInt32(arrtmp, 0);
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 56, 4);
        //        nHeight = BitConverter.ToInt32(arrtmp, 0);
        //    }
        //    return new Size(nWidth, nHeight);
        //}
        #endregion

        //private void UpdateDisplayWindow()
        //{
        //    tDSImageSize tmpsize = new tDSImageSize();
        //    int m_iRelsel = 0;
        //    int nWidth = 640, nHeight = 480;
        //    tDSCameraCapability dscapability = new tDSCameraCapability();
        //    XCamera.CameraGetCapability(1, ref dscapability);
        //    if (XCamera.CameraGetImageSizeSel(1, ref m_iRelsel, false) == emDSCameraStatus.STATUS_OK)
        //    {
        //        Byte[] arrtmp = new Byte[4];
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 52, 4);
        //        nWidth = BitConverter.ToInt32(arrtmp, 0);
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 56, 4);
        //        nHeight = BitConverter.ToInt32(arrtmp, 0);
        //    }

        //    pictureBox.Width = nWidth;
        //    //pictureBox.Height = nHeight - 40;
        //    pictureBox.Height = nHeight;
        //    pictureBox.Left = 0;
        //    //pictureBox.Top = 24;
        //    pictureBox.Top = 0;
        //    //---------------------------------------------------------------------------------------------------------------------------------------
        //    XCamera.CameraSetDisplaySize(1, pictureBox.Width, pictureBox.Height);
        //}

        private void PreviewForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!IsCloseWithMainForm)
                {
                    XCamera cam = XCamera.GetInstance();
                    bool    isSuccessToStopCam = false;
                    if (cam.IsActive())
                    {
                        if (cam.RunMode != emDSRunMode.RUNMODE_STOP)
                        {
                            isSuccessToStopCam = cam.Stop();
                            System.Threading.Thread.Sleep(100);
                        }
                        if (isSuccessToStopCam && cam.UnInit())
                        {
                            System.Threading.Thread.Sleep(100);
                            OnCameraClosed(new EventArgs());
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
예제 #6
0
 private void InitRGBGainControls(ref tDSCameraCapability capbility)
 {
     try
     {
         //R,G,B通道增益
         float minRGain = capbility.sRgbGainRange.fRGainMin;
         float maxRGain = capbility.sRgbGainRange.fRGainMax;
         _trackBarRGain.SetRange((int)(minRGain * 100), (int)(maxRGain * 100));
         float minGGain = capbility.sRgbGainRange.fGGainMin;
         float maxGGain = capbility.sRgbGainRange.fGGainMax;
         _trackBarGGain.SetRange((int)(minGGain * 100), (int)(maxGGain * 100));
         float minBGain = capbility.sRgbGainRange.fBGainMin;
         float maxBGain = capbility.sRgbGainRange.fBGainMax;
         _trackBarBGain.SetRange((int)(minBGain * 100), (int)(maxBGain * 100));
         float rGain, gGain, bGain;
         XCamera.GetInstance().GetGain(out rGain, out gGain, out bGain);
         _trackBarRGain.Value = (int)(rGain * 100);
         _trackBarGGain.Value = (int)(gGain * 100);
         _trackBarBGain.Value = (int)(bGain * 100);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #7
0
        private void _radioGroupAntiFlick_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (!_isInit)
                {
                    XCamera cam = XCamera.GetInstance();
                    switch (_radioGroupAntiFlick.SelectedIndex)
                    {
                    case 0:              //直流
                        cam.SetAntiFlickState(false);
                        break;

                    case 1:             //50Hz
                        cam.SetAntiFlickState(true);
                        cam.SetLightFrequency(emDSLightFrequency.LIGHT_FREQUENCY_50HZ);
                        break;

                    case 2:             //60Hz
                        cam.SetAntiFlickState(true);
                        cam.SetLightFrequency(emDSLightFrequency.LIGHT_FREQUENCY_60HZ);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
예제 #8
0
        private void _radioGroupFrameSpeed_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (!_isInit)
                {
                    XCamera cam = XCamera.GetInstance();
                    switch (_radioGroupFrameSpeed.SelectedIndex)
                    {
                    case 0:          //普通
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_NORMAL);
                        break;

                    case 1:         //高速
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_HIGH);
                        break;

                    case 2:         //超高速
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_SUPER);
                        break;

                    default:
                        break;
                    }
                    Init();
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
예제 #9
0
 private void _checkEditEnableAe_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (!_isInit)
         {
             bool aeState = _checkBoxEnableAE.Checked;
             if (XCamera.GetInstance().SetAeState(aeState))
             {
                 XCameraAePara aePara;
                 if (XCamera.GetInstance().GetAePara(out aePara))
                 {
                     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();
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
예제 #10
0
 private void InitResolutionCombo()
 {
     try
     {
         _comboBoxEditResolution.Properties.Items.Clear();
         comboBoxEditCaptureRes.Properties.Items.Clear();
         List <string> resolutionDescription;
         if (XCamera.GetInstance().GetResolutionDescriptionList(out resolutionDescription))
         {
             _comboBoxEditResolution.Properties.Items.AddRange(resolutionDescription.ToArray());
             comboBoxEditCaptureRes.Properties.Items.AddRange(resolutionDescription.ToArray());
         }
         int sel = -1;
         if (XCamera.GetInstance().GetPreviewSizeSel(out sel))
         {
             _comboBoxEditResolution.SelectedIndex = sel;
         }
         if (XCamera.GetInstance().GetCaptureSizeSel(out sel))
         {
             comboBoxEditCaptureRes.SelectedIndex = sel;
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
예제 #11
0
 /// <summary>
 /// 保存图像到默认的路径下
 /// </summary>
 /// <param name="img2Save">待保存图像</param>
 /// <param name="cam">相机实例</param>
 /// <returns>保存的图像名(包含完整路径)</returns>
 private static string SaveImageToDefaultPath(Image <Bgr, Byte> img2Save, XCamera cam)
 {
     try
     {
         string imgFileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-sss");
         //if (cam.CapturePara.ImageFileType == emDSFileType.FILE_JPG)
         //    imgFileName += ".jpg";
         //else if (cam.CapturePara.ImageFileType == emDSFileType.FILE_BMP)
         //    imgFileName += ".bmp";
         //else
         //    imgFileName += ".png";
         //string fullFileName = ConfigManager.GetAppConfig("WorkPathImage") + "\\" + imgFileName;
         string fullFileName = XCamera.GetInstance().CapturePara.ImageSavePath + "\\" + imgFileName;
         img2Save.Save(fullFileName);
         XTwoExtraValueEventArgs <string, string> eventArgs = new XTwoExtraValueEventArgs <string, string>()
         {
             Data1 = fullFileName,
             Data2 = imgFileName
         };
         //PublishImageSavedEvent(eventArgs);
         return(fullFileName);
     }
     catch (System.Exception ex)
     {
         _logger.Error("保存图像时异常:" + ex.Message);
         return("");
     }
 }
예제 #12
0
 private void InitAntiFlickCtrls()
 {
     try
     {
         bool isAntiFlick = false;
         XCamera.GetInstance().GetAntiFlickState(out isAntiFlick);
         if (isAntiFlick)
         {
             emDSLightFrequency frequency;
             XCamera.GetInstance().GetLightFrequency(out frequency);
             if (frequency == emDSLightFrequency.LIGHT_FREQUENCY_50HZ)
             {
                 _radioGroupAntiFlick.SelectedIndex = 1;
             }
             else
             {
                 _radioGroupAntiFlick.SelectedIndex = 2;
             }
         }
         else
         {
             _radioGroupAntiFlick.SelectedIndex = 0;
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
예제 #13
0
 private void _trackBarJpgFileQulity_Scroll(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.ImageQuality = _trackBarJpgFileQulity.Value;
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #14
0
 private void _spinEditMutiCaptureCnt_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.MutiCaptureCount = Convert.ToInt32(_spinEditMutiCaptureCnt.Value);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #15
0
 private void _spinEditFrameStep_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.FluModeFrameStep = Convert.ToInt32(_spinEditFrameStep.Value);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #16
0
 private void _spinEditMaxVideoSize_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         int maxVideoSize = Convert.ToInt32(_spinEditMaxVideoSize.Value);
         XCamera.GetInstance().SetMaxVideoFileSize(maxVideoSize);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #17
0
        public void Init()
        {
            try
            {
                XCamera            cam         = XCamera.GetInstance();
                XCameraCapturePara capturePara = cam.CapturePara;

                if (capturePara.ImageFileType == emDSFileType.FILE_JPG)
                {
                    _radioGroupCaptureFileType.SelectedIndex = 0;
                }
                else if (capturePara.ImageFileType == emDSFileType.FILE_BMP)
                {
                    _radioGroupCaptureFileType.SelectedIndex = 1;
                }
                else
                {
                    _radioGroupCaptureFileType.SelectedIndex = 2;
                }

                _trackBarJpgFileQulity.Enabled = (_radioGroupCaptureFileType.SelectedIndex == 0);
                _trackBarJpgFileQulity.Value   = capturePara.ImageQuality;
                _buttonEditPicSavePath.Text    = capturePara.ImageSavePath;

                _spinEditMutiCaptureCnt.Value = capturePara.MutiCaptureCount;
                _textEditMutiCaptureTime.Text = ((double)(capturePara.MutiCaptureTimeStep) / 1000.0).ToString();

                _spinEditAccuFrameCnt.Value = capturePara.FluModeAccuFrameCnt;
                _spinEditFrameStep.Value    = capturePara.FluModeFrameStep;

                int videoQuality  = 2;
                var cameraCamType = Convert.ToInt32(ConfigManager.GetAppConfig("CameraType"));
                if (cameraCamType == 1)
                {
                    cam.GetRecordQuality(out videoQuality);
                    _radioGroupAVIQuality.SelectedIndex = videoQuality - 1;
                }
                _buttonEditVideoSavePath.Text = capturePara.VideoSavePath;
                int maxVideoSize;
                cam.GetMaxVideoFileSize(out maxVideoSize);
                _spinEditMaxVideoSize.Value = maxVideoSize;
                if (!cam.IsActive())
                {
                    _radioGroupAVIQuality.Enabled = false;
                    _spinEditMaxVideoSize.Enabled = false;
                }
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
예제 #18
0
        private static void HandleCapture(Image <Bgr, Byte> img, int pBmp24, ref tDSFrameInfo sFrInfo)
        {
            if (_captureState == CaptureState.NO_CAPTURE)
            {
                return;
            }
            XCamera cam = XCamera.GetInstance();

            //HandleSingleCapture(img, cam);
            //HandleMutiCapture(img, cam);
            HandleFluCapture(img, cam);
            HandleVideoCapture(pBmp24, ref sFrInfo);
        }
예제 #19
0
 private void _comboBoxEditAEMode_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().SetAeMode(this._comboBoxEditAEMode.SelectedIndex))
         {
             UpdateExpControlsByAeMode(this._comboBoxEditAEMode.SelectedIndex);
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
예제 #20
0
 private void comboBoxEditCaptureRes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (!_isInit)
         {
             XCamera.GetInstance().SetCaptureSizeSel(comboBoxEditCaptureRes.SelectedIndex);
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
예제 #21
0
 private void _checkEnable3DAntiNoise_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().Set3DNoiseReductionState(_checkEnable3DAntiNoise.Checked))
         {
             _trackBar3DAntiNoise.Enabled = _checkEnable3DAntiNoise.Checked;
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #22
0
 /***********************************白平衡************************************/
 private void _btnOnceWB_Click(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().SetOnceWB())
         {
             this.Init();
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #23
0
 private void _checkInverse_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (!isInit)
         {
             XCamera.GetInstance().SetInverseState(_checkInverse.Checked);
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #24
0
 private void _btnLoadDefaultInnerPara_Click(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().LoadParameter(emDSParameterTeam.PARAMETER_TEAM_DEFAULT))
         {
             XMessageDialog.Info("加载默认参数成功!");
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #25
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;
            }
        }
예제 #26
0
 private void _btnSaveToInnerPara_Click(object sender, EventArgs e)
 {
     try
     {
         emDSParameterTeam paraTeam = GetRadioGroupSelectInnerParas();
         if (XCamera.GetInstance().SaveParameter(paraTeam))
         {
             XMessageDialog.Info("保存参数成功!");
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #27
0
 private void _textEditMutiCaptureTime_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         double sec = Convert.ToDouble(_textEditMutiCaptureTime.Text) * 1000;
         int    miliSec = Convert.ToInt32(sec);
         XCamera.GetInstance().CapturePara.MutiCaptureTimeStep = miliSec;
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
         XMessageDialog.Warning("请填入正确的值!");
         _textEditMutiCaptureTime.Text = "1";
     }
 }
예제 #28
0
 private void _radioGroupAVIQuality_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         var cameraCamType = Convert.ToInt32(ConfigManager.GetAppConfig("CameraType"));
         if (cameraCamType == 1)
         {
             XCamera.GetInstance().SetRecordQuality(_radioGroupAVIQuality.SelectedIndex + 1);
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
예제 #29
0
        private void Snapshot()
        {
            string imgFileName  = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-sss");
            string fullFileName = XCamera.GetInstance().CaptureImage(imgFileName);

            if (!String.IsNullOrEmpty(fullFileName))
            {
                XTwoExtraValueEventArgs <string, string> eventArgs = new XTwoExtraValueEventArgs <string, string>()
                {
                    Data1 = fullFileName,
                    Data2 = imgFileName
                };
                PublishImageSavedEvent(eventArgs);
            }
        }
예제 #30
0
        //public static void StartMutiCapture()
        //{
        //    _timerMutiCapture.Interval = XCamera.GetInstance().CapturePara.MutiCaptureTimeStep;
        //    _timerMutiCapture.Elapsed += _timerMutiCapture_Tick;
        //    //_timerMutiCapture.AutoReset = false;
        //    _captureState = CaptureState.MULT_CAPTURE_TRIGGER_ON;
        //    //_timerMutiCapture.Enabled = true;
        //    _timerMutiCapture.Start();
        //}

        //public static void StopMutiCapture()
        //{
        //    //_timerMutiCapture.Enabled = false;
        //    _timerMutiCapture.Stop();
        //    _captureState = CaptureState.MULT_CAPTURE_TRIGGER_OFF;
        //}

        public static void StartVideoCapture()
        {
            try
            {
                if (XCamera.GetInstance().StartRecord())
                {
                    _captureState = CaptureState.VIDEO_CAPTURING;
                    PublishVideoCaptureStartedEvent(new EventArgs());
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }