示例#1
0
        /// <summary>
        /// Asynchrnousy posts comments about the given photo.
        /// </summary>
        /// <param name="comments"></param>
        /// <param name="photo"></param>
        /// <param name="user"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchPostComments(string comments,
                                              FlickrPhoto photo,
                                              AuthorizedFlickrUser user,
                                              Dispatcher notificationDispatcher,
                                              FlickrWorkCompleteDelegate notificationEvent)
        {
            AddToWorkQueue(delegate()
                {
                    bool result = PostComments(comments, photo, user);

                    if (notificationDispatcher != null && notificationEvent != null)
                    {
                        notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                           notificationEvent,
                                                           result);
                    }
                }
                );
        }
示例#2
0
        /// <summary>
        /// Asynchronously searches for photo in the given latitude/longitude rectangle
        /// </summary>
        /// <param name="latLong"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchSearchForPhotos(Rect latLong,
                                                 Dispatcher notificationDispatcher,
                                                 FlickrWorkCompleteDelegate notificationEvent)
        {
            AddToWorkQueue(delegate()
                           {
                               FlickrPhotos photos = SearchForPhotos(latLong);

                               if (notificationDispatcher != null && notificationEvent != null)
                               {
                                   notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                      notificationEvent,
                                                                      photos);
                               }
                           }
                           );
        }
示例#3
0
        /// <summary>
        /// Asynchronously gets the icon for the given user.
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchGetUserPhoto(string userid,
                                              Dispatcher notificationDispatcher,
                                              FlickrWorkCompleteDelegate notificationEvent)
        {
            AddToWorkQueue(delegate()
                           {
                               XmlNode userInformation = GetUserInfo(userid);
                               int iconServer = Int32.Parse(userInformation.Attributes["iconserver"].InnerText);

                               string iconUrl;
                               if (iconServer > 0)
                               {
                                   iconUrl = "http://static.flickr.com/" + iconServer + "/buddyicons/" + userid + ".jpg";
                               }
                               else
                               {
                                   iconUrl = "http://www.flickr.com/images/buddyicon.jpg";
                               }

                               if (notificationDispatcher != null && notificationEvent != null)
                               {
                                   notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                      notificationEvent,
                                                                      iconUrl);
                               }
                           }
                           );
        }
示例#4
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);
                                   }
                               }
                           }
                           );
        }
示例#5
0
        /// <summary>
        /// Asynchronously gets the most recently updated photos for a given user
        /// </summary>
        /// <param name="user"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchGetRecentlyUpdated(AuthorizedFlickrUser user,
                                                    Dispatcher notificationDispatcher,
                                                    FlickrWorkCompleteDelegate notificationEvent)
        {
            {
                AddToWorkQueue(delegate()
                               {
                                   FlickrPhotos photos = GetRecentlyUpdated(user);

                                   if (notificationDispatcher != null && notificationEvent != null)
                                   {
                                       notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                          notificationEvent,
                                                                          photos);
                                   }
                               }
                               );
            }
        }
示例#6
0
        /// <summary>
        /// Asynchronously gets the location for the given photo.
        /// </summary>
        /// <param name="photo"></param>
        /// <param name="notificationDispatcher"></param>
        /// <param name="notificationEvent"></param>
        public static void AsynchGetPhotoLocation(FlickrPhoto photo,
                                                  Dispatcher notificationDispatcher,
                                                  FlickrWorkCompleteDelegate notificationEvent)
        {
            AddToWorkQueue(delegate()
                           {
                               string location = GetPhotoLocation(photo);
                               photo.Location = location;

                               if (notificationDispatcher != null && notificationEvent != null)
                               {
                                   notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                                      notificationEvent,
                                                                      location);
                               }
                           }
                           );
        }
示例#7
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);
                                   }
                               }
                           }
                           );
        }
示例#8
0
 /// <summary>
 /// Asynchronously gets a frob 
 /// </summary>
 /// <param name="notificationDispatcher"></param>
 /// <param name="notificationEvent"></param>
 public static void AsynchGetFrob(Dispatcher notificationDispatcher,
                                  FlickrWorkCompleteDelegate notificationEvent)
 {
     AddToWorkQueue(delegate()
         {
             string frob = GetFrob();
             if (notificationDispatcher != null && notificationEvent != null)
             {
                 notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                    notificationEvent,
                                                    frob);
             }
         }
         );
 }
示例#9
0
 /// <summary>
 /// Asynchronously gets an authenticated user
 /// </summary>
 /// <param name="frob"></param>
 /// <param name="notificationDispatcher"></param>
 /// <param name="notificationEvent"></param>
 public static void AsynchGetAuthenticatedUser(string frob,
                                               Dispatcher notificationDispatcher,
                                               FlickrWorkCompleteDelegate notificationEvent)
 {
     AddToWorkQueue(delegate()
         {
             AuthorizedFlickrUser user = GetAuthorizationInfo(frob);
             if (notificationDispatcher != null && notificationEvent != null)
             {
                 notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle,
                                                    notificationEvent,
                                                    user);
             }
         }
         );
 }