private void OnBodyFrameArrived(object sender, BodyFrameArrivedEventArgs e) { using (var bodyFrame = e.FrameReference.AcquireFrame()) { if (bodyFrame == null) { return; } bodyFrame.GetAndRefreshBodyData(_bodies); foreach (var body in _bodies.Where(b => b.IsTracked && !_scans.ContainsKey(b.TrackingId))) { var gestureScan = new GestureScan(_kinectSensor, body.TrackingId, _visualGestureBuilderDatabase); gestureScan.Next += OnNext; gestureScan.Previous += OnPrevious; gestureScan.TakeControl += OnTakeControl; gestureScan.TrackingIdLost += OnTrackingIdLost; gestureScan.End += OnEnd; _scans.TryAdd(body.TrackingId, gestureScan); } } }
private void OnBodyFrameArrived(object sender, BodyFrameArrivedEventArgs e) { using (var bodyFrame = e.FrameReference.AcquireFrame()) { if (bodyFrame == null) return; bodyFrame.GetAndRefreshBodyData(_bodies); foreach (var body in _bodies.Where(b => b.IsTracked && !_scans.ContainsKey(b.TrackingId))) { var gestureScan = new GestureScan(_kinectSensor, body.TrackingId, _visualGestureBuilderDatabase); gestureScan.Next += OnNext; gestureScan.Previous += OnPrevious; gestureScan.TakeControl += OnTakeControl; gestureScan.TrackingIdLost += OnTrackingIdLost; gestureScan.End += OnEnd; _scans.TryAdd(body.TrackingId, gestureScan); } } }