예제 #1
0
        private List <ContentPage> GetThikerPages()
        {
            var thikerPages = new List <ContentPage>();

            for (var thikerId = 0; thikerId < _viewModel.Wird.ThikerList.Count; thikerId++)
            {
                var         thiker = _viewModel.Wird.ThikerList[thikerId];
                ContentPage thikerPage;

                if (thiker.Iterations > 1)
                {
                    // For thiker with iteration > 1 we publish one thiker per page
                    thikerPage = new RtlCountingPage(Constants.Padding, thiker, _viewModel.Wird.Accent);
                }
                else
                {
                    // Combine the content if the thiker is part of the same group
                    var content     = thiker.Content;
                    var thikerGroup = thiker.ThikerGroup;

                    if (thikerGroup != 0)
                    {
                        while (thikerId < _viewModel.Wird.ThikerList.Count - 1 &&
                               thikerGroup == _viewModel.Wird.ThikerList[thikerId + 1].ThikerGroup)
                        {
                            content += Environment.NewLine + Environment.NewLine +
                                       _viewModel.Wird.ThikerList[thikerId + 1].Content;
                            thikerId++;
                        }
                    }

                    thikerPage = new RtlContentPage(Constants.Padding, content, thiker.Type == (int)ThikerTypes.Quran);
                }

                // Add page to list
                thikerPages.Add(thikerPage);
            }
            return(thikerPages);
        }
예제 #2
0
        /// <summary>
        /// Populate pages based on the wird
        /// </summary>
        private void PopulateWirdPages()
        {
            // Get thiker pages
            var thikerPages = GetThikerPages();

            // Add the summary page
            if (!IsNullOrWhiteSpace(_viewModel.Wird.Summary))
            {
                var summaryPage = new RtlContentPage(Constants.Padding, _viewModel.Wird.Summary);
                Children.Add(summaryPage);
            }

            // Add pages in proper RTL order
            foreach (var thikerPage in Enumerable.Reverse(thikerPages))
            {
                // Add the pages in reverse order
                Children.Add(thikerPage);
            }

            // If there are related thiker add in proper RTL order
            if (_viewModel.Wird.RelatedThiker == "Y")
            {
                GetRelatedThikerPages();
            }

            // If there is an introduction page add it
            if (!IsNullOrWhiteSpace(_viewModel.Wird.Introduction))
            {
                var introductionPage = new RtlContentPage(Constants.Padding, _viewModel.Wird.Introduction);
                Children.Add(introductionPage);
            }

            // Set the current page to the last page
            if (Children.Count > 0)
            {
                CurrentPage = Children[Children.Count - 1];
            }
        }