private void BuildTree(Collection coll, int depth, PhotosetCollectionModel parent)
        {
            var cur = new PhotosetCollectionModel(coll.CollectionId, coll.Title, coll.Description);

            parent.Items.Add(cur);
            var spaces = new string(' ', depth *2);

            Debug.WriteLine($"{spaces}Collection: {coll.Title}");
            foreach (var subT in coll.Collections)
            {
                BuildTree(subT, depth + 1, cur);
            }
            //var f = _flickr;
            //var result = f.PhotosSearch(new PhotoSearchOptions("147869897@N08") {Text = "Aqua"});
            //f.PhotosetsAddPhoto(setId, photoId);

            foreach (var set in coll.Sets)
            {
                _subPhotosets.Add(set.SetId);

                var s = new Photoset {
                    PhotosetId = set.SetId, Title = set.Title, Description = set.Description
                };
                //too slow calling this for each set - using background task instead
                //f.PhotosetsGetInfo(set.SetId);

                AddPhotoset(s, cur);
                Debug.WriteLine($"{spaces}  Set: {set.Title} ({set.SetId})");
            }
        }
        public DetailPage()
        {
            InitializeComponent();

            selectedImage = (Application.Current as App).selectedPhotoset;

            //detailStack.DataContext = selectedImage;
            detailStack.BindingContext = selectedImage;

            //MapIcon mapIcon1 = new MapIcon();

            //BasicGeoposition a = new BasicGeoposition();

            //a.Longitude = selectedImage.Longitude;

            //a.Latitude = selectedImage.Latitude;

            //mapIcon1.Location = new Geopoint(a);

            //mapIcon1.NormalizedAnchorPoint = new Point(0.3, 0.3);

            //mapDetail.Center = new Geopoint(a);

            ////mapIcon1.Title = selectedImage.City;

            //mapIcon1.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png"));

            //mapIcon1.ZIndex = 0;

            //mapDetail.MapElements.Add(mapIcon1);
        }
Beispiel #3
0
        private void SynchronizeExistingDirectory(Photoset set, string directory)
        {
            var localFiles = Directory.GetFiles(directory).FilterPhotos();
            var photos     = FlickrInstance.PhotosetsGetPhotos(set.PhotosetId);

            for (int i = 2; i <= Math.Ceiling((double)photos.Total / Constants.MaxPerPage); i++)
            {
                var ph = FlickrInstance.PhotosetsGetPhotos(set.PhotosetId, PhotoSearchExtras.All,
                                                           PrivacyFilter.None, i,
                                                           Constants.MaxPerPage);
                foreach (var p in ph)
                {
                    photos.Add(p);
                }
            }
            foreach (var file in localFiles)
            {
                if (photos.FirstOrDefault(p => p.Title == Path.GetFileNameWithoutExtension(file)) == null)
                {
                    var task = new UploadTask(file, set.PhotosetId, set.Title);
                    PhotoTasks.Add(task);
                }
            }
            foreach (var photo in photos)
            {
                if (localFiles.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f) == photo.Title) == null)
                {
                    var task = new DownloadTask(photo.PhotoId, directory, set.Title);
                    PhotoTasks.Add(task);
                }
            }
        }
