Beispiel #1
0
        public async void PlayTrack(PlayableBase track, IPlaylist playlist)
        {
            CSCoreEngine.StopPlayback();

            if (Queue.HasTracks && Queue.FirstOrDefault(t => t.TrackId == track.AuthenticationCode) != null)
            {
                Queue.RemoveTrack(track);
            }

            if (await CSCoreEngine.OpenTrack(track))
            {
                CSCoreEngine.TogglePlayPause();
                CurrentPlaylist = playlist;
            }
        }
Beispiel #2
0
        public async void GoBackward()
        {
            if (CurrentPlaylist == null || CurrentPlaylist.Tracks.Count == 0)
            {
                return;
            }
            PlayableBase newtrack;

            if (Lasttracks.Count > 1) //Check if there are more than two tracks, because the current track is the last one in the list
            {
                Lasttracks.Remove(Lasttracks.Last(x => x.Track == CSCoreEngine.CurrentTrack));
                newtrack        = Lasttracks.Last().Track;
                CurrentPlaylist = Lasttracks.Last().Playlist;
            }
            else
            {
                int currenttrackindex = CurrentPlaylist.Tracks.IndexOf(CSCoreEngine.CurrentTrack);
                int nexttrackindex    = currenttrackindex;
                if (CheckIfTracksExists(CurrentPlaylist))
                {
                    while (true)
                    {
                        nexttrackindex--;
                        if (0 > nexttrackindex)
                        {
                            nexttrackindex = CurrentPlaylist.Tracks.Count - 1;
                        }
                        if (CurrentPlaylist.Tracks[nexttrackindex].TrackExists)
                        {
                            break;
                        }
                    }
                }
                _openedTrackWithStandardBackward = true;
                newtrack = CurrentPlaylist.Tracks[nexttrackindex];
            }

            CSCoreEngine.StopPlayback();
            if (await CSCoreEngine.OpenTrack(newtrack))
            {
                CSCoreEngine.TogglePlayPause();
            }
        }