Exemple #1
0
        internal static Run GetRun(int suraNo, int ayaNo)
        {
            AyaSpan ayaSpan = dic[suraNo][ayaNo - 1] as AyaSpan;
            Span    span    = ayaSpan.Inlines.FirstInline as Span;

            return(span.Inlines.FirstInline as Run);
        }
Exemple #2
0
        internal static void InitProvider(int suraNo, Paragraph mainParagraph)
        {
            try
            {
                if (!dic.ContainsKey(suraNo))
                {
                    List <Run> tempRunList = new List <Run>();


                    int            sliceIndex = 0;
                    List <AyaSpan> list       = new List <AyaSpan>();

                    foreach (var aya in Quran.Suras[suraNo - 1].Ayas)
                    {
                        AyaSpan ayaSpan = new AyaSpan()
                        {
                            Tag = aya.AyaNo
                        };

                        foreach (var slice in aya.Slices)
                        {
                            SliceInfo sliceInfo = new SliceInfo()
                            {
                                AyaNo = aya.AyaNo, SliceID = slice.SliceID, SliceIndex = sliceIndex
                            };
                            Run run = new Run(slice.Text)
                            {
                                Tag = sliceInfo
                            };
                            tempRunList.Add(run);
                            trans.Add(slice.SliceID, TranslatedQuran.Suras[suraNo - 1].AllSlices[sliceIndex++].Text);
                            ayaSpan.Inlines.Add(new Span(run));
                        }

                        if (aya.AyaNo != 0)
                        {
                            list.Add(ayaSpan);
                            mainParagraph.Inlines.Add(ayaSpan);
                        }
                    }

                    dic[suraNo] = list.ToArray <AyaSpan>();
                    runs.Add(suraNo, tempRunList.ToArray());
                }
                else
                {
                    foreach (var ayaSpan in dic[suraNo])
                    {
                        mainParagraph.Inlines.Add(ayaSpan);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.Handle("QuranProvider >> InitProvider >> Sura:" + suraNo, ex);
                throw new ApplicationException();
            }
        }