public PhotosetsGetContext ( string photoId, string photosetId ) : Context | ||
photoId | string | The photo id of the photo in the set. |
photosetId | string | The id of the set. |
return | Context |
/// <summary> /// this method will get photograph info and context information (previous/next thumbnail URLs) given its unique image ID /// </summary> /// <param name="imageUID">unique ID of image</param> /// <param name="setUID">unique ID of set</param> /// <returns>Photograph Entity</returns> public Photograph GetFlickrPhotoContextByImageUID(string imageUID, string setUID) { try { Photograph photo = new Photograph(); //HACK NOTE: for some reaon GetFlickrPhotographByImageUID wasn't working here so I decided to get the whole set List <Photograph> photoList = GetPhotoSetPhotoListBySetID(setUID); //get the correct photo out of the collection foreach (Photograph p in photoList) { if (p.ImageUID == imageUID) { //photo = GetFlickrPhotographByImageUID(imageUID); photo = p; break; } } //add attributes to photo meta data Context photosetContext = flickr.PhotosetsGetContext(imageUID, setUID); if (photosetContext.PreviousPhoto.PhotoId != "0") { photo.PreviousThumbnailURL = photosetContext.PreviousPhoto.ThumbnailUrl; photo.PreviousImageUID = photosetContext.PreviousPhoto.PhotoId; } if (photosetContext.NextPhoto.PhotoId != "0") { photo.NextThumbnailURL = photosetContext.NextPhoto.ThumbnailUrl; photo.NextImageUID = photosetContext.NextPhoto.PhotoId; } return(photo); } catch (Exception ex) { System.IO.StreamWriter sw = System.IO.File.AppendText(ConfigurationManager.AppSettings["ErrorLogPath"].ToString() + "SkiChairErrorLogFile.txt"); try { string logLine = System.String.Format("{0:G}: {1}.", System.DateTime.Now, "Error: " + ex.Message); sw.WriteLine(logLine); } finally { sw.Close(); } return(null); } }