public void Does_not_skip_records_if_passed_source_is_less_than_or_equal_to_page_size()
        {
            var list = new PaginatedCollection<string>( new[]{"third","fourth"}, 2, 2, 10);

            Assert.AreEqual("third", list[0]);
            Assert.AreEqual("fourth", list[1]);
        }
Example #2
0
        public TopTracksViewModel(LastfmClient lfClient, INavigationService navigationService)
        {
            _lfClient          = lfClient;
            _navigationService = navigationService;

            GoToTrackInfoCommand = new DelegateCommand <LastTrack>(OnGoToTrackInfoCommand);
            Tracks = new PaginatedCollection <LastTrack>(LoadMoreTopTracks);
        }
        public void Collection_PopulatedCollection(IEnumerable <int> collection, uint pageNumber, uint pageSize, IEnumerable <int> expected)
        {
            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                collection);

            Assert.That(subject.Collection, Is.EqualTo(expected));
        }
Example #4
0
        public async Task <IActionResult> Users(string sortOrder, string keyword, int pageIndex = 1, int pageSize = 50)
        {
            ViewData["keyword"]   = keyword;
            ViewData["sortorder"] = sortOrder;

            PaginatedCollection <API.Common.Model.User> userList = await new UserManager().GetUsers(sortOrder, keyword, pageIndex, pageSize);

            return(View(userList));
        }
Example #5
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (e.NavigationMode == NavigationMode.New || e.NavigationMode == NavigationMode.Refresh)
            {
                CachedTracks = new PaginatedCollection <CachedTrack>(LoadMoreTracks);
            }

            base.OnNavigatedTo(e, viewModelState);
        }
        public void NumberOfPages_EmptyCollection_0()
        {
            uint pageSize = 5, pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                Enumerable.Empty <int>());

            Assert.That(subject.NumberOfPages, Is.EqualTo(0));
        }
        public void PageSize_SamesAsProvidedInPagination()
        {
            uint pageSize = 5, pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                Substitute.For <IEnumerable <int> >());

            Assert.That(subject.Pagesize, Is.EqualTo(pageSize));
        }
        public void NumberOfPages_PopulatedCollection(IEnumerable <int> collection, uint pageSize, uint expectedNumberOfPages)
        {
            uint pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                collection);

            Assert.That(subject.NumberOfPages, Is.EqualTo(expectedNumberOfPages));
        }
        public void NumberOfPages_NullCollection_0()
        {
            uint pageSize = 5, pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                null);

            Assert.That(subject.NumberOfPages, Is.EqualTo(0));
        }
        public void Collection_NullCollection_Null()
        {
            uint pageSize = 5, pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                null);

            Assert.That(subject.Collection, Is.Null);
        }
        public void Collection_EmptyCollection_Empty()
        {
            uint pageSize = 5, pageNumber = default(uint);

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                Enumerable.Empty <int>());

            Assert.That(subject.Collection, Is.Empty);
        }
 public void Defaults()
 {
     var list = new PaginatedCollection<string>();
     Assert.IsNotNull(list);
     Assert.AreEqual(list.Page, 1);
     Assert.IsFalse(list.HasNextPage);
     Assert.IsFalse(list.HasPreviousPage);
     Assert.AreEqual(list.PageCount, 1);
     Assert.AreEqual(0, list.Count);
 }
        public void Collection_PageNumberGreaterThanNumberOfPages_Empty()
        {
            uint pageSize = 5, pageNumber = 6;

            var subject = new PaginatedCollection <int>(
                new Pagination(pageSize, pageNumber),
                new[] { 1, 2, 3 });

            Assert.That(subject.NumberOfPages, Is.LessThan(pageNumber));
            Assert.That(subject.Collection, Is.Empty);
        }
