public IEnumerable <TData> LoadPages(HttpRequest httpRequest, int maxPage = 1, bool reload = false, bool LoadImageFromWeb = false, bool refreshDocumentStore = false) { TDataPage dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, LoadImageFromWeb = LoadImageFromWeb, RefreshDocumentStore = refreshDocumentStore }).Document; if (!(dataPage is IEnumDataPages <TData>)) { throw new PBException("{0} is not IEnumDataPages<{1}>", dataPage.GetType().zGetTypeName(), typeof(TData).zGetTypeName()); } IEnumDataPages <TData> enumDataPages = (IEnumDataPages <TData>)dataPage; if (enumDataPages == null) { yield break; } // return data from page 1 foreach (TData data in enumDataPages.GetDataList()) { yield return(data); } // return data from page 2, ... for (int nbPage = 1; maxPage == 0 || nbPage < maxPage; nbPage++) { httpRequest = enumDataPages.GetHttpRequestNextPage(); if (httpRequest == null) { break; } dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, LoadImageFromWeb = LoadImageFromWeb, RefreshDocumentStore = refreshDocumentStore }).Document; if (!(dataPage is IEnumDataPages <TData>)) { throw new PBException("{0} is not IEnumDataPages<{1}>", dataPage.GetType().zGetTypeName(), typeof(TData).zGetTypeName()); } enumDataPages = (IEnumDataPages <TData>)dataPage; foreach (TData data in enumDataPages.GetDataList()) { yield return(data); } } }
public IEnumerable <TData> LoadPages(HttpRequest httpRequest, int maxPage = 1, bool reload = false, bool loadImageFromWeb = false, bool loadImageToData = false, bool refreshImage = false, bool refreshDocumentStore = false) { //IEnumDataPages<TData> dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, LoadImageFromWeb = loadImageFromWeb, LoadImageToData = loadImageToData, RefreshImage = refreshImage, RefreshDocumentStore = refreshDocumentStore }).Document; IEnumDataPages <TData> dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, ImageRequest = new WebImageRequest { LoadImageFromWeb = loadImageFromWeb, LoadImageToData = loadImageToData, RefreshImage = refreshImage }, RefreshDocumentStore = refreshDocumentStore }).Data; if (dataPage == null) { yield break; } // return data from page 1 foreach (TData data in dataPage.GetDataList()) { yield return(data); } // return data from page 2, ... for (int nbPage = 1; maxPage == 0 || nbPage < maxPage; nbPage++) { httpRequest = dataPage.GetHttpRequestNextPage(); if (httpRequest == null) { break; } //dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, LoadImageFromWeb = loadImageFromWeb, LoadImageToData = loadImageToData, RefreshImage = refreshImage, RefreshDocumentStore = refreshDocumentStore }).Document; dataPage = Load(new WebRequest { HttpRequest = httpRequest, ReloadFromWeb = reload, ImageRequest = new WebImageRequest { LoadImageFromWeb = loadImageFromWeb, LoadImageToData = loadImageToData, RefreshImage = refreshImage }, RefreshDocumentStore = refreshDocumentStore }).Data; foreach (TData data in dataPage.GetDataList()) { yield return(data); } } }