private void picbox_MouseDoubleClick(object sender, EventArgs e) { PictureBox picb1 = sender as PictureBox; //取出点击的控件sender if (picb1.IsNull()) { EM("请重试"); return; } var index = Convert.ToInt32(picb1.Tag); var cameraId = PlayCameraId[index]; if (string.IsNullOrEmpty(cameraId)) { EM("无视频"); return; } YsAction.Stop(SessionId[index]); //关闭当前所有正在播放的该摄像头 var frm = new FullCamera(cameraId, SessionId[index], 3, _context.CacheContext.Data.SafeKye); frm.FormClosed += async(s, args) => { await PlayAsync(index); }; frm.ShowDialog(); }
private void picbox_MouseClick(object sender, MouseEventArgs e) { var pictureBox = sender as PictureBox; //取出点击的控件sender if (pictureBox == null) //点击则非空,否则为空 { return; } var cameraId = pictureBox.Tag.ToString(); var camera = _context.CacheContext.Data.DeviceList.SelectMany(m => m.CameraList).FirstOrDefault(m => m.CameraId == cameraId); if (camera.IsNull()) { EM("不存在的设备!"); return; } if (camera.Status != 1) { EM("设备不在线,无法播放!"); return; } if (PlayCameraId.Contains(cameraId)) { IS("该视频已经在播放中,请勿重复点击!"); return; } handle[j] = picbox[j].Handle; //赋予句柄 if (a == 1 && d == 1) //全部容器都在播放 { bool close = YsAction.Stop(SessionId[j]); //关闭最开始打开的画面 } PlayCameraId[j] = cameraId; PlayAsync(j); if (j < c - 1) { j++; } else if (j == c - 1) { j = 0; d = 1; } }
void Closed() { YsAction.Stop(sessionId); Close(); }