protected void AppendMoreGoogleImages() { Profile pf = Profile.GetUser(Page.User.Identity.Name); // Get an update FetchingGooglePhotos?.Invoke(this, new EventArgs()); if (!GooglePhotosDateToRetrieve.HasValue()) { return; // nothing to do. } DateTime?lastDate = RetrievedGooglePhotosDate; // flush results if the requested date has changed because the "more results" link will break otherwise. if (lastDate != null && lastDate.HasValue && lastDate.Value.CompareTo(GooglePhotosDateToRetrieve) != 0) { RetrievedGooglePhotos = new GoogleMediaResponse(); } RetrievedGooglePhotosDate = GooglePhotosDateToRetrieve; GoogleMediaResponse result = RetrievedGooglePhotos = GooglePhoto.AppendImagesForDate(pf, GooglePhotosDateToRetrieve, IncludeVideos, RetrievedGooglePhotos).Result; lnkMoreGPhotos.Visible = false; if (result == null || !result.mediaItems.Any()) { lblGPhotoResult.Text = Resources.LocalizedText.GooglePhotosNoneFound; result = new GoogleMediaResponse(); } rptGPhotos.DataSource = result.mediaItems; rptGPhotos.DataBind(); lnkMoreGPhotos.Visible = !String.IsNullOrEmpty(result.nextPageToken); pnlGPResult.Visible = RetrievedGooglePhotos.mediaItems.Any(); }
protected void imgPullGoogle_Click(object sender, EventArgs e) { RetrievedGooglePhotos = new GoogleMediaResponse(); AppendMoreGoogleImages(); }