private void SetPagination(PhotoPage page) { var pageCount = Math.Ceiling((float)page.totalResults / (float)page.perPage); TotalPages = new ObservableCollection <string>(SetPaginationCount(pageCount)); if (TotalPages?.Count > 0) { SelectedPage = TotalPages.First(); } }
public void FillGridView(PhotoPage page) { if (page != null) { currentPage = page; if (needPagination) { SetPagination(page); } } }
public void Init() { explore = new Explore(); photo = new PhotoPage(); alboms = new Alboms(); check = new Check(); Browser.Navigate().GoToUrl("https://www.flickr.com/explore"); Browser.FindElement(By.CssSelector("a.overlay")).Click(); Wait.Until(ExpectedConditions.ElementToBeClickable(explore.Photo[0])); photo.Author.Click(); alboms.GoAlbom.Click(); System.Threading.Thread.Sleep(5000); }
public async Task NavigateTo(PhotoPage page) { var targetPage = 0; var currentPage = int.Parse(_view.Page); var totalPages = int.Parse(_view.Pages); switch (page) { case PhotoPage.First: if (currentPage != 1) { targetPage = 1; } break; case PhotoPage.Previous: if (currentPage != 1) { targetPage = currentPage - 1; } break; case PhotoPage.Next: if (currentPage != totalPages) { targetPage = currentPage + 1; } break; case PhotoPage.Last: if (currentPage != totalPages) { targetPage = totalPages; } break; } if (targetPage != 0) { await GetAndSetPhotos(targetPage); } }
public async Task NavigateTo(PhotoPage page) { int targetPage = 0; int currentPage = Convert.ToInt32(_view.Page); int totalPages = Convert.ToInt32(_view.Pages); switch (page) { case PhotoPage.First: if (currentPage != 1) targetPage = 1; break; case PhotoPage.Previous: if (currentPage != 1) targetPage = currentPage - 1; break; case PhotoPage.Next: if (currentPage != totalPages) targetPage = currentPage + 1; break; case PhotoPage.Last: if (currentPage != totalPages) targetPage = totalPages; break; } if (targetPage != 0) await GetAndSetPhotos(targetPage); }
private void displayPhotoPageView(int para_photoPageIndex) { contentsPageChild.gameObject.SetActive(false); photoPageChild.gameObject.SetActive(true); isInContentsView = false; isInPageView = true; isInCloseupView = false; PhotoPage reqPage = availablePhotoPages[para_photoPageIndex]; currPhotoPage = reqPage; currPhotoPageIndex = para_photoPageIndex; //int reqLA = currPhotoPage.getLangArea(); //int reqDiff = currPhotoPage.getDifficulty(); humanReadableDescText = currPhotoPage.getExplanation(); // Adjust state of the previous and next buttons. Transform prevPageBtn = photoPageChild.FindChild("PreviousPageButton"); Transform nextPageBtn = photoPageChild.FindChild("NextPageButton"); prevPageBtn.renderer.enabled = true; nextPageBtn.renderer.enabled = false; if((availablePhotoPages.Count > 0)&&(currPhotoPageIndex > 0)&&(currPhotoPageIndex < availablePhotoPages.Count)) { prevPhotoPageAvailable = true; prevPageBtn.renderer.enabled = true; } if((availablePhotoPages.Count > 0)&&(currPhotoPageIndex < (availablePhotoPages.Count-1))&&(currPhotoPageIndex >= 0)) { nextPhotoPageAvailable = true; nextPageBtn.renderer.enabled = true; } // Setup page title, bookmark and prev, next buttons. if( ! photoPageBoundsLoaded) { string[] elementNames = {"PhotoPageTitle","BookmarkTip","PreviousPageButton","NextPageButton","PlayPageButton","NoteScrollArea"}; string[] elementContent = {"PhotoPageTitle","BookmarkTip","PreviousPage","NextPage","PlayPageButton","NoteScrollArea"}; bool[] destroyGuideArr = {false,true,false,false,false,true}; int[] textElementTypeArr = {0,0,0,0,0,0}; prepTextElements(elementNames,elementContent,destroyGuideArr,textElementTypeArr,photoPageChild.name); photoPageBoundsLoaded = true; } // Setup page number text. Transform pageNumber = photoPageChild.FindChild("PageNumber"); pageNumber.GetComponent<TextMesh>().text = " ";//""+(para_photoPageIndex+1); pageNumber.renderer.sortingOrder = 1110; // Setup photos on the page. PhotoVisualiser pVisualiser = new PhotoVisualiser(); int numOfPhotos = reqPage.getNumAvailablePhotos(); numPhotosOnCurrPage = numOfPhotos; Dictionary<int,Photo> availablePhotos = reqPage.getAvailablePhotos(); for(int i=0; i<4; i++) { Transform tmpOldPhoto = photoPageChild.FindChild("PhotoPosition"+i); if(tmpOldPhoto != null) { Destroy(tmpOldPhoto.gameObject); } Transform tmpOldCaption = photoPageChild.FindChild("Caption"+i); if(tmpOldCaption != null) { Destroy(tmpOldCaption.gameObject); } } for(int i=0; i<4; i++) { Transform reqPhotoGuide = photoPageChild.FindChild("PhotoTemplate"+(i+1)); Transform captionTextGuide = reqPhotoGuide.FindChild("CaptionText"); captionTextGuide.renderer.enabled = false; Transform photoNumber = reqPhotoGuide.FindChild("PhotoNumber"); photoNumber.GetComponent<TextMesh>().text = ""+ (((currPhotoPageIndex * 4) + i) + 1); photoNumber.renderer.sortingOrder = 2011; photoNumber.renderer.enabled = true; } for(int i=0; i<numOfPhotos; i++) { Transform reqPhotoGuide = photoPageChild.FindChild("PhotoTemplate"+(i+1)); if((reqPhotoGuide != null)&&(availablePhotos.ContainsKey(i))) { Photo reqPhoto = availablePhotos[i]; reqPhotoGuide.parent = null; Transform photoBlank = reqPhotoGuide.FindChild("PhotoBlank"); photoBlank.renderer.enabled = false; if( ! uiBounds.ContainsKey("PhotoPosition"+i)) { uiBounds.Add("PhotoPosition"+i,WorldSpawnHelper.getWorldToGUIBounds(photoBlank.renderer.bounds,upAxisArr)); } GameObject nwPhotoRender = pVisualiser.producePhotoRender("PhotoPosition"+i,reqPhoto,0.025f,photoBlank.gameObject,false); CommonUnityUtils.setSortingOrderOfEntireObject(nwPhotoRender,1300); reqPhotoGuide.FindChild("SellotapeCorners").renderer.sortingOrder = 2000; Transform selloBanner = reqPhotoGuide.FindChild("SellotapeBanner"); selloBanner.renderer.sortingOrder = 2010; Transform captionTextGuide = reqPhotoGuide.FindChild("CaptionText"); GameObject nwCaptionObj = WordBuilderHelper.buildWordBox(99,reqPhoto.getDateTimeStampStr(),CommonUnityUtils.get2DBounds(captionTextGuide.renderer.bounds),2f,upAxisArr,genericWordBoxPrefab); nwCaptionObj.name = "Caption"+i; Destroy(nwCaptionObj.transform.FindChild("Board").gameObject); nwCaptionObj.transform.FindChild("Text").renderer.sortingOrder = 2011; nwCaptionObj.transform.parent = photoPageChild; Transform photoNumber = reqPhotoGuide.FindChild("PhotoNumber"); photoNumber.renderer.enabled = false; nwPhotoRender.transform.parent = photoPageChild; reqPhotoGuide.parent = photoPageChild; } } triggerSoundAtCamera("PageTurn"); }
public App() { InitializeComponent(); MainPage = new PhotoPage(); }