I expect that you already have an AccountKey, so I will not say that you need to get it.
Implementation
- First of all, add BingSearchContainer.cs to your project
- Implement C # sample code found in Quick Launch and Bing API Code
- Then right-click Links and select Manage NuGet Packages ... and search and install
Microsoft.Data.Services.Client.WindowsP . Modify the sample code to work with Windows Phone:
using Bing; using System; using System.Data.Services.Client; using System.Linq; using System.Net; namespace StackOverflow.Samples.BingSearch { public class Finder { public void FindImageUrlsFor(string searchQuery) {
Example
And now, let me use the code that I have provided you:
using Bing; using System; using System.Data.Services.Client; using System.Linq; using System.Net; namespace StackOverflow.Samples.BingSearch { public class MyPage { private void Button_Click_1(object sender, RoutedEventArgs e) { var finder = new Finder(); finder.FindImageUrlsForCompleted += finder_FindImageUrlsForCompleted; finder.FindImageUrlsFor("candy"); } void finder_FindImageUrlsForCompleted(object sender, List<string> result) { Deployment.Current.Dispatcher.BeginInvoke(() => { foreach (var s in result) MyTextBox.Text += s + "\n"; }); } } }
source share