void DispalySynCamera(int synGroupId) { try { List<SynCameraInfo> listSynCamera = SynGroupBusiness.Instance.GetAllCameraBySynGroupId(ref _errMessage, synGroupId); int iRow = 1; int iCol = 1; int iCount = 1; mainMultiplexer.CloseAll(); mainMultiplexer.CamerasVisible = true; mainMultiplexer.CellWidth = 320; mainMultiplexer.CellHeight = 240; mainMultiplexer.FitToWindow = true; CloseAll(); HikVideoServerDeviceDriver deviceDriver = null; HikVideoServerCameraDriver cameraDriver = null; HikVideoServerCameraDriver cameraDriver1 = null; DeviceInfo oDevice; int OutputPort = 0; int i = 0; int j = 0; iCount = listSynCamera.Count; Util.GetRowCol(iCount, ref iRow, ref iCol); int cameraId1 = 0; int cameraId2 = 0; CameraInfo camera = null; foreach (SynCameraInfo item in listSynCamera) { camera = _listAllCam[item.CameraId]; oDevice = _listDevice[camera.DeviceId]; if (!_runningDeviceList.ContainsKey(camera.DeviceId)) { deviceDriver = new HikVideoServerDeviceDriver(); deviceDriver.Init(ref oDevice); _runningDeviceList.Add(camera.DeviceId, deviceDriver); } if (_runningDeviceList[camera.DeviceId].IsValidDevice) { oDevice.ServiceID = _runningDeviceList[camera.DeviceId].ServiceId; if (!_runningCameraList.ContainsKey(camera.CameraId)) { camera.ListOutputTarget = new ArrayList(); cameraDriver = new HikVideoServerCameraDriver(oDevice); cameraDriver.CurrentCamera = camera; camera.TotalDSP = _outputTv.TotalDSP; _runningCameraList.Add(camera.CameraId, cameraDriver); } } CameraWindow camwin = mainMultiplexer.GetCamera(i, j); cameraDriver1 = _runningCameraList[camera.CameraId]; cameraDriver1.CurrentCamera.ListOutputTarget.Add(new DisplayHandlePair { DisplayChannelId = item.DisplayChannelId, DisplaySplitScreenNo = item.DisplaySplitScreenNo, Handle = camwin.Handle }); _runningCameraList[camera.CameraId] = cameraDriver1; mainMultiplexer.SetCamera(i, j, cameraDriver); j = j + 1; if (j >= iCol) { i = i + 1; j = 0; } } foreach (KeyValuePair<int, HikVideoServerCameraDriver> item in _runningCameraList) { item.Value.Start(item.Value.CurrentCamera, CardOutType.SynGroup, synGroupId); } mainMultiplexer.Rows = iRow; mainMultiplexer.Cols = iCol; mainMultiplexer.SingleCameraMode = false; mainMultiplexer.CamerasVisible = true; } catch (Exception ex) { } }
private void LoadAllCamera() { if (_listGroup == null) return; int iRow = 2; int iCol = 2; int iCount = 0; mainMultiplexer.CloseAll(); mainMultiplexer.CamerasVisible = true; mainMultiplexer.CellWidth = 320; mainMultiplexer.CellHeight = 240; mainMultiplexer.FitToWindow = true; _listCam = new Dictionary<int, CameraInfo>(); HikVideoServerDeviceDriver deviceDriver; HikVideoServerCameraDriver cameraDriver; foreach (KeyValuePair<int, GroupInfo> item in _listGroup) { if (item.Value.ListDevice != null) { foreach (KeyValuePair<int, DeviceInfo> device in item.Value.ListDevice) { if (device.Value.ListCamera != null) { foreach (KeyValuePair<int, CameraInfo> camera in device.Value.ListCamera) { if (camera.Value.IsValid) { //runninPool.Add(device.Value, camera.Value); _listCam.Add(iCount, camera.Value); iCount = iCount + 1; } } } } } } Util.GetRowCol(iCount, ref iRow, ref iCol); iCount = 0; VideoOutputInfo videoInfo; //VideoOutputDriver videoDriver; DeviceInfo oDevice; DeviceInfo oDeviceHandle; int OutputPort = 0; for (int i = 0; i < iRow; i++) { for (int j = 0; j < iCol; j++) { // get camera if (_listCam.ContainsKey(iCount)) { CameraInfo camera = _listCam[iCount]; CameraWindow camwin = mainMultiplexer.GetCamera(i, j); IntPtr intPtr= new IntPtr(); camera.Handle = intPtr; oDevice = _listDevice[camera.DeviceId]; // oDevice.Handle = camwin.Handle; oDevice.Handle = this.Handle; if (!_runningDeviceList.ContainsKey(camera.DeviceId)) { deviceDriver = new HikVideoServerDeviceDriver(); deviceDriver.Init(ref oDevice); _runningDeviceList.Add(camera.DeviceId, deviceDriver); } if (!_runningDeviceList[camera.DeviceId].IsValidDevice) { iCount = iCount + 1; continue; } oDevice.ServiceID = _runningDeviceList[camera.DeviceId].ServiceId; if (!_runningCameraList.ContainsKey(camera.CameraId)) { cameraDriver = new HikVideoServerCameraDriver(oDevice); cameraDriver.Start(camera, CardOutType.DefaultDisplay, 1); _runningCameraList.Add(camera.CameraId, cameraDriver); mainMultiplexer.SetCamera(i, j, cameraDriver); } //runningPool.Add(camwin, oDevice, camera); if (OutputPort < 2) { videoInfo = new VideoOutputInfo(); videoInfo.CameraId = camera.CameraId; videoInfo.OutputPort = OutputPort; OutputPort = OutputPort + 1; } iCount = iCount + 1; } } } mainMultiplexer.Rows = iRow; mainMultiplexer.Cols = iCol; mainMultiplexer.SingleCameraMode = false; mainMultiplexer.CamerasVisible = true; }