private void CalcTimeSpan(CCT.NUI.Core.Point point)
        {
            var startTime = moveStartTime.TotalMilliseconds;
            var newTime   = Math.Abs(startTime + (point.X - moveStart.X) * 100);

            this.slider.Value = newTime;;
        }
 private void TimeShiftMode(HandData rightHand)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         if (this.selectedVideo != null && this.selectedVideo.IsPaused)
         {
             this.selectedVideo.Play();
         }
         var rightFinger = rightHand.Fingers.OrderBy(f => f.Location.X).FirstOrDefault();
         if (rightFinger != null)
         {
             if (!moveMode)
             {
                 if (this.selectedVideo != null && this.selectedVideo.Duration.HasTimeSpan)
                 {
                     moveMode            = true;
                     moveStartTime       = this.selectedVideo.Position;
                     moveStart           = rightFinger.Location;
                     this.slider.Opacity = 0.8;
                     this.slider.Maximum = this.selectedVideo.Duration.TimeSpan.TotalMilliseconds;
                     this.slider.Value   = this.selectedVideo.Position.TotalMilliseconds;
                     this.slider.SetValue(Canvas.LeftProperty, (double)rightFinger.Location.X);
                     this.slider.SetValue(Canvas.TopProperty, (double)rightFinger.Location.Y);
                 }
             }
             else
             {
                 this.CalcTimeSpan(rightFinger.Fingertip);
                 this.selectedVideo.Position = TimeSpan.FromMilliseconds(this.slider.Value);
                 this.slider.SetValue(Canvas.TopProperty, (double)rightFinger.Location.Y);
             }
         }
     }));
 }
        private Point MapToScreen(Point point)
        {
            var originalSize = new Size(this.handDataSource.Width, this.handDataSource.Height);

            return(new Point(
                       -50 + (float)(point.X / originalSize.Width * (SystemParameters.PrimaryScreenWidth + 100)),
                       -50 + (float)(point.Y / originalSize.Height * (SystemParameters.PrimaryScreenHeight + 100)),
                       point.Z));
        }
 private void ExecuteOnHitResult(CCT.NUI.Core.Point fingerTip, Action <RayMeshGeometry3DHitTestResult> action)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         var hitTestResult = VisualTreeHelper.HitTest(this.viewPort, this.canvas.TranslatePoint(new System.Windows.Point(fingerTip.X, fingerTip.Y), this.canvas));
         if (hitTestResult is RayMeshGeometry3DHitTestResult)
         {
             action(hitTestResult as RayMeshGeometry3DHitTestResult);
         }
     }));
 }
 private Point3D Map(CCT.NUI.Core.Point point)
 {
     return(new Point3D(point.X, (this.imageSource.Height - point.Y), 800 - point.Z));
 }
 private Point MapToScreen(Point point)
 {
     var originalSize = new Size(this.handDataSource.Width, this.handDataSource.Height);
     return new Point(
         -50 + (float)(point.X / originalSize.Width * (SystemParameters.PrimaryScreenWidth + 100)), 
         -50 + (float)(point.Y / originalSize.Height * (SystemParameters.PrimaryScreenHeight + 100)), 
         point.Z);
 }
 private void TimeShiftMode(HandData rightHand)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         if (this.selectedVideo != null && this.selectedVideo.IsPaused)
         {
             this.selectedVideo.Play();
         }
         var rightFinger = rightHand.Fingers.OrderBy(f => f.Location.X).FirstOrDefault();
         if (rightFinger != null)
         {
             if (!moveMode)
             {
                 if (this.selectedVideo !=null && this.selectedVideo.Duration.HasTimeSpan)
                 {
                     moveMode = true;
                     moveStartTime = this.selectedVideo.Position;
                     moveStart = rightFinger.Location;
                     this.slider.Opacity = 0.8;
                     this.slider.Maximum = this.selectedVideo.Duration.TimeSpan.TotalMilliseconds;
                     this.slider.Value = this.selectedVideo.Position.TotalMilliseconds;
                     this.slider.SetValue(Canvas.LeftProperty, (double)rightFinger.Location.X);
                     this.slider.SetValue(Canvas.TopProperty, (double)rightFinger.Location.Y);
                 }
             }
             else
             {
                 this.CalcTimeSpan(rightFinger.Fingertip);
                 this.selectedVideo.Position = TimeSpan.FromMilliseconds(this.slider.Value);
                 this.slider.SetValue(Canvas.TopProperty, (double)rightFinger.Location.Y);
             }
         }
     }));
 }