本文整理汇总了C#中FlickrNet.PhotoSearchOptions类的典型用法代码示例。如果您正苦于以下问题:C# PhotoSearchOptions类的具体用法?C# PhotoSearchOptions怎么用?C# PhotoSearchOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhotoSearchOptions类属于FlickrNet命名空间,在下文中一共展示了PhotoSearchOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetImages
public IEnumerable<FlickrImage> GetImages(string tags)
{
Flickr.CacheDisabled = true;
var flickr = new Flickr("340b341adedd9b2613d5c447c4541e0f");
flickr.InstanceCacheDisabled = true;
var options = new PhotoSearchOptions { Tags = tags, PerPage = 2 };
var photos = flickr.PhotosSearch(options);
return photos.Select(i =>
{
using (var client = new WebClient())
{
var data = client.DownloadData(i.Medium640Url);
using (var memoryStream = new MemoryStream(data))
{
var bitmap = new Bitmap(memoryStream);
return new FlickrImage
{
Url = i.Medium640Url,
Image = new Bitmap(bitmap),
Encoded = Convert.ToBase64String(memoryStream.ToArray())
};
}
}
});
}
开发者ID:pebblecode,项目名称:raci,代码行数:25,代码来源:FlickrImageService.cs
示例2: PhotosGeoPhotosForLocationBasicTest
public void PhotosGeoPhotosForLocationBasicTest()
{
var o = new PhotoSearchOptions
{
UserId = Data.UserId,
HasGeo = true,
PerPage = 1,
Extras = PhotoSearchExtras.Geo
};
var photos = AuthInstance.PhotosSearch(o);
var photo = photos[0];
var photos2 = AuthInstance.PhotosGeoPhotosForLocation(photo.Latitude, photo.Longitude, photo.Accuracy, PhotoSearchExtras.All, 0, 0);
Assert.IsNotNull(photos2, "PhotosGeoPhotosForLocation should not return null.");
Assert.IsTrue(photos2.Count > 0, "Should return one or more photos.");
foreach (var p in photos2)
{
Assert.IsNotNull(p.PhotoId);
Assert.AreNotEqual(0, p.Longitude);
Assert.AreNotEqual(0, p.Latitude);
}
}
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:25,代码来源:PhotosGeoTests.cs
示例3: Evaluate
public void Evaluate(int spreadMax)
{
FChanged = false;
if (FUserIdInput.IsChanged || FTagsInput.IsChanged || FTagsInput.IsChanged || FPerPageInput.IsChanged)
{
FPhotoSearchOptions.Clear();
for (int i = 0; i < spreadMax; i++)
{
PhotoSearchOptions options = new PhotoSearchOptions();
string userId = FUserIdInput[i];
if(!string.IsNullOrEmpty(userId)) options.UserId = userId;
if(!string.IsNullOrEmpty(FTagsInput[i]))
{
options.Tags = FTagsInput[i];
}
options.PerPage = FPerPageInput[i];
options.TagMode = FTagModeInput[i];
FPhotoSearchOptions.Add(options);
}
FChanged = true;
}
FPhotoSearchOptionsOutput.AssignFrom(FPhotoSearchOptions);
FOptionsChangedOutput[0] = FChanged;
}
开发者ID:smakhtin,项目名称:FFFFlickr,代码行数:32,代码来源:PhotoSearchOptionsNode.cs
示例4: SearchButton_Click
private void SearchButton_Click(object sender, RoutedEventArgs e)
{
Flickr f = FlickrManager.GetAuthInstance();
PhotoSearchOptions options = new PhotoSearchOptions();
options.Tags = SearchTextBox.Text;
options.Extras = PhotoSearchExtras.LargeSquareUrl;
f.PhotosSearchAsync(options, r =>
{
if (r.Error != null)
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("An error occurred talking to Flickr: " + r.Error.Message);
});
return;
}
PhotoCollection photos = r.Result;
Dispatcher.BeginInvoke(() =>
{
ResultsListBox.ItemsSource = photos;
});
});
}
开发者ID:JaswanthDatt,项目名称:flickrnet-samples,代码行数:27,代码来源:Search.xaml.cs
示例5: ShowPic
public void ShowPic()
{
if (CheckNetwork() == true)
{
MessageBox.Show("A network connection can not be established.\r\nPlease press refresh or check your network settings.");
return;
}
else
{
picList.ItemsSource = "";
try
{
//to use Flickr go to Project-> Manage NuGet Packages-> Search "Flickr" -> install for windows phone 7
Flickr flickr = new Flickr("9a03824af501c318fec232146c6b1d05", "cd5cbd132cfbc60c"); // Authorise by api key and secret
PhotoSearchOptions options = new PhotoSearchOptions();
options.Tags = App.selectedCountryDetails.CountryCapital.ToString(); //give a key word to search
flickr.PhotosSearchAsync(options, (pictures) =>
{
picList.Dispatcher.BeginInvoke(new Action(delegate()
{
picList.ItemsSource = pictures.Result; //binding source to listbox
}));
});
}
catch (Exception e)
{
MessageBox.Show("An error occured. Please exit app and try again.\r\nError Details: " + e.Message.ToString());
}
}
}
开发者ID:Chengxuan,项目名称:BThere,代码行数:34,代码来源:FImages.xaml.cs
示例6: GetPhotos
public List<string[]> GetPhotos( string apiKey, string tags )
{
FlickrNet.Flickr.CacheDisabled = true;
FlickrNet.Flickr flickr = new FlickrNet.Flickr( apiKey );
FlickrNet.PhotoSearchOptions options = new FlickrNet.PhotoSearchOptions();
options.Tags = tags;
options.Extras = FlickrNet.PhotoSearchExtras.All;
options.PerPage = 343;
options.Text = tags;
options.TagMode = FlickrNet.TagMode.AllTags;
List<string[]> photos = new List<string[]>();
foreach ( FlickrNet.Photo photo in flickr.PhotosSearch( options ).PhotoCollection )
{
photos.Add( new string[] {
photo.MediumUrl,
photo.WebUrl,
photo.Title,
System.Xml.XmlConvert.ToString( photo.DateTaken, System.Xml.XmlDateTimeSerializationMode.Utc ),
photo.OwnerName,
photo.Latitude.ToString(),
photo.Longitude.ToString() } );
// try { photos.Add( new Photo( photo, "{0}" ) ); }
// catch { }
}
return photos;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:30,代码来源:Flickr.cs
示例7: SearchDataFromFlickr
public async void SearchDataFromFlickr(string query)
{
ImagesUrls = new ObservableCollection<ThumbnailImage>();
var o = new PhotoSearchOptions { Tags = query, Extras = PhotoSearchExtras.All };
var results = await FlickrBase.Instance.PhotosSearchAsync(o);
handleResults(results, ImagesUrls);
}
开发者ID:mmohareb,项目名称:SimpleFlickrClient,代码行数:7,代码来源:MainViewModel.cs
示例8: ShouldReturnSimpleSearchResultsAsync
public async void ShouldReturnSimpleSearchResultsAsync()
{
var o = new PhotoSearchOptions { Tags = "colorful" };
var photos = await Instance.PhotosSearchAsync(o);
Assert.IsNotNull(photos, "Photos should not be null");
Assert.IsNotEmpty(photos, "Photos should not be empty");
}
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:8,代码来源:PhotosSearchTests.cs
示例9: 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
示例10: ExcessiveTagsShouldNotThrowUriFormatException
public void ExcessiveTagsShouldNotThrowUriFormatException()
{
var list = Enumerable.Range(1, 9000).Select(i => "reallybigtag" + i).ToList();
var options = new PhotoSearchOptions{
Tags = string.Join(",", list)
};
var photos = Instance.PhotosSearch(options);
}
开发者ID:ericleigh007,项目名称:flickr-net,代码行数:9,代码来源:PhotosSearchTests.cs
示例11: PhotosSearchAuthRussianCharacters
public void PhotosSearchAuthRussianCharacters()
{
PhotoSearchOptions o = new PhotoSearchOptions();
o.Tags = "снег";
var photos = AuthInstance.PhotosSearch(o);
Assert.AreNotEqual(0, photos.Count, "Search should return some results.");
}
开发者ID:ghostnguyen,项目名称:f503cd14-7a08-48cb-a2b6-d607c618743e,代码行数:9,代码来源:PhotosSearchTests.cs
示例12: ListPictures
public IList<PictureInfo> ListPictures(string SearchString, string EventTag)
{
var retVal = new List<PictureInfo>();
PhotoSearchOptions options = new PhotoSearchOptions() { Tags = SearchString, TagMode= TagMode.AllTags, SortOrder = PhotoSearchSortOrder.Relevance, Extras = PhotoSearchExtras.Tags };
retVal = (from a in _flickr.PhotosSearch(options) where a.Tags.Contains(EventTag) select new PictureInfo() { ID = a.PhotoId,
FullSizeURL = a.MediumUrl.RemoveProtocol(), ThumbnailURL = a.ThumbnailUrl.RemoveProtocol(),
Title = a.Title, URL = a.WebUrl.RemoveProtocol(), MediumURL = a.MediumUrl.RemoveProtocol() }).ToList();
return retVal;
}
开发者ID:jkuemerle,项目名称:DoorComp,代码行数:9,代码来源:FlickrSource.cs
示例13: GetPhoto
public void GetPhoto()
{
Auth auth = flickr.AuthCheckToken(AuthToken);
PhotoSearchOptions options = new PhotoSearchOptions();
options.UserId = "[email protected]"; // Your NSID
options.PerPage = 100; // 100 is the default anyway
FlickrNet.PhotoCollection photos = flickr.PhotosSearch(options);
doBackup(photos);
}
开发者ID:igmar,项目名称:HUSACCT,代码行数:10,代码来源:Backup.cs
示例14: GetImages
public IEnumerable<Image> GetImages(string tags)
{
// Well yeah, this should probably be somewhere else ;)
var options = new PhotoSearchOptions("[email protected]", tags);
var photos = new Flickr("abc92b454fb23ccc2e4615df6cf780fa").PhotosSearch(options);
return photos
.Select(p => new Image(p.Small320Url, p.Medium640Url, p.Title))
.OrderBy(r => r.Title);
}
开发者ID:JefClaes,项目名称:kristienbehets-portfolio,代码行数:10,代码来源:FlickrImageProvider.cs
示例15: button1_Click
private void button1_Click(object sender, EventArgs e)
{
Flickr f = FlickrManager.GetInstance();
PhotoSearchOptions o = new PhotoSearchOptions();
o.Extras = PhotoSearchExtras.AllUrls | PhotoSearchExtras.Description | PhotoSearchExtras.OwnerName;
o.SortOrder = PhotoSearchSortOrder.Relevance;
o.Tags = textBox1.Text;
bindingSource1.DataSource = f.PhotosSearch(o);
}
开发者ID:JaswanthDatt,项目名称:flickrnet-samples,代码行数:11,代码来源:PhotoSearchForm.cs
示例16: PartialSearchOptions
internal PartialSearchOptions(PhotoSearchOptions options)
{
Extras = options.Extras;
MaxTakenDate = options.MaxTakenDate;
MinTakenDate = options.MinTakenDate;
MaxUploadDate = options.MaxUploadDate;
MinUploadDate = options.MinUploadDate;
Page = options.Page;
PerPage = options.PerPage;
PrivacyFilter = options.PrivacyFilter;
}
开发者ID:ericleigh007,项目名称:flickr-net,代码行数:11,代码来源:PartialSearchOptions.cs
示例17: GetPhotoSearchOptions
private PhotoSearchOptions GetPhotoSearchOptions()
{
PhotoSearchOptions options = new PhotoSearchOptions();
options.PerPage = 12;
options.SortOrder = PhotoSearchSortOrder.DatePostedDescending;
options.MediaType = MediaType.Photos;
options.Extras = PhotoSearchExtras.All;
options.UserId = userID;
return options;
}
开发者ID:lauraemilyjacobsen,项目名称:HikeBlog,代码行数:11,代码来源:PhotoController.cs
示例18: PhotoSearchExtrasViews
public void PhotoSearchExtrasViews()
{
var o = new PhotoSearchOptions {Tags = "kittens", Extras = PhotoSearchExtras.Views};
var photos = Instance.PhotosSearch(o);
foreach (var photo in photos)
{
Assert.IsTrue(photo.Views.HasValue);
}
}
开发者ID:ericleigh007,项目名称:flickr-net,代码行数:11,代码来源:PhotoSearchOptionsTests.cs
示例19: search_Click
private void search_Click(object sender, EventArgs e)
{
string str = text.Text;
if (str != "")
{
PhotoSearchOptions opt = new PhotoSearchOptions(null, null, FlickrNet.TagMode.AnyTag, str);
result = flickr.PhotosSearch(opt);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
name = str;
}
}
开发者ID:hoangtuhatde,项目名称:api,代码行数:11,代码来源:searchForm.cs
示例20: PhotosSearchOwnerNameTest
public void PhotosSearchOwnerNameTest()
{
PhotoSearchOptions o = new PhotoSearchOptions();
o.UserId = Data.UserId;
o.PerPage = 10;
o.Extras = PhotoSearchExtras.OwnerName;
PhotoCollection photos = Instance.PhotosSearch(o);
Assert.IsNotNull(photos[0].OwnerName);
}
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:12,代码来源:PhotoOwnerNameTest.cs
注:本文中的FlickrNet.PhotoSearchOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论