Beispiel #4
0
        //private async void PageOnMap_Loaded(object sender, RoutedEventArgs e)
        private void PageOnMap_Loaded(object sender, RoutedEventArgs e)
        {
            Photoset ps = new Photoset();
            //List<Photoset> pList = await ps.getAllPhotosAMS();

            List <Photoset> pList = ps.getAllPhotos();

            preloader.Visibility = Visibility.Collapsed;

            foreach (Photoset p in pList)
            {
                MapIcon mapIcon1 = new MapIcon();

                BasicGeoposition a = new BasicGeoposition();
                a.Longitude       = p.Longitude;
                a.Latitude        = p.Latitude;
                mapIcon1.Location = new Geopoint(a);
                mapIcon1.NormalizedAnchorPoint = new Point(0.3, 0.3);
                mapDetail.Center = new Geopoint(a);
                mapIcon1.Title   = p.City;
                mapIcon1.Image   = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png"));
                mapIcon1.ZIndex  = 0;
                mapDetail.MapElements.Add(mapIcon1);
                mapDetail.MapElementClick += MapDetail_MapElementClick;
            }
            //mapDetail.Center = new Geopoint(new BasicGeoposition { Latitude = pList.Average(a=>a.Latitude), Longitude = pList.Average(a => a.Longitude)});
            mapDetail.Center = new Geopoint(new BasicGeoposition {
                Latitude = 36.654317, Longitude = 30.871094
            });
            mapDetail.ZoomLevel = 3;
        }
        private void gridViewPhotos_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Photoset selectedPS = gridViewPhotos.SelectedItem as Photoset;

            (Application.Current as App).selectedPhotoset = selectedPS;
            this.Frame.Navigate(typeof(DetailPage));
        }
Beispiel #6
0
        public async Task UploadPhotosAsync(string albumName, IEnumerable <PhotoFile> photos, bool resize)
        {
            Photoset album = null;

            _ui.WritePropertyLine("Uploading ", photos.Count().ToString(), " files to Flickr...");
            foreach (var photo in photos)
            {
                // TODO: Check if resize == false
                _ui.WriteProperty($"Uploading {photo.Name}...");
                _photoProcessor.ResizePhotoForUpload(photo, out Stream stream);

                var taskUpload = new TaskCompletionSource <string>();
                _flickr.UploadPictureAsync(stream, photo.Name, photo.Name,
                                           string.Empty, null, true, false, false, ContentType.None,
                                           SafetyLevel.None, HiddenFromSearch.None, (FlickrResult <string> flickrResult) => {
                    taskUpload.SetResult(flickrResult.Result);
                });
                var photoId = await taskUpload.Task;

                album = album ?? await GetOrAddAlbumAsync(albumName, photoId);

                var taskAddPhotoToAlbum = new TaskCompletionSource <NoResponse>();
                _flickr.PhotosetsAddPhotoAsync(album.PhotosetId, photoId, (FlickrResult <NoResponse> flickResult) => {
                    _ui.WritePropertyLine(string.Empty, "Done");
                    taskAddPhotoToAlbum.SetResult(flickResult.Result);
                });
                await taskAddPhotoToAlbum.Task;
            }
        }
