internal void SeekToMousePointInTime(TimeSpan seekTime)
        {
            if (seekTime.Ticks < 0)
            {
                seekTime = TimeSpan.FromTicks(1);
            }
            partPlayStart = seekTime;

            MarkerStoryboard.Begin(PositionBar, true);  // if the second parameter is missing or false, it doesn't work
            MarkerStoryboard.Seek(PositionBar, seekTime, TimeSeekOrigin.BeginTime);
            MarkerStoryboard.Pause(PositionBar);        // stop doesn't work

            PlayerStoryboard.Begin(mediaElement, true); // if the second parameter is missing or false, it doesn't work
            PlayerStoryboard.Seek(mediaElement, seekTime, TimeSeekOrigin.BeginTime);
            PlayerStoryboard.Pause(mediaElement);       // stop doesn't work
        }
 private void DoTrackPause()
 {
     if (!IsPaused)
     {
         Debug.WriteLine("Audio player was not paused");
         PlayerStoryboard.Pause(mediaElement);
         IsPaused = true;
         Debug.WriteLine("Audio player now paused");
     }
     else
     {
         Debug.WriteLine("Audio player was paused");
         PlayerStoryboard.Resume(mediaElement);
         IsPaused = false;
         Debug.WriteLine("Audio player now unpaused");
     }
 }
        private void Storyboard_Changed(object sender, EventArgs e)
        {
            if (endAnimationTime == null)
            {
                return;
            }

            ClockGroup clockGroup = sender as ClockGroup;

            if (clockGroup != null)
            {
                MediaClock mediaClock = clockGroup.Children[0] as MediaClock;
                if (mediaClock.CurrentProgress.HasValue)
                {
                    if (mediaClock.CurrentTime >= endAnimationTime)
                    {
                        PlayerStoryboard.Pause(mediaElement);
                    }
                }
            }
        }