private void SurfaceMode(HandCollection data) { this.Dispatcher.Invoke(new Action(() => { if (isNew) { if (this.selectedVideo != null) { this.selectedVideo.IsSelected = false; } this.selectedVideo = new VideoSurface(this.videoPaths[this.videoPointer++]); this.videos.Add(this.selectedVideo); this.selectedVideo.RequestRemove += new EventHandler(videoSurface_RequestRemove); if (videoPointer >= this.videoPaths.Length) { videoPointer = 0; } this.viewPort.Children.Add(selectedVideo.ModelVisual3D); this.selectedVideo.Play(); this.selectedVideo.Opacity = 0.8; isNew = false; } if (selectedVideo.IsPaused) { selectedVideo.Play(); } var points = new List<CCT.NUI.Core.Point>(); var hand1 = data.Hands[0]; var hand2 = data.Hands[1]; points.Add(hand1.FingerPoints[0].Fingertip); points.Add(hand1.FingerPoints[1].Fingertip); points.Add(hand2.FingerPoints[0].Fingertip); points.Add(hand2.FingerPoints[1].Fingertip); points = points.OrderBy((p) => p.X).ToList(); var leftPoints = points.Take(2).ToList(); var rightPoints = points.Skip(2).Take(2).ToList(); leftPoints = leftPoints.OrderByDescending(p => p.Y).ToList(); rightPoints = rightPoints.OrderByDescending(p => p.Y).ToList(); this.selectedVideo.SetPoints(Map(leftPoints[0]), Map(rightPoints[0]), Map(rightPoints[1]), Map(leftPoints[1])); })); moveMode = false; }
private void Remove(VideoSurface videoSurface) { this.videos.Remove(videoSurface); this.viewPort.Children.Remove(videoSurface.ModelVisual3D); }
private void Select(FingerPoint fingerTip) { ExecuteOnHitResult(fingerTip.Location, (hitTestResult) => { this.selectedVideo = GetByHitTest(hitTestResult as RayMeshGeometry3DHitTestResult); foreach (var video in this.videos.Where(v => v != selectedVideo)) { video.IsSelected = false; } this.selectedVideo.IsSelected = true; }); }