Beispiel #7
0
 public FlickrSet(Photoset set)
 {
     SetID          = set.PhotosetId;
     Title          = set.Title;
     Description    = set.Description;
     PrimaryPhotoId = set.PrimaryPhotoId;
 }
        private DirectoryInfo CreateDownloadFolder(string downloadLocation, Photoset currentPhotoset, string folderPrefix)
        {
            if (string.IsNullOrWhiteSpace(folderPrefix))
            {
                _currentTimestampFolder = string.Format("flickr-downloadr{0}-{1}", GetDownloadFolderNameForPhotoset(currentPhotoset),
                                                        GetSafeFilename(DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")));

                var imageDirectory = Directory.CreateDirectory(Path.Combine(downloadLocation, _currentTimestampFolder));

                return(imageDirectory);
            }
            else
            {
                var albumRootDirectory = Directory.CreateDirectory(Path.Combine(downloadLocation, Path.Combine(downloadLocation, folderPrefix)));

                _currentTimestampFolder = albumRootDirectory.FullName;

                if (currentPhotoset.Type == PhotosetType.Album)
                {
                    return(Directory.CreateDirectory(Path.Combine(_currentTimestampFolder, GetSafeFilename(currentPhotoset.Title))));
                }

                return(albumRootDirectory);
            }
        }
Beispiel #9
0
        public void AddNewSets(ArrayList SetIds)
        {
            foreach (string SetId in SetIds)
            {
                Flickr.CacheDisabled = true;
                Photoset psi = ri.GetSet(SetId);
                Flickr.CacheDisabled = false;
                if (psi != null)
                {
                    Image img = ri.PhotosetThumbnail(psi);
                    imageListLarge.Images.Add(SetId, img);
                    imageListSmall.Images.Add(SetId, img.GetThumbnailImage(16, 16, null, IntPtr.Zero));

                    ListViewItem lvi = listSets.Items.Insert(0, SetId, psi.Title, SetId);
                    lvi.SubItems.Add(psi.NumberOfPhotos.ToString());
                    lvi.SubItems.Add(psi.Description);
                }
            }

            listSets.EnsureVisible(0);

            ri.Reload();
            CalcTooltips();
            UpdateStatusBar();
        }
        public async Task<PhotosResponse> GetPhotosAsync(Photoset photoset, User user, Preferences preferences, int page,
                                                         IProgress<ProgressUpdate> progress) {
            var progressUpdate = new ProgressUpdate {
                OperationText = "Getting list of photos...",
                ShowPercent = false
            };
            progress.Report(progressUpdate);

            var methodName = GetPhotosetMethodName(photoset.Type);

            var extraParams = new Dictionary<string, string> {
                {
                    ParameterNames.UserId, user.UserNsId
                }, {
                    ParameterNames.SafeSearch, preferences.SafetyLevel
                }, {
                    ParameterNames.PerPage,
                    preferences.PhotosPerPage.ToString(CultureInfo.InvariantCulture)
                }, {
                    ParameterNames.Page, page.ToString(CultureInfo.InvariantCulture)
                }
            };

            var isAlbum = photoset.Type == PhotosetType.Album;
            if (isAlbum) {
                extraParams.Add(ParameterNames.PhotosetId, photoset.Id);
            }

            var photosResponse = (Dictionary<string, object>)
                await this._oAuthManager.MakeAuthenticatedRequestAsync(methodName, extraParams);

            return photosResponse.GetPhotosResponseFromDictionary(isAlbum);
        }
        /// <summary>
        /// Retrieves a list of photo identifiers for a specific photoset
        /// </summary>
        /// <param name="flickrContext">The flickr context</param>
        /// <param name="photoSetId">The flickr photoset</param>
        /// <param name="verbose">Verbosity is enabled</param>
        /// <returns>list of image identifiers in photoset</returns>
        private static List <string> GetAllPhotoIDsFromSet(Flickr flickrContext, string photoSetId, bool verbose)
        {
            List <string> output = new List <string>();

            Photoset photoSetInfo   = GetPhotoSet(flickrContext, photoSetId);
            int      perPage        = 500;
            int      totalPageCount = photoSetInfo.Total / perPage + 1;

            for (int currentPage = 1; currentPage < totalPageCount + 1; currentPage++)
            {
                if (verbose == true)
                {
                    Console.WriteLine($"  Processing '{photoSetInfo.Title}' page {currentPage} of {totalPageCount}");
                }

                PhotosetPhotoCollection setPhotoPage = flickrContext.PhotosetsGetPhotos(photoSetId, currentPage, perPage);

                if (verbose == true)
                {
                    Console.WriteLine($"    Got {setPhotoPage.Count}");
                }

                foreach (var photo in setPhotoPage)
                {
                    output.Add(photo.PhotoId);
                }
            }

            if (verbose == true)
            {
                Console.WriteLine($"  Finished Processing '{photoSetInfo.Title}'");
            }

            return(output);
        }
Beispiel #12
0
 public Session(User user, Preferences preferences, Photoset photoset = null, int currentAlbumPageNumber = 1)
 {
     User                   = user;
     Preferences            = preferences;
     SelectedPhotoset       = photoset;
     CurrentAlbumPageNumber = currentAlbumPageNumber;
 }
Beispiel #13
0
        public void PhotosetsCreateAddPhotosTest()
        {
            Flickr f = TestData.GetAuthInstance();

            byte[] imageBytes = TestData.TestImageBytes;
            Stream s          = new MemoryStream(imageBytes);

            string title  = "Test Title";
            string title2 = "New Test Title";
            string desc   = "Test Description\nSecond Line";
            string desc2  = "New Test Description";
            string tags   = "testtag1,testtag2";

            s.Position = 0;
            // Upload photo once
            string photoId1 = f.UploadPicture(s, "Test.jpg", title, desc, tags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible);

            Console.WriteLine("Photo 1 created: " + photoId1);

            s.Position = 0;
            // Upload photo a second time
            string photoId2 = f.UploadPicture(s, "Test.jpg", title, desc, tags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible);

            Console.WriteLine("Photo 2 created: " + photoId2);

            // Creat photoset
            Photoset photoset = f.PhotosetsCreate("Test photoset", photoId1);

            Console.WriteLine("Photoset created: " + photoset.PhotosetId);

            try
            {
                // Add second photo to photoset.
                f.PhotosetsAddPhoto(photoset.PhotosetId, photoId2);

                // Remove second photo from photoset
                f.PhotosetsRemovePhoto(photoset.PhotosetId, photoId2);

                f.PhotosetsEditMeta(photoset.PhotosetId, title2, desc2);

                photoset = f.PhotosetsGetInfo(photoset.PhotosetId);

                Assert.AreEqual(title2, photoset.Title, "New Title should be set.");
                Assert.AreEqual(desc2, photoset.Description, "New description should be set");

                f.PhotosetsEditPhotos(photoset.PhotosetId, photoId1, new string[] { photoId2, photoId1 });

                f.PhotosetsRemovePhoto(photoset.PhotosetId, photoId2);
            }
            finally
            {
                // Delete photoset completely
                f.PhotosetsDelete(photoset.PhotosetId);

                // Delete both photos.
                f.PhotosDelete(photoId1);
                f.PhotosDelete(photoId2);
            }
        }
 public async void GetPublicPhotos_WillGetPublicPhotos() {
     WaitTillLoggedIn();
     var publicPhotos = new Photoset(null, null, null, null, 0, 0, 0, null, null, PhotosetType.Public, null);
     var photosResponse =
         await this._logic.GetPhotosAsync(publicPhotos, this._user, Preferences.GetDefault(), 1,
             new Progress<ProgressUpdate>());
     Assert.IsNotNull(photosResponse.Photos);
 }
Beispiel #15
0
        public PageByCountry()
        {
            InitializeComponent();

            Photoset ps = new Photoset();

            listviewPhotos.ItemsSource = ps.getByCountryGrouped();
        }
Beispiel #16
0
        public void PhotosetsGetInfoEncodingCorrect()
        {
            Flickr f = TestData.GetInstance();

            Photoset pset = f.PhotosetsGetInfo("72157627650627399");

            Assert.AreEqual("Sítio em Arujá - 14/08/2011", pset.Title);
        }
Beispiel #17
0
        public Home()
        {
            InitializeComponent();

            Photoset ps = new Photoset();

            listviewPhotos.ItemsSource = ps.getAllPhotos();
        }
        private async Task DownloadPhotos(IEnumerable<Photo> photos, CancellationToken cancellationToken, IProgress<ProgressUpdate> progress,
                                          Preferences preferences, Photoset photoset) {
            var progressUpdate = new ProgressUpdate {
                Cancellable = true,
                OperationText = "Downloading photos...",
                PercentDone = 0,
                ShowPercent = true
            };
            progress.Report(progressUpdate);

            var doneCount = 0;
            var photosList = photos as IList<Photo> ?? photos.ToList();
            var totalCount = photosList.Count();

            var imageDirectory = CreateDownloadFolder(preferences.DownloadLocation, photoset);

            foreach (var photo in photosList) {
                var photoUrl = photo.OriginalUrl;
                var photoExtension = "jpg";
                switch (preferences.DownloadSize) {
                    case PhotoDownloadSize.Medium:
                        photoUrl = photo.Medium800Url;
                        break;
                    case PhotoDownloadSize.Large:
                        photoUrl = photo.Large1024Url;
                        break;
                    case PhotoDownloadSize.Original:
                        photoUrl = photo.OriginalUrl;
                        photoExtension = photo.DownloadFormat;
                        break;
                }

                var photoWithPreferredTags = photo;

                if (preferences.NeedOriginalTags) {
                    photoWithPreferredTags = await this._originalTagsLogic.GetOriginalTagsTask(photo);
                }

                var photoName = preferences.TitleAsFilename ? GetSafeFilename(photo.Title) : photo.Id;
                var targetFileName = Path.Combine(imageDirectory.FullName,
                    string.Format("{0}.{1}", photoName, photoExtension));
                WriteMetaDataFile(photoWithPreferredTags, targetFileName, preferences);

                var request = WebRequest.Create(photoUrl);

                var buffer = new byte[4096];

                await DownloadAndSavePhoto(targetFileName, request, buffer);

                doneCount++;
                progressUpdate.PercentDone = doneCount * 100 / totalCount;
                progressUpdate.DownloadedPath = imageDirectory.FullName;
                progress.Report(progressUpdate);
                if (doneCount != totalCount) {
                    cancellationToken.ThrowIfCancellationRequested();
                }
            }
        }
Beispiel #19
0
        public static Album CreateAlbum(Photoset photoset)
        {
            var result = new Album(
                new AlbumId(photoset.PhotosetId),
                photoset.Title,
                new FlickrPhotoId(photoset.PrimaryPhotoId));

            return(result);
        }
        private DirectoryInfo CreateDownloadFolder(string downloadLocation, Photoset currentPhotoset)
        {
            this._currentTimestampFolder = string.Format("flickr-downloadr{0}-{1}", GetDownloadFolderNameForPhotoset(currentPhotoset),
                                                         GetSafeFilename(DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")));
            var imageDirectory =
                Directory.CreateDirectory(Path.Combine(downloadLocation, this._currentTimestampFolder));

            return(imageDirectory);
        }
        public async Task Download(IEnumerable<Photo> photos, CancellationToken cancellationToken, IProgress<ProgressUpdate> progress,
                                   Preferences preferences, Photoset photoset) {
            var photosList = photos as IList<Photo> ?? photos.ToList();
            if (!photosList.Any()) {
                return;
            }

            await this._downloadLogic.Download(photosList, cancellationToken, progress, preferences, photoset);
        }
Beispiel #22
0
        public void PhotosetsCreateAddPhotosTest()
        {
            byte[] imageBytes = TestData.TestImageBytes;
            var    s          = new MemoryStream(imageBytes);

            const string initialPhotoTitle       = "Test Title";
            const string updatedPhotoTitle       = "New Test Title";
            const string initialPhotoDescription = "Test Description\nSecond Line";
            const string updatedPhotoDescription = "New Test Description";
            const string initialTags             = "testtag1,testtag2";

            s.Position = 0;
            // Upload photo once
            var photoId1 = AuthInstance.UploadPicture(s, "Test1.jpg", initialPhotoTitle, initialPhotoDescription, initialTags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible);

            s.Position = 0;
            // Upload photo a second time
            var photoId2 = AuthInstance.UploadPicture(s, "Test2.jpg", initialPhotoTitle, initialPhotoDescription, initialTags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible);

            // Creat photoset
            Photoset photoset = AuthInstance.PhotosetsCreate("Test photoset", photoId1);

            try
            {
                var photos = AuthInstance.PhotosetsGetPhotos(photoset.PhotosetId, PhotoSearchExtras.OriginalFormat | PhotoSearchExtras.Media, PrivacyFilter.None, 1, 30, MediaType.None);

                photos.Count.ShouldBe(1, "Photoset should contain 1 photo");
                photos[0].IsPublic.ShouldBe(false, "Photo 1 should be private");

                // Add second photo to photoset.
                AuthInstance.PhotosetsAddPhoto(photoset.PhotosetId, photoId2);

                // Remove second photo from photoset
                AuthInstance.PhotosetsRemovePhoto(photoset.PhotosetId, photoId2);

                AuthInstance.PhotosetsEditMeta(photoset.PhotosetId, updatedPhotoTitle, updatedPhotoDescription);

                photoset = AuthInstance.PhotosetsGetInfo(photoset.PhotosetId);

                photoset.Title.ShouldBe(updatedPhotoTitle, "New Title should be set.");
                photoset.Description.ShouldBe(updatedPhotoDescription, "New description should be set");

                AuthInstance.PhotosetsEditPhotos(photoset.PhotosetId, photoId1, new[] { photoId2, photoId1 });

                AuthInstance.PhotosetsRemovePhoto(photoset.PhotosetId, photoId2);
            }
            finally
            {
                // Delete photoset completely
                AuthInstance.PhotosetsDelete(photoset.PhotosetId);

                // Delete both photos.
                AuthInstance.PhotosDelete(photoId1);
                AuthInstance.PhotosDelete(photoId2);
            }
        }
Beispiel #23
0
        public async Task GetPublicPhotos_WillGetPublicPhotos()
        {
            WaitTillLoggedIn();
            var publicPhotos   = new Photoset(null, null, null, null, 0, 0, 0, null, null, PhotosetType.Public, null);
            var photosResponse =
                await _logic.GetPhotosAsync(publicPhotos, _user, Preferences.GetDefault(), 1,
                                            new Progress <ProgressUpdate>());

            Assert.IsNotNull(photosResponse.Photos);
        }
Beispiel #24
0
        public Photoset ToPhotoset()
        {
            Photoset ps = new Photoset();

            ps.PhotosetId     = SetID;
            ps.Title          = Title;
            ps.Description    = Description;
            ps.PrimaryPhotoId = PrimaryPhotoId;
            return(ps);
        }
        private void AddPhotoset(Photoset set, PhotosetCollectionModel tree)
        {
            var m = new PhotosetModel(set.PhotosetId, set.Title, set.Description)
            {
                PhotosCount = set.NumberOfPhotos,
                VideosCount = set.NumberOfVideos
            };

            tree.Items.Add(m);
        }
        //private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            Photoset ps = new Photoset();

            //this.cvs1.Source = await ps.getByCountryGrouped();
            this.cvs1.Source     = ps.getByCountryGrouped();
            preloader.Visibility = Visibility.Collapsed;
        }
Beispiel #27
0
 public Image PhotosetThumbnail(Photoset ps)
 {
     try
     {
         return(Bitmap.FromStream(f.DownloadPicture(ps.PhotosetSquareThumbnailUrl)));
     }
     catch (Exception)
     {
         return(Properties.Resources.icon_replace);
     }
 }
Beispiel #28
0
 public Image PhotosetThumbnail(Photoset ps)
 {
     try
     {
         MemoryStream stream = new MemoryStream(webClient.DownloadData(ps.PhotosetSquareThumbnailUrl));
         return(Bitmap.FromStream(stream));
     }
     catch (Exception)
     {
         return(Properties.Resources.icon_replace);
     }
 }
Beispiel #29
0
 /// <summary>
 /// this method will retun the photoset title given its unique set ID
 /// </summary>
 /// <param name="setID">ID of the photo set in question</param>
 /// <returns>title of photoset</returns>
 public string GetPhotoSetTitle(string setID)
 {
     try
     {
         Photoset ps = flickr.PhotosetsGetInfo(setID);
         return(ps.Title);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
        public async Task Download(IEnumerable <Photo> photos, CancellationToken cancellationToken, IProgress <ProgressUpdate> progress,
                                   Preferences preferences, Photoset photoset)
        {
            var photosList = photos as IList <Photo> ?? photos.ToList();

            if (!photosList.Any())
            {
                return;
            }

            await _downloadLogic.Download(photosList, cancellationToken, progress, preferences, photoset);
        }
Beispiel #31
0
        /// <summary>
        /// paralelni pridani photos do set
        /// </summary>
        public async Task <List <AddPhotoToPhotosetResult> > ParallelAddPhotosToPhotoset(
            Photoset photoset,
            List <string> photoIds,
            Action <ParallelOperationDataWithInput <AddPhotoToPhotosetResult, string> > progressEvent = null,
            int taskCount = DefaultParallelConnections)
        {
            var result = await ParallelEngine(photoIds,
                                              (taskId, photoId) => AddPhotoToPhotosetAsync(photoset, photoId),
                                              progressEvent,
                                              taskCount);

            return(result);
        }
Beispiel #32
0
        private IEnumerable <FlickrNet.Photo> GetAllPhotosInAlbum(string albumId, Photoset photoSet)
        {
            var       allPhotosInAlbum    = new List <FlickrNet.Photo>();
            const int elementPerPageCount = 500;
            var       pageCount           = (int)Math.Ceiling((float)(photoSet.NumberOfPhotos + photoSet.NumberOfVideos) / elementPerPageCount);

            for (var pageNumber = 1; pageNumber <= pageCount; pageNumber++)
            {
                var photosPerPage = _flickr.PhotosetsGetPhotos(albumId, PhotoSearchExtras.None, PrivacyFilter.None, pageNumber, elementPerPageCount);
                allPhotosInAlbum.AddRange(photosPerPage);
            }
            return(allPhotosInAlbum);
        }
Beispiel #33
0
        public List <Photo> GetAllPhotos(Photoset set)
        {
            var photos     = FlickrInstance.PhotosetsGetPhotos(set.PhotosetId);
            var photosList = photos.ToList();

            for (int i = 2; i <= Math.Ceiling((double)photos.Total / Constants.MaxPerPage); i++)
            {
                photosList.AddRange(FlickrInstance.PhotosetsGetPhotos(set.PhotosetId, PhotoSearchExtras.All,
                                                                      PrivacyFilter.None, i,
                                                                      Constants.MaxPerPage));
            }
            return(photosList);
        }
Beispiel #34
0
        //  private IMobileServiceTable<Photoset> photosetTable = App.MobileService.GetTable<Photoset>();


        //private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            //Can Go back Feature
            //SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            Photoset ps = new Photoset();

            //gridViewPhotos.ItemsSource = await ps.getAllPhotosAMS();

            gridViewPhotos.ItemsSource = ps.getAllPhotos();
            preloader.Visibility       = Visibility.Collapsed;

            //Device Family spesific features
            InitializeUi();
        }
 private string GetDownloadFolderNameForPhotoset(Photoset photoset) {
     return photoset.Type == PhotosetType.Album ? string.Format("-[{0}]", GetSafeFilename(photoset.Title)) : string.Empty;
 }
 private DirectoryInfo CreateDownloadFolder(string downloadLocation, Photoset currentPhotoset) {
     this._currentTimestampFolder = string.Format("flickr-downloadr{0}-{1}", GetDownloadFolderNameForPhotoset(currentPhotoset),
         GetSafeFilename(DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")));
     var imageDirectory =
         Directory.CreateDirectory(Path.Combine(downloadLocation, this._currentTimestampFolder));
     return imageDirectory;
 }
 public async Task Download(IEnumerable<Photo> photos, CancellationToken cancellationToken, IProgress<ProgressUpdate> progress,
                            Preferences preferences, Photoset photoset) {
     await DownloadPhotos(photos, cancellationToken, progress, preferences, photoset);
 }