当前位置: 首页>>代码示例>>C#>>正文


C# Flickr.FavoritesGetPublicList方法代码示例

本文整理汇总了C#中FlickrNet.Flickr.FavoritesGetPublicList方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.FavoritesGetPublicList方法的具体用法?C# Flickr.FavoritesGetPublicList怎么用?C# Flickr.FavoritesGetPublicList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlickrNet.Flickr的用法示例。


在下文中一共展示了Flickr.FavoritesGetPublicList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        public List<Photo> Read(int page = 1)
        {
            var photos = new List<Photo>();
            var flickr = new FlickrNet.Flickr(_apiToken, _secretKey);
            
            PhotoCollection col = flickr.FavoritesGetPublicList(_userid, DateTime.Now.AddYears(-10), DateTime.Now,
                                                                PhotoSearchExtras.All, page, _perPage);

            foreach (FlickrNet.Photo item in col)
            {
                var author = new Author
                    {
                        Name = item.OwnerName,
                        ID = item.UserId,
                        URL = string.Format("https://www.flickr.com/photos/{0}/", item.UserId)
                    };
                photos.Add(new Photo
                    {
                        Title = item.Title,
                        URL = item.WebUrl,
                        Path = item.DoesLargeExist ? item.LargeUrl : item.MediumUrl,
                        PublishedDate = item.DateTaken,
                        Author = author
                    });
            }
            return photos;
        }
开发者ID:sthakuri,项目名称:PhotosFlickrFav,代码行数:27,代码来源:Flickr.cs

示例2: FindUserButton_Click

        private void FindUserButton_Click(object sender, EventArgs e)
        {
            // First page of the users photos
            // Sorted by interestingness

            Flickr flickr = new Flickr(ApiKey.Text);
            FoundUser user;
            try
            {
                user = flickr.PeopleFindByUserName(Username.Text);
                OutputTextbox.Text = "User Id = " + user.UserId + "\r\n" + "Username = " + user.UserName + "\r\n";
            }
            catch (FlickrException ex)
            {
                OutputTextbox.Text = ex.Message;
                return;
            }

            PhotoSearchOptions userSearch = new PhotoSearchOptions();
            userSearch.UserId = user.UserId;
            userSearch.SortOrder = PhotoSearchSortOrder.InterestingnessDescending;
            PhotoCollection usersPhotos = flickr.PhotosSearch(userSearch);
            // Get users contacts
            ContactCollection contacts = flickr.ContactsGetPublicList(user.UserId);
            // Get first page of a users favorites
            PhotoCollection usersFavoritePhotos = flickr.FavoritesGetPublicList(user.UserId);
            // Get a list of the users groups
            //PublicGroupInfoCollection usersGroups = flickr.PeopleGetPublicGroups(user.UserId);

            int i = 0;
            foreach (Contact contact in contacts)
            {
                OutputTextbox.Text += "Contact " + contact.UserName + "\r\n";
                if (i++ > 10) break; // only list the first 10
            }

            i = 0;
            //foreach (PublicGroupInfo group in usersGroups)
            //{
            //    OutputTextbox.Text += "Group " + group.GroupName + "\r\n";
            //    if (i++ > 10) break; // only list the first 10
            //}

            i = 0;
            foreach (Photo photo in usersPhotos)
            {
                OutputTextbox.Text += "Interesting photo title is " + photo.Title + " " + photo.WebUrl + "\r\n";
                if (i++ > 10) break; // only list the first 10
            }

            i = 0;
            foreach (Photo photo in usersFavoritePhotos)
            {
                OutputTextbox.Text += "Favourite photo title is " + photo.Title + " " + photo.WebUrl + "\r\n";
                if (i++ > 10) break; // only list the first 10
            }
        }
开发者ID:kenpower,项目名称:flickdownloader,代码行数:57,代码来源:ExampleForm1.cs


注:本文中的FlickrNet.Flickr.FavoritesGetPublicList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。