Exemple #1
0
 //Runs when the track has ended. The next track will be loaded and played.
 //It's assigned to CurrentTrackElement.MediaEnded in the MainWindowViewModel constructor
 //If the playQueue has played all tracks, CurrentTrack will be set to the first Track in TrackWaitingList and the audio will be paused.
 public void Track_Ended(Object sender, EventArgs e)
 {
     if (PlayQueue.RepeatMode == PlayQueue.RepeatModes.TrackRepeat) //If the repeatMode is TrackRepeat, track will start from the beginning when track is ended
     {
         TimeSpan timerNull = new TimeSpan(0, 0, 0);                //Set timer to 0 sec.
         CurrentTrackElement.Position = timerNull;
         CurrentTrackElement.Play();
     }
     else
     {
         NextTrack();
     }
 }
Exemple #2
0
        //The methods that control or interact with the CurrentTrackElement
        #region CurrentTrackElement Methods
        public void PlayTrack()
        {
            if (CurrentTrackElement.IsLoaded && CurrentTrackElement.Source != null)
            {
                CurrentTrackElement.Play();
                PlayButtonIcon = new Uri(@"\ImageResources\pauseicon.ico", UriKind.Relative);
                PlayQueueController.UnpauseTrack();                                                                                 //Sets pause bool to true

                SongName   = PlayQueue.CurrentTrack.Name;                                                                           // set the name of the current track
                ArtistName = PlayQueue.CurrentTrack.Artist;                                                                         // set the artist of the current track
                AlbumImage = new Uri(@"" + PlayQueue.CurrentTrack.GetAlbumCover(PlayQueue.CurrentTrack.TrackId), UriKind.Relative); // set the album image by calling the "getAlbumCover" function
            }
        }