Пример #1
0
        // 增加摄像头
        private void AddCamera()
        {
            摄像头新增窗体 form = new 摄像头新增窗体();

            // 设置提供商
            form.VideoProviders = config.providers;
            // 设置回调函数,用于测试摄像头
            form.CheckCameraFunction = new CheckCameraHandler(CheckCamera);

            // 显示界面
            if (form.ShowDialog() == DialogResult.OK)
            {
                CountCamera++;      //统计已经添加的摄像头数
                Camera camera = form.Camera;
                config.AddCamera(camera);
                cameraToEdit = camera;
                switch (CountCamera)
                {
                case 1:
                    View1.SetCamera(0, 0, camera.ID);
                    View2.SetCamera(0, 0, camera.ID);
                    View3.SetCamera(0, 0, camera.ID);
                    View4.SetCamera(0, 0, camera.ID);
                    View9.SetCamera(0, 0, camera.ID);
                    SelectedView = View1;
                    break;

                case 2:
                    View2.SetCamera(0, 1, camera.ID);
                    View3.SetCamera(0, 1, camera.ID);
                    View4.SetCamera(0, 1, camera.ID);
                    View9.SetCamera(0, 1, camera.ID);
                    SelectedView = View2;
                    break;

                case 3:
                    View3.SetCamera(0, 2, camera.ID);
                    View4.SetCamera(1, 0, camera.ID);
                    View9.SetCamera(0, 2, camera.ID);
                    SelectedView = View3;
                    break;

                case 4:
                    View4.SetCamera(1, 1, camera.ID);
                    View9.SetCamera(1, 0, camera.ID);
                    SelectedView = View4;
                    break;

                case 5:
                    View9.SetCamera(1, 1, camera.ID);
                    SelectedView = View9;
                    break;

                case 6:
                    View9.SetCamera(1, 2, camera.ID);
                    SelectedView = View9;
                    break;

                case 7:
                    View9.SetCamera(2, 0, camera.ID);
                    SelectedView = View9;
                    break;

                case 8:
                    View9.SetCamera(2, 1, camera.ID);
                    SelectedView = View9;
                    break;

                case 9:
                    View9.SetCamera(2, 2, camera.ID);
                    SelectedView = View9;
                    break;

                default: break;
                }
                OpenView();
            }
        }
Пример #2
0
        // 增加摄像头
        private void AddCamera()
        {
            摄像头新增窗体 form = new 摄像头新增窗体();
            // 设置提供商
            form.VideoProviders = config.providers;
            // 设置回调函数,用于测试摄像头
            form.CheckCameraFunction = new CheckCameraHandler(CheckCamera);

            // 显示界面
            if (form.ShowDialog() == DialogResult.OK)
            {
                CountCamera++;      //统计已经添加的摄像头数
                Camera camera = form.Camera;
                config.AddCamera(camera);
                cameraToEdit = camera;
                switch (CountCamera)
                {
                    case 1:
                        View1.SetCamera(0, 0, camera.ID);
                        View2.SetCamera(0, 0, camera.ID);
                        View3.SetCamera(0, 0, camera.ID);
                        View4.SetCamera(0, 0, camera.ID);
                        View9.SetCamera(0, 0, camera.ID);
                        SelectedView = View1;
                        break;
                    case 2:
                        View2.SetCamera(0, 1, camera.ID);
                        View3.SetCamera(0, 1, camera.ID);
                        View4.SetCamera(0, 1, camera.ID);
                        View9.SetCamera(0, 1, camera.ID);
                        SelectedView = View2;
                        break;
                    case 3:
                        View3.SetCamera(0, 2, camera.ID);
                        View4.SetCamera(1, 0, camera.ID);
                        View9.SetCamera(0, 2, camera.ID);
                        SelectedView = View3;
                        break;
                    case 4:
                        View4.SetCamera(1, 1, camera.ID);
                        View9.SetCamera(1, 0, camera.ID);
                        SelectedView = View4;
                        break;
                    case 5:
                        View9.SetCamera(1, 1, camera.ID);
                        SelectedView = View9;
                        break;
                    case 6:
                        View9.SetCamera(1, 2, camera.ID);
                        SelectedView = View9;
                        break;
                    case 7:
                        View9.SetCamera(2, 0, camera.ID);
                        SelectedView = View9;
                        break;
                    case 8:
                        View9.SetCamera(2, 1, camera.ID);
                        SelectedView = View9;
                        break;
                    case 9:
                        View9.SetCamera(2, 2, camera.ID);
                        SelectedView = View9;
                        break;
                    default: break;
                }
                OpenView();
            }
        }