Exemplo n.º 1
0
        /// <summary>
        /// Implements the logic to get the next AudioTrack instance.
        /// In a playlist, the source can be from a file, a web request, etc.
        /// </summary>
        /// <remarks>
        /// The AudioTrack URI determines the source, which can be:
        /// (a) Isolated-storage file (Relative URI, represents path in the isolated storage)
        /// (b) HTTP URL (absolute URI)
        /// (c) MediaStreamSource (null)
        /// </remarks>
        /// <returns>an instance of AudioTrack, or null if the playback is completed</returns>
        private AudioTrack GetNextTrack(AudioTrack currentTrack)
        {
            if (currentTrack != null && currentTrack.Tag != null)
            {
                var request = new AudioRequest(currentTrack.Tag);
                if (request.ToAyah != null && request.ToAyah.Equals(request.CurrentAyah))
                    return null;

                request.GotoNextAyah();
                return GetTrackFromRequest(request);
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 2
0
 public void AudioRequestGotoNextDoesntReturnBismillahForTawba()
 {
     var request = new AudioRequest(0, new QuranAyah(8, 75), null, 0, AudioDownloadAmount.Page);
     request.GotoNextAyah();
     Assert.Equal(new QuranAyah(9, 1), request.CurrentAyah);
 }
Exemplo n.º 3
0
 public void AudioRequestGotoNextRepeatsAyah()
 {
     var request = new AudioRequest(0, new QuranAyah(1, 1), new RepeatInfo(RepeatAmount.OneAyah, 1), 0, AudioDownloadAmount.Page);
     request.GotoNextAyah();
     Assert.Equal(new QuranAyah(1, 1), request.CurrentAyah);
     request.GotoNextAyah();
     Assert.Equal(new QuranAyah(1, 2), request.CurrentAyah);
 }
Exemplo n.º 4
0
 public void AudioRequestGotoNextReturnsBismillah(int expSura, int expAya, int currSura, int currAya)
 {
     var request = new AudioRequest(0, new QuranAyah(currSura, currAya), null, 0, AudioDownloadAmount.Page);
     request.GotoNextAyah();
     Assert.Equal(new QuranAyah(expSura, expAya), request.CurrentAyah);
 }