tags:

views:

17

answers:

1

I need help in the Storyboard Seek. The following code is not working:

Storyboard StoryBoard;

public void Reverse()
            {
                StoryBoard.Pause(this);

                TimeSpan ts = new TimeSpan(0);
                ts.Subtract(TimeSpan.FromMilliseconds(1000));
                StoryBoard.Seek(this, ts, TimeSeekOrigin.BeginTime);
            }

public void Forward()
            {
                StoryBoard.Pause(this);

                TimeSpan ts = new TimeSpan(0);
                ts.Add(TimeSpan.FromMilliseconds(1000));
                StoryBoard.Seek(this, ts, TimeSeekOrigin.BeginTime);
            }

Thanks In Advance.

A: 

For Reverse

TimeSpan CurrentTime = (TimeSpan) StoryBoard.CurrentTime;
TimeSpan SubtractTime = CurrentTime.Subtract(new TimeSpan(FrameRate * (long)Math.Pow(10,4)));
StoryBoard.Seek(SubtractTime, TimeSeekOrigin.Duration);

For Forward

TimeSpan CurrentTime = (TimeSpan) StoryBoard.CurrentTime;
TimeSpan AddTime = CurrentTime.Add(new TimeSpan(FrameRate * (long)Math.Pow(10,4)));
StoryBoard.Seek(Add, TimeSeekOrigin.Duration);