Beispiel #1
0
        public DownloadSura(QariViewModel qari, int suraNo)
        {
            InitializeComponent();

            this.suraNo = suraNo;


            destPath = string.Format("Sounds//{0}", qari.Qari.EnglishName);

            GetDownloadURL(qari);

            DownlaodSura();
        }
Beispiel #2
0
        private void GetDownloadURL(QariViewModel qari)
        {
            using (var file = Assembly.GetExecutingAssembly().GetManifestResourceStream("Quran.Data." + qari.Qari.EnglishName + ".lst"))
            {
                using (var tr = new StreamReader(file))
                {
                    int lineNo = 0;
                    while (lineNo < suraNo - 1)
                    {
                        tr.ReadLine();
                        ++lineNo;
                    }

                    url = tr.ReadLine();
                }
            }
        }
Beispiel #3
0
        private void LoadQaris(int suraNo)
        {
            List <QariViewModel> list = new List <QariViewModel>();

            foreach (var qari in Quran.Code.QuranProvider.Meta.Qaris)
            {
                QariViewModel qariItem = new QariViewModel();
                qariItem.ID          = qari.ID;
                qariItem.Name        = qari.Name;
                qariItem.Qari        = qari;
                qariItem.ImageSource = string.Format("./images/qaris/{0}.png", qari.ID);
                qariItem.IsAvailable = qari.ID == 0 || qari.Availability[suraNo - 1];

                if (qariItem.IsAvailable)
                {
                    if (qari.ID != 0)
                    {
                        string audioFile = string.Format("Sounds//{0}//{1}.mp3", qari.EnglishName, suraNo.ToString().PadLeft(3, '0'));
                        if (System.IO.File.Exists(audioFile))
                        {
                            qariItem.IsExist = true;
                        }
                    }
                    else
                    {
                        qariItem.IsExist = true;
                    }
                }

                list.Add(qariItem);
            }

            listBox.ItemsSource = list;

            listBox.SelectedIndex = AppSettings.Qari;
        }