示例#1
0
        /// <summary>
        /// Searches for photos in the given latitude/longitude range.
        /// </summary>
        /// <param name="latLong"></param>
        /// <returns></returns>
        public static FlickrPhotos SearchForPhotos(Rect latLong)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.search");
            method.AddParameter("accuracy", "1");
            method.AddParameter("extras", "geo");
            string searchString = latLong.Left + "," + latLong.Top + "," +
                                  latLong.Right + "," + latLong.Bottom;

            method.AddParameter("bbox", searchString);

            FlickrPhotos photos = new FlickrPhotos(method, 50);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }
示例#2
0
        /// <summary>
        /// Searches for photos based upon the given query string
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static FlickrPhotos SearchForPhotos(string query)
        {
            FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.search");
            method.AddParameter("text", query);
            method.AddParameter("sort", "relevance");

            FlickrPhotos photos = new FlickrPhotos(method, 50);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }
示例#3
0
        /// <summary>
        /// Loads the given range of Flickr photos asynchronously
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="photos"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchLoadPhotoRange(int start, int end, FlickrPhotos photos,
                                                Dispatcher notificationDispatcher,
                                                FlickrWorkCompleteDelegate notificationEvent)
        {
            DateTime requestTime = DateTime.Now;

            AddToWorkQueue(delegate()
                           {
                               if (photos.LoadRange(start, end, requestTime))
                               {
                                   if (notificationDispatcher != null && notificationEvent != null)
                                   {
                                       notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                          notificationEvent,
                                                                          photos);
                                   }
                               }
                           }
                           );
        }
示例#4
0
        /// <summary>
        /// Gets the list of a users most recently updated photos
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static FlickrPhotos GetRecentlyUpdated(AuthorizedFlickrUser user)
        {
            FlickrMethod method = new FlickrMethod(ApiKey,
                                                   "flickr.photos.recentlyUpdated",
                                                   user.Token,
                                                   SharedSecret);

            int updateTime = 1;
            method.AddParameter("min_date", updateTime.ToString());

            FlickrPhotos photos = new FlickrPhotos(method, 50, user);
            photos.GetPhoto(0); // we call this to force the call to get the total # count

            return photos;
        }
示例#5
0
        /// <summary>
        /// Asynchronously gets the photo at the given index from the list of photos
        /// </summary>
        /// <param name="photos"></param>
        /// <param name="index"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchGetPhoto(FlickrPhotos photos,
                                          int index,
                                          Dispatcher notificationDispatcher,
                                          FlickrWorkCompleteDelegate notificationEvent)
        {
            AddToWorkQueue(delegate()
                           {
                               FlickrPhoto photo = photos.GetPhoto(index);

                               if (photo != null)
                               {
                                   string info = GetPhotoInfo(photo);
                                   photo.Info = info;

                                   if (notificationDispatcher != null && notificationEvent != null)
                                   {
                                       notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                          notificationEvent,
                                                                          photo);
                                   }
                               }
                           }
                           );
        }