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);
}
}
}));
}