示例#1
0
 private void SyrahSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cbSurahs.SelectedItem != null)
     {
         tbPageNumber.Text = "";
         cbAyah.Items.Clear();
         for (int i = 1; i <= QuranUtils.GetSurahNumberOfAyah(cbSurahs.SelectedIndex + 1); i++)
         {
             cbAyah.Items.Add(i.ToString(CultureInfo.InvariantCulture));
         }
         cbAyah.SelectedIndex = 0;
     }
 }
示例#2
0
 private void GenerateLastAyah()
 {
     if (RepeatInfo.RepeatAmount == RepeatAmount.None)
     {
         LastAyah = FirstAyah;
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.OneAyah)
     {
         LastAyah = GetLastAyahFromAyahCount(FirstAyah, 1);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.ThreeAyah)
     {
         LastAyah = GetLastAyahFromAyahCount(FirstAyah, 3);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.FiveAyah)
     {
         LastAyah = GetLastAyahFromAyahCount(FirstAyah, 5);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.TenAyah)
     {
         LastAyah = GetLastAyahFromAyahCount(FirstAyah, 10);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.Page)
     {
         int   page       = QuranUtils.GetPageFromAyah(FirstAyah);
         int[] pageBounds = QuranUtils.GetPageBounds(page);
         FirstAyah = new QuranAyah(pageBounds[0], pageBounds[1]);
         LastAyah  = new QuranAyah(pageBounds[2], pageBounds[3]);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.Surah)
     {
         int surah    = FirstAyah.Surah;
         int lastAyah = QuranUtils.GetSurahNumberOfAyah(surah);
         FirstAyah = new QuranAyah(surah, 1);
         LastAyah  = new QuranAyah(surah, lastAyah);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.Rub)
     {
         var rub = QuranUtils.GetRub3FromAyah(FirstAyah.Surah, FirstAyah.Ayah);
         FirstAyah = QuranUtils.GetRub3FirstAyah(rub);
         LastAyah  = QuranUtils.GetRub3LastAyah(rub);
     }
     else if (RepeatInfo.RepeatAmount == RepeatAmount.Juz)
     {
         var juz = QuranUtils.GetJuzFromAyah(FirstAyah.Surah, FirstAyah.Ayah);
         FirstAyah = QuranUtils.GetJuzFirstAyah(juz);
         LastAyah  = QuranUtils.GetJuzLastAyah(juz);
     }
 }
示例#3
0
 public void GetSuraPagesWorksForBadArguments()
 {
     Assert.Equal(-1, QuranUtils.GetSurahNumberOfAyah(0));
     Assert.Equal(-1, QuranUtils.GetSurahNumberOfAyah(10000));
 }
示例#4
0
 public void GetSuraPagesWorksForGoodArguments()
 {
     Assert.Equal(7, QuranUtils.GetSurahNumberOfAyah(1));
     Assert.Equal(6, QuranUtils.GetSurahNumberOfAyah(114));
 }
示例#5
0
 public QuranAudioTrack GetLastAyah()
 {
     return(new QuranAudioTrack(ReciterId,
                                new QuranAyah(Surah, QuranUtils.GetSurahNumberOfAyah(Surah)),
                                ScreenInfo));
 }