本文整理汇总了C#中FlickrNet.Flickr.PeopleFindByUserName方法的典型用法代码示例。如果您正苦于以下问题:C# Flickr.PeopleFindByUserName方法的具体用法?C# Flickr.PeopleFindByUserName怎么用?C# Flickr.PeopleFindByUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlickrNet.Flickr
的用法示例。
在下文中一共展示了Flickr.PeopleFindByUserName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUserInfo
public static FoundUser GetUserInfo(string userName)
{
Flickr flickr = new Flickr(ConfigurationManager.AppSettings["apiKey"],
ConfigurationManager.AppSettings["sharedSecret"]);
return flickr.PeopleFindByUserName(userName);
}
示例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
}
}
示例3: MainPage
public MainPage()
{
key1 = "plzzzzzzzzzzzzzzzzzzzzzz enter ur key here";
Windows.Storage.ApplicationDataContainer localSettings =
Windows.Storage.ApplicationData.Current.LocalSettings;
if (localSettings.Values.ContainsKey("userName"))
{
username = localSettings.Values["userName"].ToString();
}
flickr = new Flickr(key1);
this.InitializeComponent();
try
{
obj = flickr.PeopleFindByUserName(username);
userid.Text =obj.UserId;
photos=flickr.PeopleGetPublicPhotos(obj.UserId);
userid.Text=" "+photos.PerPage;
userid.Text = flickr.UrlsGetUserPhotos(obj.UserId);
total = photos.Count;
if (total > 1)
{
userid.Text = photos.ElementAt(0).SmallUrl;
image1.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(image1.BaseUri,
photos.ElementAt(0).SmallUrl));
present = 0;
}
else userid.Text = "You Dont Have any Public Photos";
//userid.Text = k;
}
catch (Exception)
{
userid.Text = "Exception catched";
}
this.InitializeComponent();
}
示例4: simmiWorker_DoWork
// 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);
}
}
}
示例5: fetchPhotosFromSpecifcUser
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);
}
}