Beispiel #1
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string targetDir = DownloadableAudioListProcessor.SoundsPath;

            if (!Directory.Exists(targetDir))
            {
                Directory.CreateDirectory(targetDir);
            }
            Dictionary <string, string> audioInfo = (this.pnlList.Controls[_RealDownloadIndex] as SndDownloadInfo).Tag as Dictionary <string, string>;
            string strException;

            if (!DownloadableAudioListProcessor.DownloadAudioXml(audioInfo["audio_xml"], targetDir, true, out strException))
            {
                MessageBox.Show(string.Format("دریافت فایل XML خوانش {0} با خطا مواجه شد.", DownloadableAudioListProcessor.SuggestTitle((this.pnlList.Controls[_RealDownloadIndex] as SndDownloadInfo).Tag as Dictionary <string, string>)), "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
            }
            else
            {
                string sFileDownloaded = DownloadUtilityClass.DownloadFileIgnoreFail(
                    ((this.pnlList.Controls[_RealDownloadIndex] as SndDownloadInfo).Tag as Dictionary <string, string>)["audio_mp3"],
                    targetDir,
                    this.backgroundWorker, out string expString);
                if (!string.IsNullOrEmpty(sFileDownloaded))
                {
                    _DownloadedSounds.Add(audioInfo);
                }
                else
                if (_RealDownloadIndex >= 0)
                {
                    MessageBox.Show(string.Format("دریافت فایل صوتی خوانش {0} با خطا مواجه شد.\n{1}", DownloadableAudioListProcessor.SuggestTitle((this.pnlList.Controls[_RealDownloadIndex] as SndDownloadInfo).Tag as Dictionary <string, string>), expString), "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
                }
            }
        }
Beispiel #2
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string targetDir = GDBListProcessor.DownloadPath;

            if (!Directory.Exists(targetDir))
            {
                Directory.CreateDirectory(targetDir);
            }
            string sFileDownloaded = DownloadUtilityClass.DownloadFileIgnoreFail(
                ((this.pnlList.Controls[_RealDownloadIndex] as GdbDownloadInfo).Tag as GDBInfo).DownloadUrl,
                targetDir,
                this.backgroundWorker, out string expString);

            if (!string.IsNullOrEmpty(sFileDownloaded))
            {
                _DownloadedFiles.Add(sFileDownloaded);
            }
            else
            {
                MessageBox.Show(string.Format("دریافت مجموعهٔ {0} با خطا مواجه شد.\n{1}", ((this.pnlList.Controls[_RealDownloadIndex] as GdbDownloadInfo).Tag as GDBInfo).CatName, expString), "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
            }
        }