Example #14
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (viewModelState.Count == 0)
            {
                if (e.Parameter != null)
                {
                    var parameter = JsonConvert.DeserializeObject <SearchNavigationParameter>(e.Parameter.ToString());
                    Query = parameter.Query;
                }

                Artists = new PaginatedCollection <LastArtist>(LoadMoreArtists);

                Artists.HasMoreItems = false;
                Artists.ContentState = ContentState.NoData;

                if (!String.IsNullOrWhiteSpace(Query))
                {
                    Search();
                }
                else
                {
                    HideCommandBar();
                }
            }
            else
            {
                Query         = (string)viewModelState[nameof(Query)];
                _currentQuery = (string)viewModelState[nameof(_currentQuery)];

                Artists = JsonConvert.DeserializeObject <PaginatedCollection <LastArtist> >(
                    viewModelState[nameof(Artists)].ToString(), _lastImageSetConverter);

                Artists.LoadMoreItems = LoadMoreArtists;

                Artists.Page         = (uint)viewModelState[nameof(Artists) + "PageOffset"];
                Artists.ContentState = (ContentState)(int)viewModelState[nameof(Artists) + "State"];

                if (Artists.ContentState == ContentState.NoData)
                {
                    Artists.HasMoreItems = false;
                }

                if (!Artists.Any() && String.IsNullOrEmpty(Query))
                {
                    HideCommandBar();
                }
                else
                {
                    SetDefaultMode();
                }
            }

            base.OnNavigatedTo(e, viewModelState);
        }
Example #15
0
        public async Task <IActionResult> RegisteredApplications(string sortOrder, string keyword, int pageIndex = 1, int pageSize = 50)
        {
            ViewData["keyword"]   = keyword;
            ViewData["sortorder"] = sortOrder;
            using (var appManager = new RegisteredApplicationManager())
            {
                PaginatedCollection <API.Common.Model.RegisteredApplication> list = await appManager.Search(sortOrder, keyword, pageIndex, pageSize);

                return(View(list));
            }
        }
Example #16
0
        public IActionResult OnGet(int?pageIndex)
        {
            Posts = _postData.GetPaginatedPosts(pageIndex ?? 1, _pageSize);

            if (Posts == null)
            {
                return(NotFound());
            }

            return(Page());
        }
