private void 加载两个摄像头_Load(object sender, EventArgs e)
        {
            //预览一个摄像头
            _camera1 = TestManager.CreateCamera("key0");
            _camera1.Preview(pnlVideo1.Handle, pnlVideo1.Width, pnlVideo1.Height);

            //预览第二个摄像头
            _camera2 = TestManager.CreateCamera("key1");
            _camera2.Preview(pnlVideo2.Handle, pnlVideo2.Width, pnlVideo2.Height);
        }
        private void 加载一个摄像头_Load(object sender, EventArgs e)
        {
            //测试
            //CameraEntity cameraEntity = new CameraEntity();
            //cameraEntity.Name = _camera_1_name;
            //cameraEntity.Status = 2;
            //cameraEntity.Save();

            ////测试
            //CameraEntity cameraEntity2 = new CameraEntity();
            //cameraEntity2.Name = "cessss";
            //cameraEntity2.Status = 0;
            //cameraEntity2.Save();



            //DirectShowSimple.Instance.Preview(pnlCamera);
            //预览一个摄像头
            //_camera1 = new TestMulitCamera();
            //_camera1.BindCamera(_camera_1_name);
            //_camera1.BindAudio(_audio_1_name);
            var cmaeraArray = TestManager.GetAllVideoDevice();

            List <string> resulutions = TestManager.GetCameraSupportResolution(cmaeraArray.First().Name);

            _camera1 = TestManager.CreateCamera("key0");
            _camera1.Preview(pnlCamera.Handle, pnlCamera.Width, pnlCamera.Height);

            //获取支持的分辨率
            List <string> resolution = _camera1.GetCameraSupportResolution();

            cmbResolution.DataSource   = resolution;
            cmbResolution.SelectedItem = _camera1.Resolution;

            //展示相关参数
            lblCameraParams.Text = string.Format("当前分辨率:{0}", _camera1.Resolution);

            isLoaded = true;

            //方案
            List <CameraParamPlanEntity> settingPlans = _camera1.GetCameraParamPlans();

            cmbSettings.DataSource            = settingPlans;
            cmbSettings.DisplayMember         = nameof(CameraParamPlanEntity.ParamPlanName);
            cmbSettings.SelectedIndexChanged -= cmbResolution_SelectedIndexChanged;
            cmbSettings.SelectedItem          = settingPlans.Find(m => m.DefaultSetting == true);
            cmbSettings.SelectedIndexChanged += cmbResolution_SelectedIndexChanged;
        }
Ejemplo n.º 3
0
 public void showCamera()
 {
     camera = TestManager.CreateCamera(this.Name);
     camera.Preview(this.Handle, this.Width, this.Height);
 }