Exemplo n.º 1
0
 /// <summary>
 /// Manages this instance.
 /// </summary>
 private void Manage()
 {
     while (doMange)
     {
         Thread.CurrentThread.Join(1);
         Action a;
         if (null != (a = managerQueue.RawDequeue()))
         {
             a();
         }
         if (null != CurrentTrack && (CurrentTrack.Length.TotalMilliseconds - CurrentTrack.CurrentPositionMillisecond) <= PlayNextThreshold.Value)
         {
             var pre = 0;
             DoTheNextOne(ref pre);
         }
         if (PlayingState.Playing != State || DateTime.Now - LastProgress < progressUpdateInterval || null == CurrentTrack)
         {
             continue;
         }
         SendProgress();
     }
     if (null == CurrentTrack)
     {
         return;
     }
     CurrentTrack.Dispose();
     CurrentTrack.Stop();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Stop playing the current track and pause at the current position.
 /// </summary>
 /// <param name="requestedByUser">
 /// Whether the request to stop was issued by the user rather than internally.
 /// Specifying <c>true</c> will ensure that other methods like <see cref="EnsurePlayingSomething"/>
 /// will not resume music playback until the next explicit call to <see cref="Play"/>.
 /// </param>
 public void Stop(bool requestedByUser = false)
 {
     UserPauseRequested |= requestedByUser;
     if (CurrentTrack.IsRunning)
     {
         CurrentTrack.Stop();
     }
 }
Exemplo n.º 3
0
        private void StopTrack()
        {
            Play.IsEnabled  = true;
            Pause.IsEnabled = false;
            Play.Content    = "Play";
            Pause.Content   = "Stopped";

            CurrentTrack.Stop();
        }