コード例 #1
0
ファイル: Tumblr10.cs プロジェクト: ikivanc/Firarperest
        //Azure Mobile App which will be not used in this version of GitHub Project
        //private IMobileServiceTable<Photoset> photosetTable = App.MobileService.GetTable<Photoset>();
        //public async Task<List<Photoset>> getAllPhotosAMS()
        //{
        //    List<Photoset> pList = await photosetTable.Where(a => a.Country != null).ToListAsync();
        //    return pList;
        //}
        //public async Task<ObservableCollection<PhotosetList>> getByCountryGrouped()

        public ObservableCollection <PhotosetList> getByCountryGrouped()
        {
            ObservableCollection <PhotosetList> result = new ObservableCollection <PhotosetList>();

            try
            {
                //Azure mobile apps query
                //var query = from photo in await photosetTable.Where(a => a.Country != null).ToListAsync()

                var query = from photo in getAllPhotos().Where(a => a.Country != null)
                            group photo by photo.Country into g
                            orderby g.Key
                            select new { GroupName = g.Key, Items = g };

                foreach (var g in query)
                {
                    PhotosetList info = new PhotosetList();
                    info.Key = g.GroupName;
                    foreach (var item in g.Items)
                    {
                        info.Add(item);
                    }
                    result.Add(info);
                }

                return(result);
            }
            catch
            {
                return(result);
            }
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: dmcclimans/FlickrDL
        private void BGFindPhotosets(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            FlickrNet.Flickr f = FlickrManager.GetFlickrAuthInstance();
            if (f == null)
            {
                BGErrorMessage = "You must authenticate before you can download data from Flickr.";
                return;
            }

            try
            {
                int page    = 1;
                int perPage = 500;
                FlickrNet.PhotosetCollection photoSets      = new FlickrNet.PhotosetCollection();
                FlickrNet.PhotoSearchExtras  PhotosetExtras = 0;
                do
                {
                    photoSets = f.PhotosetsGetList(SearchAccountUser.UserId, page, perPage, PhotosetExtras);
                    foreach (FlickrNet.Photoset ps in photoSets)
                    {
                        PhotosetList.Add(new Photoset(ps));
                        int index = PhotosetList.Count - 1;
                        PhotosetList[index].OriginalSortOrder = index;
                    }
                    page = photoSets.Page + 1;
                }while (page <= photoSets.Pages);
            }
            catch (FlickrNet.FlickrException ex)
            {
                BGErrorMessage = "Album search failed. Error: " + ex.Message;
                return;
            }
        }
コード例 #3
0
        //Lists of albums with corresponding img urls. This is a cache.

        public FlickrRepository(IConfiguration config)
        {
            _config = config;
            albums  = Api_GetAlbums();
        }