Ejemplo n.º 1
0
        private async void DownloadAndPlayAudioRequest(AudioRequest request)
        {
            if (request == null || this.ActiveDownload.IsDownloading)
            {
                return;
            }

            var result = await DownloadAudioRequest(request);

            if (!result)
            {
                QuranApp.NativeProvider.ShowErrorMessageBox("Something went wrong. Unable to download audio.");
            }
            else
            {
                var path = AudioUtils.GetLocalPathForAyah(request.CurrentAyah.Ayah == 0 ? new QuranAyah(1, 1) : request.CurrentAyah, request.Reciter);
                var title = request.CurrentAyah.Ayah == 0 ? "Bismillah" : QuranUtils.GetSurahAyahString(request.CurrentAyah);
                QuranApp.NativeProvider.AudioProvider.SetTrack(new Uri(path, UriKind.Relative), title, request.Reciter.Name, "Quran", null,
                    request.ToString());
            }
        }
Ejemplo n.º 2
0
 public void AudioRequestToStringEqualsConstructorWithAllParameters()
 {
     var pattern = "local://0/?amount=Juz&currentAyah=1:2&fromAyah=1:2&toAyah=2:2&repeat=Page-2-times&currentRepeat=2";
     var request = new AudioRequest(pattern);
     Assert.Equal(pattern, request.ToString());
 }
Ejemplo n.º 3
0
        private AudioTrack GetTrackFromRequest(AudioRequest request)
        {
            var ayah = request.CurrentAyah;
            var title = ayah.Ayah == 0 ? "Bismillah" : QuranUtils.GetSurahAyahString(ayah.Surah, ayah.Ayah);
            var path = AudioUtils.GetLocalPathForAyah(ayah.Ayah == 0 ? new QuranAyah(1, 1) : ayah, request.Reciter);

            using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (!isf.FileExists(path))
                    return null;
                else
                    return new AudioTrack(new Uri(path, UriKind.Relative), title, request.Reciter.Name, "Quran", null,
                       request.ToString(), EnabledPlayerControls.All);
            }
        }
Ejemplo n.º 4
0
 public void AudioRequestToStringEqualsConstructor()
 {
     var pattern = "local://0/?amount=Surah&currentAyah=1:2&fromAyah=2:2&currentRepeat=0";
     var request = new AudioRequest(pattern);
     Assert.Equal(pattern, request.ToString());
 }