Example #17
0
 private void GetTopics()
 {
     Topics = new PaginatedCollection <TopicResponse>((c) =>
     {
         return(TopicService.GetTopicListAsync(new TopicPageRequest()
         {
             Page = c,
             Tab = TabType,
         }));
     });
 }
        public void Setting_up_pagination_with_1_page_of_records_and_setting_total_count()
        {
            var results = new[] {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"};

            var list = new PaginatedCollection<string>(results, 1, 5, 10);

            Assert.AreEqual(10, list.RecordCount);
            Assert.AreEqual(2, list.PageCount);
            Assert.AreEqual(1, list.Page);
            Assert.AreEqual(5, list.Count);
        }
        public void Pages_have_names_defaulting_to_numbers()
        {
            var results = new[] { "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth" };

            var names = new PaginatedCollection<string>(results, 1, 2, 10).PageNames.ToList();

            Assert.AreEqual("1", names[0]);
            Assert.AreEqual("2", names[1]);
            Assert.AreEqual("3", names[2]);
            Assert.AreEqual("4", names[3]);
            Assert.AreEqual("5", names[4]);
        }
Example #20
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <returns>The get async.</returns>
        /// <param name="sortOrder">Sort order.</param>
        /// <param name="currentFilter">Current filter.</param>
        /// <param name="searchString">Search string.</param>
        /// <param name="pageIndex">Page index.</param>
        public async Task OnGetAsync(string sortOrder, string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"ChipCardProfile/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort   = sortOrder;
            NumberSort    = String.IsNullOrEmpty(sortOrder) ? "number_desc" : "";
            DateSort      = sortOrder == "Date" ? "date_desc" : "Date";
            CurrentFilter = searchString;

            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <ChipCardProfile> chipCardProfileIQ = from c in _context.ChipCardProfile
                                                             select c;

            if (!String.IsNullOrEmpty(searchString))
            {
                chipCardProfileIQ = chipCardProfileIQ.Where(cp => cp.Number.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "number_desc":
                chipCardProfileIQ = chipCardProfileIQ.OrderByDescending(cp => cp.Number);
                break;

            case "Date":
                chipCardProfileIQ = chipCardProfileIQ.OrderBy(cp => cp.LastUpdate);
                break;

            case "date_desc":
                chipCardProfileIQ = chipCardProfileIQ.OrderByDescending(cp => cp.LastUpdate);
                break;

            default:
                chipCardProfileIQ = chipCardProfileIQ.OrderBy(cp => cp.Number);
                break;
            }

            int pageSize = 10;

            ChipCardProfile = await PaginatedCollection <ChipCardProfile> .CreateAsync(
                chipCardProfileIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Example #21
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"SystemData/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <SystemData> systemdataIQ = from s in _context.SystemData
                                                   select s;

            if (!String.IsNullOrEmpty(searchString))
            {
                systemdataIQ = systemdataIQ.Where(sys => sys.Name.Contains(searchString, StringComparison.CurrentCulture));
            }
            switch (sortOrder)
            {
            case "name_desc":
                systemdataIQ = systemdataIQ.OrderByDescending(p => p.Name);
                break;

            case "LastUpdate":
                systemdataIQ = systemdataIQ.OrderBy(p => p.LastUpdate);
                break;

            case "lastupdate_desc":
                systemdataIQ = systemdataIQ.OrderByDescending(p => p.LastUpdate);
                break;

            default:
                systemdataIQ = systemdataIQ.OrderBy(p => p.Name);
                break;
            }

            int pageSize = 10;

            SystemData = await PaginatedCollection <SystemData> .CreateAsync(
                systemdataIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);

            ;
        }
Example #22
0
        /// <summary>
        /// Ons the get async.
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <param name="currentFilter"></param>
        /// <param name="searchString"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"DeviceName/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            NameSort       = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <DeviceName> deviceNameIQ = from d in _context.DeviceName
                                                   select d;

            if (!String.IsNullOrEmpty(searchString))
            {
                deviceNameIQ = deviceNameIQ.Where(dn => dn.Name.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "name_desc":
                deviceNameIQ = deviceNameIQ.OrderByDescending(d => d.Name);
                break;

            case "LastUpdate":
                deviceNameIQ = deviceNameIQ.OrderBy(d => d.LastUpdate);
                break;

            case "lastupdate_desc":
                deviceNameIQ = deviceNameIQ.OrderByDescending(d => d.LastUpdate);
                break;

            default:
                deviceNameIQ = deviceNameIQ.OrderBy(d => d.Name);
                break;
            }

            int pageSize = 10;

            DeviceName = await PaginatedCollection <DeviceName> .CreateAsync(
                deviceNameIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Example #23
0
        public async Task OnGetAsync(string sortOrder,
                                     string currentFilter, string searchString, int?pageIndex)
        {
            _logger.LogDebug($"ZipCodes/Index/OnGetAsync({currentFilter},{searchString},{pageIndex})");

            CurrentSort    = sortOrder;
            CodeSort       = String.IsNullOrEmpty(sortOrder) ? "code_desc" : "";
            LastUpdateSort = sortOrder == "LastUpdate" ? "lastupdate_desc" : "LastUpdate";
            if (searchString != null)
            {
                pageIndex = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            CurrentFilter = searchString;

            IQueryable <ZipCode> zipcodeIQ = from z in _context.ZipCode
                                             select z;

            if (!String.IsNullOrEmpty(searchString))
            {
                zipcodeIQ = zipcodeIQ.Where(zip => zip.Code.Contains(searchString, StringComparison.CurrentCulture));
            }

            switch (sortOrder)
            {
            case "code_desc":
                zipcodeIQ = zipcodeIQ.OrderByDescending(z => z.Code);
                break;

            case "LastUpdate":
                zipcodeIQ = zipcodeIQ.OrderBy(z => z.LastUpdate);
                break;

            case "lastupdate_desc":
                zipcodeIQ = zipcodeIQ.OrderByDescending(z => z.LastUpdate);
                break;

            default:
                zipcodeIQ = zipcodeIQ.OrderBy(z => z.Code);
                break;
            }

            int pageSize = 10;

            ZipCode = await PaginatedCollection <ZipCode> .CreateAsync(
                zipcodeIQ.AsNoTracking(), pageIndex ?? 1, pageSize
                ).ConfigureAwait(false);
        }
Example #24
0
        public void Search_withMultipleReasonsReturnsMultipleDisputes()
        {
            DisputeSearchRequest request = new DisputeSearchRequest().
                DisputeReason.IncludedIn(DisputeReason.PRODUCT_UNSATISFACTORY, DisputeReason.RETRIEVAL);
            PaginatedCollection<Dispute> disputeCollection = gateway.Dispute.Search(request);

            var disputes = new List<Dispute>();
            foreach (var d in disputeCollection)
            {
                disputes.Add(d);
            }
            Assert.IsTrue(disputes.Count >= 2);
        }
Example #25
0
        public async Task <PaginatedCollection <OrderResponse> > Handle(QueryOrderCommand request, CancellationToken cancellationToken)
        {
            var specification = new AccountIdIs(request.AccountId);

            IOrderRepository            orderRepository = _orderDbContext.OrderRepository;
            PaginatedCollection <Order> order           = await orderRepository.GetAsync(specification, request.Offset, request.Limit, cancellationToken);

            PaginatedCollection <OrderResponse> result = new PaginatedCollection <OrderResponse>(order.TotalCount,
                                                                                                 order.Data
                                                                                                 .Select(x => new OrderResponse(x.Id, x.OrderStatus, x.OrderLines.Select(line => line.OrderItem).ToList())));

            return(result);
        }
Example #26
0
        public void Search_withEmptyResult()
        {
            DisputeSearchRequest request = new DisputeSearchRequest().
                Id.Is("non_existent_dispute");
            PaginatedCollection<Dispute> disputeCollection = gateway.Dispute.Search(request);

            var disputes = new List<Dispute>();
            foreach (var d in disputeCollection)
            {
                disputes.Add(d);
            }
            Assert.AreEqual(0, disputes.Count);
        }
Example #27
0
        public async Task <IActionResult> GetStocks([FromQuery] GetStockHttpRequest?getStockHttpRequest)
        {
            QueryStockCommand queryStockCommand = new QueryStockCommand
            {
                ProductId = getStockHttpRequest?.ProductId,
                InStock   = getStockHttpRequest?.InStock,
                Offset    = 0,
                Limit     = 10
            };
            PaginatedCollection <StockResponse> paginatedCollection = await _executionContext.ExecuteAsync(queryStockCommand, CancellationToken.None);

            return(StatusCode((int)HttpStatusCode.OK, paginatedCollection));
        }
Example #28
0
        public async Task <IActionResult> GetBooks([FromQuery] GetBookCollectionHttpRequest?getBookCollectionHttpRequest)
        {
            QueryBookCommand queryBookCommand = new QueryBookCommand
            {
                PartialBookName   = getBookCollectionHttpRequest?.PartialBookName,
                PartialAuthorName = getBookCollectionHttpRequest?.PartialAuthorName,
                Limit             = getBookCollectionHttpRequest?.Limit ?? 20,
                Offset            = getBookCollectionHttpRequest?.Offset ?? 0
            };
            PaginatedCollection <BookResponse> paginatedCollection = await _executionContext.ExecuteAsync(queryBookCommand, CancellationToken.None);

            return(StatusCode((int)HttpStatusCode.OK, paginatedCollection));
        }
Example #29
0
        public void Search_byIdReturnsSingleDispute()
        {
            DisputeSearchRequest request = new DisputeSearchRequest().
                Id.Is("open_dispute");
            PaginatedCollection<Dispute> disputeCollection = gateway.Dispute.Search(request);

            var disputes = new List<Dispute>();
            foreach (var d in disputeCollection)
            {
                disputes.Add(d);
            }
            Assert.AreEqual(1, disputes.Count);
        }
 private void IntializeMessenger()
 {
     MessengerInstance.Register <Facet>(this, (facet) =>
     {
         FilteredArticles = new PaginatedCollection <Content>(async i =>
         {
             var DataService = new FacetsRepository();
             return(await DataService.GetArticlesList(facet.key, ++pageNumber, 10, "male"));
         });
         //await _articlesRepInstance.GetArticlesList(facet.key, 1, 10, "male");
         //brandKey = facet.key;
     });
 }
        public async Task ToExcelDocument()
        {
            Pagination page = new Pagination();

            page.Calculate(1);
            List <TestingEntity> entities = new List <TestingEntity>()
            {
                new TestingEntity()
                {
                }
            };
            PaginatedCollection <TestingEntity> collection = new PaginatedCollection <TestingEntity>(page, entities);
            SpreadsheetDocument excel = await collection.ToExcelDocument();

            Assert.True(!excel.IsNotValid());
        }
Example #32
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (viewModelState.Count > 0)
            {
                _startFrom = (string)viewModelState[nameof(_startFrom)];
                MediaItems = JsonConvert.DeserializeObject <PaginatedCollection <Audio> >(
                    viewModelState[nameof(MediaItems)].ToString());
                MediaItems.LoadMoreItems = LoadMoreMediaItems;
            }
            else
            {
                MediaItems = new PaginatedCollection <Audio>(LoadMoreMediaItems);
            }

            base.OnNavigatedTo(e, viewModelState);
        }
Example #33
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                LastPivotIndex = 0;
            }

            if (viewModelState.Count > 0)
            {
                Artist = JsonConvert.DeserializeObject <LastArtist>(
                    viewModelState[nameof(Artist)].ToString(), _lastImageSetConverter);
                Tracks = JsonConvert.DeserializeObject <SimpleStateSupportCollection <LastTrack> >(
                    viewModelState[nameof(Tracks)].ToString(), _lastImageSetConverter);
                Albums = JsonConvert.DeserializeObject <PaginatedCollection <LastAlbum> >(
                    viewModelState[nameof(Albums)].ToString(), _lastImageSetConverter);
                Similar = JsonConvert.DeserializeObject <SimpleStateSupportCollection <LastArtist> >(
                    viewModelState[nameof(Similar)].ToString(), _lastImageSetConverter);

                if (e.NavigationMode == NavigationMode.New)
                {
                    LastPivotIndex = 0;
                }
                else
                {
                    LastPivotIndex = (int)viewModelState[nameof(LastPivotIndex)];
                }

                Tracks.LoadItems     = LoadTracks;
                Albums.LoadMoreItems = LoadMoreAlbums;
                Similar.LoadItems    = LoadSimilar;
            }
            else
            {
                Artist  = JsonConvert.DeserializeObject <LastArtist>(e.Parameter.ToString(), _lastImageSetConverter);
                Tracks  = new SimpleStateSupportCollection <LastTrack>(LoadTracks);
                Albums  = new PaginatedCollection <LastAlbum>(LoadMoreAlbums);
                Similar = new SimpleStateSupportCollection <LastArtist>(LoadSimilar);

                LastPivotIndex = 0;
            }

            Tracks.Load();
            Similar.Load();
            LoadArtistImage(Artist.Name);

            base.OnNavigatedTo(e, viewModelState);
        }
        public void Returns_expected_records_on_page_2()
        {
            var results = new[] { "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth" };

            var list = new PaginatedCollection<string>(results, 2, 5, 10);

            Assert.AreEqual(10, list.RecordCount);
            Assert.AreEqual(2, list.PageCount);
            Assert.AreEqual(2, list.Page);
            Assert.AreEqual(5, list.Count);

            Assert.IsTrue(list[0].Equals("sixth"));
            Assert.IsTrue(list[1].Equals("seventh"));
            Assert.IsTrue(list[2].Equals("eighth"));
            Assert.IsTrue(list[3].Equals("ninth"));
            Assert.IsTrue(list[4].Equals("tenth"));
        }
Example #35
0
        public void Search_effectiveDateRangeReturnsDispute()
        {
            DateTime startDate = DateTime.Parse("2014-03-03");
            DateTime endDate = DateTime.Parse("2014-03-05");
            DisputeSearchRequest request = new DisputeSearchRequest().
                EffectiveDate.Between(startDate, endDate);
            PaginatedCollection<Dispute> disputeCollection = gateway.Dispute.Search(request);

            var disputes = new List<Dispute>();
            foreach (var d in disputeCollection)
            {
                disputes.Add(d);
            }
            Assert.IsTrue(disputes.Count >= 1);
            Assert.AreEqual("2014", disputes[0].StatusHistory[0].EffectiveDate.Value.Year.ToString());
            Assert.AreEqual("3", disputes[0].StatusHistory[0].EffectiveDate.Value.Month.ToString());
            Assert.AreEqual("4", disputes[0].StatusHistory[0].EffectiveDate.Value.Day.ToString());
        }
 public void Cast()
 {
     var list = new PaginatedCollection<User>();
     IPaginatedCollection<INamedEntity<Guid>> cast = list.CastTo<User, INamedEntity<Guid>>();
 }
Example #37
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            myLibraryItemNames = new List<Xassida>();

            BookPage titlePage, tardioumanePage, bp;

            LoadXassida();

            this.DataContext = currentXassida;

            PagesCollection = new PaginatedCollection<Beyit>(currentXassida.Beyits);

            /// the title of the xassida will be the first page
            ///
            titlePage = new BookPage();

            StackPanel p = new StackPanel() { VerticalAlignment = VerticalAlignment.Center };
            TextBlock tPageTb = new TextBlock()
            {
                Text = currentXassida.Titre,
                FontSize = 35,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                TextAlignment = TextAlignment.Center,
                TextWrapping = TextWrapping.Wrap
            };
            p.Children.Add(tPageTb);
            titlePage.Content = p;

            readerBook.Items.Add(titlePage);

            tardioumanePage = new BookPage();
            tardioumanePage.Content = new TextBlock()
            {
                Text = currentXassida.Tardioumane,
                TextWrapping = TextWrapping.WrapWithOverflow,
                VerticalAlignment = VerticalAlignment.Center,

            };

            readerBook.Items.Add(tardioumanePage);

            for (int i = 0; i < PagesCollection.PagesCount; i++)
            {

                bp = new BookPage();
                StackPanel container = new StackPanel() { Orientation = Orientation.Vertical, VerticalAlignment = VerticalAlignment.Center };

                foreach (Beyit beyit in PagesCollection.GetData(i))
                {

                    DockPanel c = new DockPanel();
                    foreach (Bahru bahru in beyit.Bahrus)
                    {
                        TextBlock tb = new TextBlock() { Text = bahru.Contenu, Margin = new Thickness(4, 6, 4, 6), Width = 50 };
                        c.Children.Add(tb);
                    }

                    container.Children.Add(c);
                }

                container.Children.Add(new TextBlock() { Text = String.Format("page {0}", (i + 1).ToString()), Foreground = SystemColors.GrayTextBrush, FontSize = 7, Margin = new Thickness(0, 10, 0, 10) });

                bp.Content = container;
                readerBook.Items.Add(bp);

            }

            AppStore = IsolatedStorageFile.GetUserStoreForDomain();
            // Check for files saved in isolated storage
            foreach (string file in AppStore.GetFileNames())
            {
                myLibraryItemNames.Add(new Xassida() { Titre = file});
            }

            // Set the items source of the myLibrary List view

            myLibraryListView.ItemsSource = myLibraryItemNames;
        }