示例#1
0
        public void UrlsLookupUserTest1()
        {
            FoundUser user = AuthInstance.UrlsLookupUser("https://www.flickr.com/photos/samjudson");

            Assert.AreEqual("41888973@N00", user.UserId);
            Assert.AreEqual("Sam Judson", user.UserName);
        }
示例#2
0
        /// <summary>
        /// Finds the user id based upon username or email. Returns null if not found.
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public FoundUser FindUserId(string userName)
        {
            FoundUser user = null;

            try
            {
                user = Service.PeopleFindByUsername(userName);
            }
            catch (FlickrNet.FlickrApiException ex1)
            {
                int code = ex1.Code;

                if (code == 1)
                {
                    try
                    {
                        user = Service.PeopleFindByEmail(userName);
                    }
                    catch (FlickrNet.FlickrApiException ex2)
                    {
                        // Swallow and return null
                    }
                }
            }

            return(user);
        }
示例#3
0
        public void Authenticate(FlickrAuthentication authentication)
        {
            Flickr = authentication.Authenticate();
            User   = Flickr.PeopleFindByUserName("me");

            Authenticated = true;
        }
示例#4
0
        public FlickrClient(string apiKey, string sharedSecret, string token)
        {
            Flickr = new Flickr(apiKey, sharedSecret, token);

            User          = Flickr.PeopleFindByUserName("me");
            Authenticated = true;
        }
示例#5
0
        public void PeopleFindByEmail()
        {
            FoundUser user = AuthInstance.PeopleFindByEmail("*****@*****.**");

            Assert.AreEqual("41888973@N00", user.UserId);
            Assert.AreEqual("Sam Judson", user.UserName);
        }
示例#6
0
        public void PeopleFindByUsername()
        {
            FoundUser user = AuthInstance.PeopleFindByUserName("Sam Judson");

            Assert.AreEqual("Sam Judson", user.UserName);
            Assert.AreEqual("41888973@N00", user.UserId);
        }
        public void PeopleFindByEmail()
        {
            Flickr f = TestData.GetAuthInstance();

            FoundUser user = f.PeopleFindByEmail("*****@*****.**");

            Assert.AreEqual("41888973@N00", user.UserId);
            Assert.AreEqual("Sam Judson", user.UserName);
        }
示例#8
0
        public PhotoCollection GetPhotoCollectionByName(string name)
        {
            FoundUser user = Flickr.PeopleFindByUserName(name);

            FlickrNet.PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions();
            options.UserId  = user.UserId;
            options.PerPage = 20;
            options.Page    = 1;

            return(Flickr.PhotosSearch(options));
        }
示例#9
0
        // A region for simmiWorker
        #region
        // This method takes care of the process heavy stuff. It can report progress and I will use that
        // to load each image.
        private void simmiWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            Console.WriteLine("Async backgroundworker started");

            if ((worker.CancellationPending == true))
            {
                Console.WriteLine("if");
                e.Cancel = true;
                // breaks out of the loop, if there is a loop.
                // break;
            }
            else
            {
                Flickr    flickr = new Flickr("59c64644ddddc2a52a089131c8ca0933", "b080535e26aa05df");
                FoundUser user   = flickr.PeopleFindByUserName("simmisj");
                //FoundUser user = flickr.PeopleFindByUserName("simmisj");

                //PeoplePhotoCollection people = new PeoplePhotoCollection();

                //people = flickr.PeopleGetPhotosOf(user.UserId);

                PhotoSearchOptions options = new PhotoSearchOptions();
                options.UserId  = user.UserId; // Your NSID
                options.PerPage = 4;           // 100 is the default anyway
                PhotoCollection photos;

                try
                {
                    photos      = flickr.PhotosSearch(options);
                    photos.Page = 1;
                }
                catch (Exception ea)
                {
                    //e.Result = "Exception: " + ea;
                    return;
                }

                for (int i = 0; i < photos.Count; i++)
                {
                    // Report progress and pass the picture to the progresschanged method
                    // for the progresschanged method to update the observablecollection.
                    worker.ReportProgress(100, photos[i].Medium640Url);
                    //pictures.Add(photos[i].Medium640Url);

                    // Add the picture to the ObservableCollection.
                    //pictures.Add(photos[i].Medium640Url);
                    //scatterView1.Items.Add(photos[i].ThumbnailUrl);
                }
            }
        }
示例#10
0
        // Region fetching photos from Flickr from a specific account.
        #region
        public void fetchPhotosFromSpecifcUser(string userName)
        {
            Flickr flickr = new Flickr("59c64644ddddc2a52a089131c8ca0933", "b080535e26aa05df");

            FoundUser user = flickr.PeopleFindByUserName(userName);

            //PeoplePhotoCollection people = new PeoplePhotoCollection();

            //people = flickr.PeopleGetPhotosOf(user.UserId);

            PhotoSearchOptions options = new PhotoSearchOptions();

            options.UserId  = user.UserId; // Your NSID
            options.PerPage = 4;           // 100 is the default anyway
            PhotoCollection photos = flickr.PhotosSearch(options);

            try
            {
                photos      = flickr.PhotosSearch(options);
                photos.Page = 1;
            }
            catch (Exception ea)
            {
                //e.Result = "Exception: " + ea;
                return;
            }

            for (int i = 0; i < photos.Count; i++)
            {
                // Report progress and pass the picture to the progresschanged method
                // for the progresschanged method to update the observablecollection.
                pictures.Add(photos[i].Medium640Url);

                // Add the picture to the ObservableCollection.
                //pictures.Add(photos[i].Medium640Url);
                //scatterView1.Items.Add(photos[i].ThumbnailUrl);
            }
        }
 protected void OnOpenUserProfile(FoundUser foundUser)
 {
     WaitOverlayProvider.ShowWaitOverlay();
     EditUserId = foundUser;
     MyRegionManager.NavigateUsingViewModel <FoundUserProfileViewModel>(RegionNames.UsermanagementContentRegion);
 }