예제 #1
0
        public async Task NotifyPropertyChangedTest()
        {
            var id     = "TPv9dh822VA";
            var client = new UnsplasharpClient(Credentials.ApplicationId);
            var photo  = await client.GetPhoto(id);

            photo.Downloads = 20000;
        }
예제 #2
0
        public async Task GetPhotoTest()
        {
            //var id = "TPv9dh822VA";
            var id     = "qcs09SwNPHY";
            var client = new UnsplasharpClient(Credentials.ApplicationId);
            var photo  = await client.GetPhoto(id);

            // Custom size
            var photoWidth = await client.GetPhoto(id, width : 400);

            var photoWidthHeight = await client.GetPhoto(id, width : 500, height : 500);

            // Custom size + cropped
            var photoCropped = await client.GetPhoto(id, 600, 600, 10, 10, 100, 100);

            Assert.IsNotNull(photo);
            Assert.IsNotNull(photoWidth);
            Assert.IsNotNull(photoWidthHeight);
            Assert.IsNotNull(photoCropped);

            Assert.IsNotNull(photoWidth.Urls.Custom);
            Assert.IsNotNull(photoWidthHeight.Urls.Custom);
            Assert.IsNotNull(photoCropped.Urls.Custom);
        }
예제 #3
0
        public async Task <List <InstaBot.Models.Photo> > SearchNewPhotosAsync(string stockCategoryName, int photoCount, List <string> downloadedPhotos)
        {
            List <InstaBot.Models.Photo> photoList = new List <InstaBot.Models.Photo>();
            int page = ApiConstans.PHOTO_SEARCH_DEFAULT_PAGE;

            while (photoList.Count == 0)
            {
                photoList = await this.SearchPhotosAsync(stockCategoryName, page);

                photoList.RemoveAll(p => downloadedPhotos.Contains(p.Id));
                page++;
            }

            photoList = photoList.Take(photoCount).ToList();
            for (int i = 0; i < photoList.Count; i++)
            {
                //for missing information
                photoList[i] = (await stockClient.GetPhoto(photoList[i].Id)).ToPhoto();
            }

            return(photoList);
        }
예제 #4
0
 private async Task <Photo> GetPhoto(string id)
 {
     return(await _client.GetPhoto(id));
 }