次の方法で共有


包括的な Windows フォーム アプリケーション (C#)

このサンプル アプリケーションでは、API を介して利用できるすべての機能を公開する対話形式の Windows フォーム アプリケーションを使用して、Live Search Web サービスに対するクエリの送信と検索結果の受信を行うことができます。以降に記載されているソース コードには、詳しいコメントが付けられており、要求を構成する方法および検索エンジンからの応答を処理する方法をわかりやすく示しています。このコードに変更を加えて使いやすいアプリケーションを作成したり、API に関する理解を深めるための学習ツールとしてこのコードを使用したりすることができます。

Microsoft Visual Studio .NET 2005 でプロジェクトをセットアップするには

  1. Microsoft Visual Studio .NET 2005 を開き、[ファイル] メニューの [新しいプロジェクト] をクリックします。[新しいプロジェクト] ダイアログ ボックスが表示されます。

  2. [プロジェクトの種類] ペインで、[Visual C#]、[Windows] を順に選択します。

  3. [テンプレート] ペインで、[Windows アプリケーション] を選択します。

  4. [名前] ボックスにプロジェクトの名前として「LiveSearchAPISample」と入力し、[OK] をクリックします。新規のプロジェクトが作成されます。

  5. ソリューション エクスプローラで、[参照設定] を右クリックし、ポップアップ メニューの [Web 参照の追加] を選択します。

  6. URL のボックスに「https://soap.search.msn.com/webservices.asmx?wsdl」と入力します。

  7. [移動] をクリックします。

  8. [Web 参照名] ボックスに「LiveSearch」と入力し、[参照の追加] をクリックします。

  9. フォームの名前を frmSearchSample.cs に変更します。[OK] をクリックして、すべての参照の名前を変更し、設定を保存します。

ソース コードをプロジェクトに追加するには

  1. 以下のようにして、ファイル frmSearchSample.Designer.cs 内のソース コードを「例 (その 1)」のソース コードと置き換えます。

    1. [コードのコピー] をクリックして、コードを Windows クリップボードに貼り付けます。
    2. ソリューション エクスプローラで frmSearchSample.cs を開き、ファイル内の任意の場所にカーソルを置いて、Ctrl + A キーを押します。
    3. Ctrl + V キーを押して、Visual Studio のソース ファイルにコードを貼り付け、テンプレートに基づいて生成されたコードを上書きします。
  2. 以下のようにして、ファイル frmSearchSample.Designer.cs 内のソース コードを「例 (その 2)」のソース コードと置き換えます。

    1. [コードのコピー] をクリックして、コードを Windows クリップボードに貼り付けます。
    2. ソリューション エクスプローラで frmSearchSample.Designer.cs を開き、ファイル内の任意の場所にカーソルを置いて、Ctrl + A キーを押します。
    3. Ctrl + V キーを押して、Visual Studio のソース ファイルにコードを貼り付け、テンプレートに基づいて生成されたコードを上書きします。
  3. テキスト YOUR_APP_ID_GOES_HERE を検索し、Developer Provisioning System で生成した AppID と置き換えます。

  4. F5 キーを押して、アプリケーションをデバッグ モードで実行します。

要件

  • Microsoft Visual Studio .NET 2005 または Microsoft Visual C# .NET 2005
  • インターネット接続
  • アプリケーション ID (Live Search Web サービスで使用する AppID を取得する方法については、「Live Search API の使い方」を参照してください)

デモンストレーション

Live Search Web サービス API の最新リリースでは、すべての機能が対話形式で実行されます。

例 (その 1)

コード

//このコードおよび情報は、「現状有姿」で提供され、
//明示または黙示を問わず、また、商品性および
//特定の目的に対する適合性を含むがそれに限定されず、一切の保証を
//伴わないものとします。
//
//Copyright (C) 2007  Microsoft Corporation.All rights reserved.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web.Services.Protocols;
using System.Net;
using LiveSearchAPISample.LiveSearch;

namespace LiveSearchAPISample
{
public partial class frmSearchSample :Form
    {
public frmSearchSample()
        {
InitializeComponent();
        }

public void executeQuery(bool nearMe)
        {
try
            {
// MSNSearchService オブジェクトを新規作成します。MSNSearchService は、
// サービスにアクセスするための最上位のプロキシ クラスです。MSNSearchService の同期メソッドは 1 つだけです。その唯一の同期メソッドである
// Search は、SearchRequest オブジェクトを 1 つだけ、引数として受け取ります。
// また、プロキシの生成に使用される SOAP ツールキットによっては、
// BeginSearch や EndSearch などの非同期検索メソッドも使用できる場合があります。
MSNSearchService s = new MSNSearchService();

// 検索要求を表す SearchRequest オブジェクトを新規作成します。それぞれの SearchRequest には
// 複数の SourceRequest オブジェクトを含めることができます。ただし、それぞれの SearchRequest に含めることができる
// SourceRequest は 1 つのタイプにつき 1 つだけです (このことについては後で詳しく説明します)。
SearchRequest searchRequest = new SearchRequest();

// サンプル アプリケーションでは、7 つの SourceRequest オブジェクトを使用します。SourceType.Web は、
// Web 検索結果を返します。また、Location オブジェクトが存在する場合には、Web-Local 検索結果を返します。
// SourceType.Spelling は、スペル候補を返します。
// SourceType.PhoneBook は、Location オブジェクトが存在する場合に、選択された言語の
// ホワイト ページおよびイエロー ページのエントリ、および地理情報を返します。
// SourceType.News は、ニュース記事を返します。SourceType.QueryLocation は、クエリに対するキーワードや地名を返します。
// たとえば、"pizza new york" や "pizza 98052" といったクエリの場合、Title フィールドについては "pizza" などが、
// 要求された地名については郵便番号 ("98052") や地名 ("New York, NY") などが返されます。
// SourceType.InlineAnswers は、Encarta、Finance、Weather、および ShowTimes といったサービス タイプを、
// それらのサービスに加入している営利目的のパートナーのみを対象として、返します。
// SourceType.Image は、クエリによって返される画像に関する情報を返します。そのような情報としては、たとえば、 
// フルサイズ画像への URI、生成された縮小画像への URI、フルサイズ画像の高さと幅、 
// 縮小画像の高さと幅、フルサイズ画像のファイル サイズ、
// 縮小画像のファイル サイズなどが挙げられます。

int arraySize = 7;

// 1 つまたは複数の共通の検索結果フィールドを返すようにそれぞれの SourceRequest を構成することができます。そのような共通の検索結果フィールドとしては、
// Title、Description、Url、DisplayUrl、CacheUrl、Source、SearchTags、Phone、Address、Location があります。
// 返されるフィールドは SourceType によって異なります。特定の SourceType については、拡張データ フィールドが返されることもあります。
// 詳細については、オンライン資料を参照してください。

// フィールドは、ビット単位の OR 演算子 (|) を使用して結合することができます。 
// All を指定すると、列挙体内の使用可能なすべてのフィールドが返されます。
// ただし、SourceRequest オブジェクトでは、記述されているすべてのフィールドが必ずしも返されるわけではありません。
// たとえば、タイプが Spelling である SourceRequest の場合、
// スペル候補が 1 つだけ、Title フィールドに返されます。つまり、
// ResultFields プロパティとして ResultFieldMask.All または ResultFieldMask.Title が設定された場合と同じデータが返されるということです。
SourceRequest[] sr = new SourceRequest[arraySize];

// 最初の SourceRequest は、Web ソース要求です。これは、Location オブジェクトが
// 設定されているかどうかによって、Web 検索結果に対する要求になったり、Web-Local 検索結果に対する要求になったりします。ユーザーが [Near Me] を
// クリックすると、サンプル アプリケーションが、Location の情報を適用して検索を実行し、
// Web-Local 検索結果 (Location が関連要素と見なされた場合) および
// PhoneBook の検索結果を返します。
sr[0] = new SourceRequest();
sr[0].Source = SourceType.Web;

// この SourceRequest については、以下のようにしてすべてのフィールドが返されるようにすることができます。
sr[0].ResultFields = ResultFieldMask.All | ResultFieldMask.SearchTagsArray;

// または、特定のフィールド (たとえば、SearchTags など) のみが返されるようにすることもできます。

// sr[0].ResultFields = ResultFieldMask.SearchTags;

// すべてのフィールドのサブセットが返されるようにするには、ビット単位の OR 演算子 (|) を使用して
// 検索結果フィールドを結合します。以下の例では、Title フィールドと URL フィールドのみが返されます。

// sr[0].ResultFields = ResultFieldMask.Title | ResultFieldMask.Url;

// 返される検索結果の 1 ページあたりの数をチェックします。この値が設定されていない場合は、
// 既定の検索結果数 (10 件/ページ) が返されます。
if (txtNumResults.Text != String.Empty)
sr[0].Count = Int32.Parse(txtNumResults.Text);

// オフセット値をチェックします。既定のオフセットはゼロであり、
// ランキングの上位のものから順に検索結果が Live Search エンジンから返されることを意味します。
// 上記のように、Offset プロパティは、多くの場合、多数の検索結果をページングするため、
// Count プロパティと組み合わせて使用されます。
if (txtOffset.Text != String.Empty)
sr[0].Offset = Int32.Parse(txtOffset.Text);

// ユーザーがフィルタ (SearchTagFilter) 指定を選択した場合、返される SearchTags には
// 指定されたもののみが含まれます。サンプル アプリケーションでは、以下の例のように、フィルタの数を 5 に制限しています。例:
// Query: MSDN, SearchTagFilter: search.title;search.mscategory
if (txtWebSearchTagFilters.Text != String.Empty)
                {
string strUserSuppliedSearchTags = txtWebSearchTagFilters.Text;
string[] strFiltersWeb = new string[5];
strFiltersWeb = strUserSuppliedSearchTags.Split(';');
sr[0].SearchTagFilters = strFiltersWeb;
                }

// ユーザーが選択可能なファイル タイプ (FileType) を決定します。既定の設定は、任意のファイル タイプです。
// FileType を制限するには、SourceRequest.FileType として特定の文字列値を設定します。
// たとえば、以下の例では、マイクロソフトの .DOC がタイプとして設定されています。
                
// sr[0].FileType = "DOC";

// このサンプルでは、有効なすべての Web ファイル タイプ (FileType) の値がコンボ ボックスに一覧表示されます。ユーザーが選択した
// 拡張子を適用するため、アプリケーションは、一覧表示された値からサブストリングを取得し、それを
// 要求に適用します。
string strRawFileTypeString = cbxWebFileType.SelectedItem.ToString();
if (strRawFileTypeString != "No File Type Preference")
                {
string[] strFileTypeProcessingArray = new string[2];
strFileTypeProcessingArray = strRawFileTypeString.Split('(');
string strFileType = strFileTypeProcessingArray[1].Substring(1, 4);
strFileType = strFileType.Trim();
sr[0].FileType = strFileType;
                }

// 2 番目の SourceRequest は、スペリング ソース要求です。Spelling は、1 つの呼び出しにつき
// 検索結果を 1 つだけ、Title フィールドに返します。
sr[1] = new SourceRequest();
sr[1].Source = SourceType.Spelling;
sr[1].ResultFields = ResultFieldMask.Title;
// SourceType.Spelling の Count を 1、Offset を 0 に設定すると、Spelling は、
// 1 つの要求につき、1 つの検索結果 (Count = 1) を、オフセット ゼロ (Offset = 0) で返します。
sr[1].Count = 1;
sr[1].Offset = 0;

// 3 番目の SourceRequest は、PhoneBook ソース要求です。PhoneBook の検索結果には、
// タイトル、説明、URL、電話番号、Address オブジェクト、および Location オブジェクトが含まれます。
sr[2] = new SourceRequest();
sr[2].Source = SourceType.PhoneBook;
if (optRelevanceSort.Checked)
sr[2].SortBy = SortByType.Relevance;
else if (optDistanceSort.Checked)
sr[2].SortBy = SortByType.Distance;
else
sr[2].SortBy = SortByType.Default;

// このサンプルでは、Title、Description、および Url の各フィールドの他に、
// PhoneBook 特有の戻りフィールドである Phone、Address、および Location の各フィールドも返されるようにするものとします。
sr[2].ResultFields = ResultFieldMask.Address | ResultFieldMask.Description | ResultFieldMask.Location | ResultFieldMask.Phone | ResultFieldMask.Title | ResultFieldMask.Url;
if (txtNumResults.Text != String.Empty)
sr[2].Count = Int32.Parse(txtNumResults.Text);
if (txtOffset.Text != String.Empty)
sr[2].Offset = Int32.Parse(txtOffset.Text);
// PhoneBook の検索結果が限定されるようにすることもできます。そのためには、一覧表示するタイプとして、すべての検索結果、ホワイト ページ (個人別)、
// またはイエロー ページ (職業別) のみが返されるようにします。PhoneBook SourceType についてサポートされている
// FileType の値は以下のとおりです。
if (optFileTypeWP_Only.Checked)
sr[2].FileType = "WP";
if (optFileTypeYP_Only.Checked)
sr[2].FileType = "YP";

// 4 番目の SourceRequest は、News ソース要求です。News の検索結果には、
// タイトル、説明、URL、ニュース ソース、および DateTime オブジェクトが含まれます。
sr[3] = new SourceRequest();
sr[3].Source = SourceType.News;

// ユーザーがフィルタ (SearchTagFilter) 指定を選択した場合、返される SearchTags には
// 指定されたもののみが含まれます。サンプル アプリケーションでは、以下の例のように、フィルタの数を 5 に制限しています。
// 例:Query: MSNBC, SearchTagFilter: search.source
if (txtNewsSearchTagFilters.Text != String.Empty)
                {
string strUserSuppliedSearchTags = txtNewsSearchTagFilters.Text;
string[] strFiltersNews = new string[5];
strFiltersNews = strUserSuppliedSearchTags.Split(';');
sr[3].SearchTagFilters = strFiltersNews;
                }

// このサンプルでは、Title、Description、および Url の各フィールドの他に、
// News の拡張戻りフィールドである Source フィールドと DateTime フィールドも返されるようにするものとします。
sr[3].ResultFields = ResultFieldMask.All | ResultFieldMask.DateTime | ResultFieldMask.SearchTagsArray;
if (txtNumResults.Text != String.Empty)
sr[3].Count = Int32.Parse(txtNumResults.Text);
if (txtOffset.Text != String.Empty)
sr[3].Offset = Int32.Parse(txtOffset.Text);

// 5 番目の SourceRequest は、QueryLocation 要求です。応答には、クエリに対するキーワード
// ("pizza" など) が含まれます。また、要求された地名として、郵便番号 ("98052" など) や地名 ("New York, NY" など) も
// 含まれます。キーワードは QueryLocation.Title フィールドに返され、地名や
// 郵便番号は QueryLocation.Description フィールドに返されます。
sr[4] = new SourceRequest();
sr[4].Source = SourceType.QueryLocation;
sr[4].ResultFields = ResultFieldMask.All;

// 6 番目の SourceRequest は、InlineAnswers 要求です。InlineAnswers は、サービスに加入している
// 営利目的のパートナーのみを対象として、返されます。返されるタイプとして、Encarta、
// Finance、Weather、および映画の ShowTimes があります。InlineAnswers の拡張フィールドには、スマートフォンなどの
// 携帯機器向けの簡易版の応答を表示する Summary フィールドや、
// クエリに対する応答として返される InlineAnswer タイプの名前を返す ResultType フィールド
// があります。
sr[5] = new SourceRequest();
sr[5].Source = SourceType.InlineAnswers;
sr[5].ResultFields = ResultFieldMask.All | ResultFieldMask.ResultType | ResultFieldMask.Summary;

// 7 番目の SourceRequest は、Image 要求です。Image の検索結果としては、画像を含む
// HTML ページの URL および表示 URL、画像名 (Title フィールド内)、画像ファイル サイズ、
// 画像の高さと幅、縮小画像のファイル サイズ、縮小画像の高さと幅、
// フルサイズ画像および縮小画像の URI などがあります。
sr[6] = new SourceRequest();
sr[6].Source = SourceType.Image;
sr[6].ResultFields = ResultFieldMask.All | ResultFieldMask.Image;
if (txtNumResults.Text != String.Empty)
sr[6].Count = Int32.Parse(txtNumResults.Text);
if (txtOffset.Text != String.Empty)
sr[6].Offset = Int32.Parse(txtOffset.Text);

// SearchRequest オブジェクトの Query フィールドは、
// Live Search エンジンに送信されるクエリのテキストです。クエリには、Live Search エンジンでサポートしている任意の有効なクエリ テキスト (拡張クエリ構文など) 
// を含めることができます。 
searchRequest.Query = txtQuery.Text;

// SearchRequest オブジェクトの Requests フィールドは、この検索の SourceRequest オブジェクトの
// 配列です。
searchRequest.Requests = sr;

// ユーザーが選択した SafeSearchOptions をチェックします。
// 既定の設定は Moderate です。
if (optSafeSearchOff.Checked)
searchRequest.SafeSearch = SafeSearchOptions.Off;
else if (optSafeSearchStrict.Checked)
searchRequest.SafeSearch = SafeSearchOptions.Strict;
else
searchRequest.SafeSearch = SafeSearchOptions.Moderate;

// Developer Provisioning System で指定されたアプリケーション ID を 二重引用符で囲って 
// SearchRequest の AppID の値として入力します。
searchRequest.AppID = "YOUR_APP_ID_GOES_HERE";

// ユーザーがクエリ ワードのマーキングを有効にしたかどうか、検索演算子についてのスペル修正を無効にしたかどうか、また、
// ホスト コラプシングを無効にしたかどうかを判別します。
int searchFlagsValue = 0;

if (chkQueryWordMarking.Checked)
searchFlagsValue += 1;
if (chkDisableSpellCorrectForSpecialWords.Checked)
searchFlagsValue += 2;
if (chkDisableHostCollapsing.Checked)
searchFlagsValue += 4;

switch (searchFlagsValue)
                {
case 0:
searchRequest.Flags = SearchFlags.None;
break;
case 1:
searchRequest.Flags = SearchFlags.MarkQueryWords;
break;
case 2:
searchRequest.Flags = SearchFlags.DisableSpellCorrectForSpecialWords;
break;
case 3:
searchRequest.Flags = SearchFlags.MarkQueryWords | SearchFlags.DisableSpellCorrectForSpecialWords;
break;
case 4:
searchRequest.Flags = SearchFlags.DisableHostCollapsing;
break;
case 5:
searchRequest.Flags = SearchFlags.MarkQueryWords | SearchFlags.DisableHostCollapsing;
break;
case 6:
searchRequest.Flags = SearchFlags.DisableSpellCorrectForSpecialWords | SearchFlags.DisableHostCollapsing;
break;
case 7:
searchRequest.Flags = SearchFlags.MarkQueryWords | SearchFlags.DisableSpellCorrectForSpecialWords | SearchFlags.DisableHostCollapsing;
break;
default:
searchRequest.Flags = SearchFlags.None;
break;
                }

// ユーザーが選択した CultureInfo を判別します。
// 以下のコードを使用して、CultureInfo の値をコンボ ボックスから取得します。
// このコンボ ボックスの値の集合には、Live Search エンジンで認識されるすべての値が含まれます。
// また、以下のようにして、コードの CultureInfo として特定の値を
// 設定することもできます。
// searchRequest.CultureInfo = "fr-CA";
searchRequest.CultureInfo = cbxCultureInfo.SelectedItem.ToString();

// Web 検索結果に加えて PhoneBook の検索結果も返されるようにするには、ユーザーが Location を設定する必要があります。
// 以下のコードでは、Location オブジェクトの Latitude フィールドと Longitude フィールド、
// および検索の Radius を設定します。

// 無効な Location データが指定された場合、Live Search エンジンは、
// 提供される情報に基づいて検索結果を返そうとします。Location データが
// 有効な地理的位置にマップされない場合は、返される結果の数がゼロになることがあります。
// また、Radius の値も検索結果に影響します。Radius に小さい値を設定すると、
// 予想よりも少ない結果が返される可能性があります。

// サンプル アプリケーションのユーザー インターフェイスでは、ユーザーによって入力されたデータの検証は行われません。
if (nearMe)
                {
double latitude = Double.Parse(txtLatitude.Text);
double longitude = Double.Parse(txtLongitude.Text);
double radius = Double.Parse(txtRadius.Text);
searchRequest.Location = new Location();
searchRequest.Location.Latitude = latitude;
searchRequest.Location.Longitude = longitude;
searchRequest.Location.Radius = radius;
                }

// SearchRequest を構成し、すべての SourceRequest
// オブジェクトを構成して SearchRequest に追加すると、
// アプリケーションでその要求を処理できるようになります。

// クエリによって返される SourceResponse オブジェクトに対する SearchResponse オブジェクトを作成します。
SearchResponse searchResponse;

// SearchResponse として MSNSearchService.Search(SearchRequest) を設定して、
// 検索要求を実行し、検索応答を返します。
searchResponse = s.Search(searchRequest);

// SearchResponse をチェックして、スペル候補が含まれているかどうかを判別します。
// スペル候補は Spelling SourceResponse の Title フィールドに返されます。
// SearchResponse に Spelling SourceResponse が含まれていない場合、
// スペル候補は存在せず、アプリケーションは SearchResponse を printResults メソッドに渡します。
// Spelling SourceResponse が返される場合、アプリケーションは、ユーザーに対して、スペリング候補を無視するか
// それとも受け入れるかをたずねるメッセージ ボックス (MessageBox) を表示し、
// 修正されたクエリ文字列を使用してクエリを再実行します。
// Spelling SourceResponse が存在するかどうかを検証するため、
// Spelling SourceType の SearchResponse.Response について Total フィールドをチェックします。
if (searchResponse.Responses[1].Total != 0)
handleSpellingSuggestion(searchResponse, nearMe);
else
printResults(searchResponse);
            }

// SOAP 例外を取得します。
catch (SoapException fault)
            {
MessageBox.Show(fault.Detail.InnerText.ToString());
            }

// Web 例外を取得します。
catch (WebException webx)
            {
MessageBox.Show(webx.ToString());
            }
        }

public void handleSpellingSuggestion(SearchResponse searchResponse, bool nearMe)
        {
// Spelling SourceResponse からスペル候補を取得します。
String strSpellingSuggestion = searchResponse.Responses[1].Results[0].Title;
// スペル候補からトークンを削除します。
char[] trimChars = new char[2];
trimChars[0] = '\xe000';
trimChars[1] = '\xe001';
strSpellingSuggestion = strSpellingSuggestion.Trim(trimChars);
strSpellingSuggestion = strSpellingSuggestion.Replace(trimChars[0], ' ');
strSpellingSuggestion = strSpellingSuggestion.Replace(trimChars[1], ' ');

// メッセージ ボックス (MessageBox) を表示して、スペル候補を受け入れるかどうかをユーザーにたずねます。
// ユーザーが Yes を選択した場合は、クエリ テキスト ボックス内のテキスト (txtQuery) を
// スペル候補と置き換え、変更されたクエリ文字列を使用して、新しいクエリを実行します。
// ユーザーが No を選択した場合は、メッセージ ボックス (MessageBox) を閉じて、Spelling SourceResponse が含まれている
// SearchResponse を printResults メソッドに渡します。
if (MessageBox.Show("検索しようとしていた語句は " + strSpellingSuggestion + " ですか?", "スペル候補",
MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString() == "Yes")
            {
txtQuery.Text = strSpellingSuggestion;
if (nearMe)
executeQuery(true);
else
executeQuery(false);
            }
else
printResults(searchResponse);
        }

public void printResults(SearchResponse searchResponse)
        {
// 検索が完了してすべての結果が返されたときにテキストをまとめて Web ブラウザ (WebBrowser)
// コントロールに表示する StringBuilder を新規作成します。
StringBuilder sb = new StringBuilder(8192);

// 検索で返される出力の HTML タグをセットアップします。
sb.Append("<HTML><BODY>");

// foreach を使用して、SearchResponse のすべての SourceResponse をループします。
foreach (SourceResponse sourceResponse in searchResponse.Responses)
            {
// それぞれの SourceRequest について要求された検索結果フィールドが 
// それぞれの SourceResponse の Results フィールドに返されます。
Result[] sourceResults = sourceResponse.Results;

// それぞれの SourceResponse について、返された検索結果の総数が
// ゼロよりも大きいかどうかを判別します。ゼロよりも大きい場合は、SourceResponse タイプについて簡易版の見出しを画面に表示します。
// Total は返される検索結果の総数の "推定値" です。
// また、Spelling は例外であり、返される検索結果の数は 0 または 1 になります。
if (sourceResponse.Total > 0)
                {
// ソース タイプを一覧表示します。
sb.Append("<H3><B>" + sourceResponse.Source.ToString() + " - 結果総数: ");
// 検索結果の推定総数を示します。
sb.Append(sourceResponse.Total.ToString() + "</B></H3><HR>");
                }
// foreach を使用して、それぞれの SourceResponse で返される検索結果をループします。
foreach (Result sourceResult in sourceResults)
                {
// 検索結果が返されない (NULL) 場合や検索結果にテキストが含まれていない (String.Empty) 場合は
// ラベルが画面に表示されないようにします。
if ((sourceResult.Title != null) && (sourceResult.Title != String.Empty))
sb.Append("<B>タイトル:</B>" + sourceResult.Title + "<BR>");
if ((sourceResult.Description != null) && (sourceResult.Description != String.Empty))
sb.Append("<B>説明:</B>" + sourceResult.Description + "<BR>");
if ((sourceResult.DisplayUrl != null) && (sourceResult.DisplayUrl != String.Empty))
sb.Append("<B>表示 Url:</B><A HREF=\"" + sourceResult.DisplayUrl + "\">" + sourceResult.DisplayUrl + "</A><BR>");
if ((sourceResult.Url != null) && (sourceResult.Url != String.Empty))
sb.Append("<B>Url:</B><A HREF=\"" + sourceResult.Url + "\">" + sourceResult.Url + "</A><BR>");
if ((sourceResult.SearchTags != null) && (sourceResult.SearchTags != String.Empty))
sb.Append("<B>検索タグ:</B>" + sourceResult.SearchTags + "<BR>");
if (sourceResult.SearchTagsArray != null)
                    {
sb.Append("<B>SearchTagsArray (長さ " + sourceResult.SearchTagsArray.Length.ToString() + ")</B><BR><BR>");
int counter = 0;
foreach (SearchTag nameValuePair in sourceResult.SearchTagsArray)
                        {
sb.Append("<B>SearchTagsArray[" + counter.ToString() + "] 名前 (Name):</B>" + nameValuePair.Name + "<BR>");
sb.Append("<B>SearchTagsArray[" + counter.ToString() + "] 値 (Value):</B>" + nameValuePair.Value + "<BR>");
counter++;
                        }
                    }
if ((sourceResult.CacheUrl != null) && (sourceResult.CacheUrl != String.Empty))
sb.Append("<B>キャッシュ Url:</B><A HREF=\"" + sourceResult.CacheUrl + "\">" + sourceResult.CacheUrl + "</A><BR>");
if ((sourceResult.Source != null) && (sourceResult.Source != String.Empty))
sb.Append("<B>ソース:</B>" + sourceResult.Source + "<BR>");
if ((sourceResult.Summary != null) && (sourceResult.Summary != String.Empty))
sb.Append("<B>概要:</B>" + sourceResult.Summary + "<BR>");
if ((sourceResult.ResultType != null) && (sourceResult.ResultType != String.Empty))
sb.Append("<B>結果のタイプ:</B>" + sourceResult.ResultType + "<BR>");

if (sourceResult.DateTime != null)
                    {
int year = sourceResult.DateTime.Year;
int month = sourceResult.DateTime.Month;
int day = sourceResult.DateTime.Day;
int hour = sourceResult.DateTime.Hour;
int minute = sourceResult.DateTime.Minute;
int second = sourceResult.DateTime.Second;

System.DateTime newsDateTime = new System.DateTime(year, month, day, hour, minute, second);
// 返された DateTime の生データを画面に表示します。
sb.Append("<B>ニュースの日時 (生データ):</B>" + newsDateTime.ToString() + "<BR>");
// Live Search Web サイトと同じように、ニュース記事が掲載されてからの経過期間を画面に表示します。
System.TimeSpan newsAge = new System.TimeSpan();
newsAge = System.DateTime.Now.ToUniversalTime() - newsDateTime;

if ((newsAge.Days == 0) && (newsAge.Hours == 0))
sb.Append("<B>ニュースの日時 (掲載されてからの経過期間):" + newsAge.Minutes.ToString() + " 分前</B><BR>");
if ((newsAge.Days == 0) && (newsAge.Hours == 1))
sb.Append("<B>ニュースの日時 (掲載されてからの経過期間):" + newsAge.Hours.ToString() + " 時間前</B><BR>");
else if ((newsAge.Days == 0) && (newsAge.Hours > 1))
sb.Append("<B>ニュースの日時 (掲載されてからの経過期間):" + newsAge.Hours.ToString() + " 時間前</B><BR>");
else if (newsAge.Days >= 1)
sb.Append("<B>ニュースの日時 (掲載されてからの経過期間):" + newsDateTime.ToShortDateString() + "</B><BR>");
                    }
sb.Append("<BR>");

// PhoneBook の検索結果を処理します。
// 検索が "Near Me" 検索である場合、Location の設定は Web 検索における関連要素と見なされ、 
// 該当するクエリについては PhoneBook の検索結果も返される可能性があります。
// 返された SourceType が PhoneBook SourceType である場合には、Phone フィールドのラベル、
// Address オブジェクトの各フィールド、および返された Location オブジェクトの各フィールドを画面に表示します。
// Address.FormattedAddress は常にブランクであり、Location.Radius は常に 5 を返すので、
// それらのフィールドはサンプルではスキップされます。
// 米国内の住所については、SecondaryCity フィールドおよび PostalCode フィールドは返されません。
// 英国内の住所については、SecondaryCity フィールドが使用されます。
if (sourceResponse.Source == SourceType.PhoneBook)
                    {
if ((sourceResult.Phone != null) && (sourceResult.Phone != String.Empty))
sb.Append("<B>電話番号:</B>" + sourceResult.Phone + "<BR>");
if (sourceResult.Address != null)
                        {
if ((sourceResult.Address.AddressLine != null) && (sourceResult.Address.AddressLine != String.Empty))
sb.Append("<B>番地:</B>" + sourceResult.Address.AddressLine + "<BR>");
if ((sourceResult.Address.CountryRegion != null) && (sourceResult.Address.CountryRegion != String.Empty))
sb.Append("<B>国/地域:</B>" + sourceResult.Address.CountryRegion + "<BR>");
if ((sourceResult.Address.PostalCode != null) && (sourceResult.Address.PostalCode != String.Empty))
sb.Append("<B>郵便番号:</B>" + sourceResult.Address.PostalCode + "<BR>");
if ((sourceResult.Address.PrimaryCity != null) && (sourceResult.Address.PrimaryCity != String.Empty))
sb.Append("<B>都市:</B>" + sourceResult.Address.PrimaryCity + "<BR>");
if ((sourceResult.Address.SecondaryCity != null) && (sourceResult.Address.SecondaryCity != String.Empty))
sb.Append("<B>第二都市:</B>" + sourceResult.Address.SecondaryCity + "<BR>");
if ((sourceResult.Address.Subdivision != null) && (sourceResult.Address.Subdivision != String.Empty))
sb.Append("<B>州:</B>" + sourceResult.Address.Subdivision + "<BR>");
                        }
if (sourceResult.Location != null)
                        {
sb.Append("<B>緯度:</B>" + sourceResult.Location.Latitude.ToString() + "<BR>");
sb.Append("<B>経度:</B>" + sourceResult.Location.Longitude.ToString() + "<BR>");

// SearchRequest で指定されている Location とクエリによって返されるそれぞれの Location の緯度および経度との間の
// "大圏" 距離を、マイル単位およびキロメートル単位で計算します。
                            // 
// 注意: この距離は、[設定] タブの [位置情報] セクションのユーザー インターフェイスである
// [緯度] ボックスと [経度] ボックスに入力される値に基づいて計算されます。
// "キーワード, 地名" 形式または "キーワード, 郵便番号" 形式のクエリについては、このコードでは、
// QueryLocation.Location オブジェクトに返されるような、都市の中心からの距離は計算されません。
double earthRadius = 3963.0;
double earthRadiusKM = 6392.0;
double latitudeIn = Double.Parse(txtLatitude.Text);
double longitudeIn = Double.Parse(txtLongitude.Text);
double latitudeOut = sourceResult.Location.Latitude;
double longitudeOut = sourceResult.Location.Longitude;
double radianConversion = (Math.PI / 180.0);

double operandOne;
double operandTwo;
double acosOfSum;
double finalValue;
double finalValueKM;

operandOne = Math.Cos(radianConversion * (90.0 - latitudeIn)) * Math.Cos(radianConversion * (90.0 - latitudeOut));
operandTwo = Math.Sin(radianConversion * (90.0 - latitudeIn)) * Math.Sin(radianConversion * (90.0 - latitudeOut)) * Math.Cos(radianConversion * (longitudeIn - longitudeOut));
acosOfSum = Math.Acos(operandOne + operandTwo);
finalValue = earthRadius * acosOfSum;
finalValueKM = earthRadiusKM * acosOfSum;

sb.Append("<B>距離 (マイル):</B>" + finalValue.ToString("F") + "<BR>");
sb.Append("<B>距離 (キロメートル):</B>" + finalValueKM.ToString("F") + "<BR><HR>");
                        }
                    }

// クエリが "キーワード (単数または複数), 地名" 形式や "キーワード (単数または複数), 郵便番号" 形式であり、
// SourceType.QueryLocation が要求された場合は、Live Search Web サイトと同じように、
// QueryLocation の検索結果を示す文字列を画面に表示します。QueryLocation は、オンライン資料に記載されているように、
// 選択された言語に関する PhoneBook の検索結果と組み合わせて使用することができます。
// このようなタイプの位置に基づくキーワード クエリの例としては、
// "pizza new york"、"pizza ottawa"、"pizza 98052" などが挙げられます。
if (sourceResponse.Source == SourceType.QueryLocation)
                    {
if (sourceResult.Location != null)
                        {
sb.Append("<B>QueryLocation 使用時に返される文字列のサンプル:</B><BR>");
sb.Append("次の場所の周辺の " + "<B>" + sourceResult.Title + "</B>" + " の検索結果の上位: ");
sb.Append("<B>" + sourceResult.Description + "</B>");
sb.Append(" (" + sourceResult.Location.Longitude.ToString() + ", " + sourceResult.Location.Latitude.ToString() + ")<BR>");
                        }
                    }
if (sourceResult.Image != null)
                    {
if (sourceResult.Image.ThumbnailFileSizeSpecified)
sb.Append("<B>縮小画像ファイル サイズ:</B>" + sourceResult.Image.ThumbnailFileSize.ToString() + "<BR>");
if (sourceResult.Image.ThumbnailHeightSpecified && sourceResult.Image.ThumbnailWidthSpecified)
sb.Append("<B>縮小画像の高さ:</B>" + sourceResult.Image.ThumbnailHeight.ToString() +
"<B>, Thumbnail Width:</B>" + sourceResult.Image.ThumbnailWidth.ToString() + "<BR>");
sb.Append("<B>縮小画像:</B><BR><IMG SRC=\"" + sourceResult.Image.ThumbnailURL + "\"></A><BR>");
if (sourceResult.Image.ImageFileSizeSpecified)
sb.Append("<B>画像ファイル サイズ:</B>" + sourceResult.Image.ImageFileSize.ToString() + "<BR>");
if (sourceResult.Image.ImageHeightSpecified && sourceResult.Image.ImageWidthSpecified)
sb.Append("<B>画像の高さ:</B>" + sourceResult.Image.ImageHeight.ToString() +
"<B>、画像の幅:</B>" + sourceResult.Image.ImageWidth.ToString() + "<BR>");
sb.Append("<B>フルサイズ画像 URL:</B><A HREF=\"" + sourceResult.Image.ImageURL + "\">" + sourceResult.Image.ImageURL + "</A><BR><HR>");
                    }
                }
// BODY タグと HTML タグを閉じます。
sb.Append("</BODY></HTML>");

// クエリ ワードのマーキングに関するユーザー要求を処理します。クエリ ワードは、
// Unicode 文字 0xE000 (単語の前) と 0xE001 (単語の後) でマーキングされます。
// それぞれの Unicode 文字の String オブジェクトを作成します。
if (chkQueryWordMarking.Checked)
                {
string MarkBegin = "\xe000";
string MarkEnd = "\xe001";
// テキストのマーキング文字を太字タグに置き換えます。
sb.Replace(MarkBegin, "<B>");
sb.Replace(MarkEnd, "</B>");
                }
            }
// WebBrowser コントロールのテキストとして、StringBuilder に含まれている HTML を設定します。
webBrowser1.DocumentText = sb.ToString();
        }

private void btnSearch_Click(object sender, EventArgs e)
        {
// 検索が PhoneBook の検索結果に関するものではないこと、および、Location が関連要素として含まれないことを示す場合は、
// "false" が設定されている executeQuery メソッドを呼び出します。
executeQuery(false);
        }

private void btnNearMe_Click(object sender, EventArgs e)
        {
// 検索が PhoneBook の検索結果に関するものであること、および、Location が関連要素として含まれることを示す場合は、
// "true" が設定されている executeQuery メソッドを呼び出します。
executeQuery(true);
        }
    }
}

例 (その 2)

コード

namespace LiveSearchAPISample
{
partial class frmSearchSample
    {
/// <summary>
/// 必須のデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 使用されているあらゆるリソースをクリーンアップします。
/// </summary>
/// <param name="disposing">管理しているリソースを破棄する場合は true、破棄しない場合は false</param>
protected override void Dispose(bool disposing)
        {
if (disposing && (components != null))
            {
components.Dispose();
            }
base.Dispose(disposing);
        }

#region Windows Form Designer generated code

/// <summary>
/// デザイナ サポートの必須メソッドです。したがって、
/// コード エディタを使用してこのメソッドの内容を変更しないようにしてください。
/// </summary>
private void InitializeComponent()
        {
this.tabControl1 = new System.Windows.Forms.TabControl();
this.SearchPage = new System.Windows.Forms.TabPage();
this.txtQuery = new System.Windows.Forms.TextBox();
this.btnNearMe = new System.Windows.Forms.Button();
this.btnSearch = new System.Windows.Forms.Button();
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.SettingsPage = new System.Windows.Forms.TabPage();
this.label18 = new System.Windows.Forms.Label();
this.cbxWebFileType = new System.Windows.Forms.ComboBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.optFileTypeYP_Only = new System.Windows.Forms.RadioButton();
this.optFileTypeWP_Only = new System.Windows.Forms.RadioButton();
this.optFileTypeAny = new System.Windows.Forms.RadioButton();
this.txtNewsSearchTagFilters = new System.Windows.Forms.TextBox();
this.txtWebSearchTagFilters = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.optRelevanceSort = new System.Windows.Forms.RadioButton();
this.optDistanceSort = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.optSafeSearchModerate = new System.Windows.Forms.RadioButton();
this.optSafeSearchStrict = new System.Windows.Forms.RadioButton();
this.optSafeSearchOff = new System.Windows.Forms.RadioButton();
this.chkDisableHostCollapsing = new System.Windows.Forms.CheckBox();
this.chkDisableSpellCorrectForSpecialWords = new System.Windows.Forms.CheckBox();
this.txtRadius = new System.Windows.Forms.TextBox();
this.txtLatitude = new System.Windows.Forms.TextBox();
this.txtLongitude = new System.Windows.Forms.TextBox();
this.chkQueryWordMarking = new System.Windows.Forms.CheckBox();
this.label11 = new System.Windows.Forms.Label();
this.cbxCultureInfo = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.txtOffset = new System.Windows.Forms.TextBox();
this.txtNumResults = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.SearchPage.SuspendLayout();
this.SettingsPage.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
            // 
// tabControl1
            // 
this.tabControl1.Controls.Add(this.SearchPage);
this.tabControl1.Controls.Add(this.SettingsPage);
this.tabControl1.Location = new System.Drawing.Point(-1, -1);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(680, 735);
this.tabControl1.TabIndex = 0;
            // 
// SearchPage
            // 
this.SearchPage.Controls.Add(this.txtQuery);
this.SearchPage.Controls.Add(this.btnNearMe);
this.SearchPage.Controls.Add(this.btnSearch);
this.SearchPage.Controls.Add(this.webBrowser1);
this.SearchPage.Location = new System.Drawing.Point(4, 22);
this.SearchPage.Name = "SearchPage";
this.SearchPage.Padding = new System.Windows.Forms.Padding(3);
this.SearchPage.Size = new System.Drawing.Size(672, 709);
this.SearchPage.TabIndex = 0;
this.SearchPage.Text = "Search";
this.SearchPage.UseVisualStyleBackColor = true;
            // 
// txtQuery
            // 
this.txtQuery.Location = new System.Drawing.Point(10, 24);
this.txtQuery.Name = "txtQuery";
this.txtQuery.Size = new System.Drawing.Size(480, 20);
this.txtQuery.TabIndex = 3;
            // 
// btnNearMe
            // 
this.btnNearMe.Location = new System.Drawing.Point(589, 23);
this.btnNearMe.Name = "btnNearMe";
this.btnNearMe.Size = new System.Drawing.Size(75, 23);
this.btnNearMe.TabIndex = 2;
this.btnNearMe.Text = "Near Me";
this.btnNearMe.UseVisualStyleBackColor = true;
this.btnNearMe.Click += new System.EventHandler(this.btnNearMe_Click);
            // 
// btnSearch
            // 
this.btnSearch.Location = new System.Drawing.Point(502, 23);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(75, 23);
this.btnSearch.TabIndex = 1;
this.btnSearch.Text = "Search";
this.btnSearch.UseVisualStyleBackColor = true;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
            // 
// webBrowser1
            // 
this.webBrowser1.Location = new System.Drawing.Point(10, 65);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(655, 636);
this.webBrowser1.TabIndex = 0;
            // 
// SettingsPage
            // 
this.SettingsPage.Controls.Add(this.label18);
this.SettingsPage.Controls.Add(this.cbxWebFileType);
this.SettingsPage.Controls.Add(this.groupBox3);
this.SettingsPage.Controls.Add(this.txtNewsSearchTagFilters);
this.SettingsPage.Controls.Add(this.txtWebSearchTagFilters);
this.SettingsPage.Controls.Add(this.label12);
this.SettingsPage.Controls.Add(this.label17);
this.SettingsPage.Controls.Add(this.label13);
this.SettingsPage.Controls.Add(this.groupBox2);
this.SettingsPage.Controls.Add(this.groupBox1);
this.SettingsPage.Controls.Add(this.chkDisableHostCollapsing);
this.SettingsPage.Controls.Add(this.chkDisableSpellCorrectForSpecialWords);
this.SettingsPage.Controls.Add(this.txtRadius);
this.SettingsPage.Controls.Add(this.txtLatitude);
this.SettingsPage.Controls.Add(this.txtLongitude);
this.SettingsPage.Controls.Add(this.chkQueryWordMarking);
this.SettingsPage.Controls.Add(this.label11);
this.SettingsPage.Controls.Add(this.cbxCultureInfo);
this.SettingsPage.Controls.Add(this.label10);
this.SettingsPage.Controls.Add(this.label9);
this.SettingsPage.Controls.Add(this.label16);
this.SettingsPage.Controls.Add(this.label15);
this.SettingsPage.Controls.Add(this.label14);
this.SettingsPage.Controls.Add(this.label8);
this.SettingsPage.Controls.Add(this.txtOffset);
this.SettingsPage.Controls.Add(this.txtNumResults);
this.SettingsPage.Controls.Add(this.label7);
this.SettingsPage.Controls.Add(this.label6);
this.SettingsPage.Controls.Add(this.label5);
this.SettingsPage.Controls.Add(this.label4);
this.SettingsPage.Controls.Add(this.label3);
this.SettingsPage.Controls.Add(this.label2);
this.SettingsPage.Controls.Add(this.label1);
this.SettingsPage.Location = new System.Drawing.Point(4, 22);
this.SettingsPage.Name = "SettingsPage";
this.SettingsPage.Padding = new System.Windows.Forms.Padding(3);
this.SettingsPage.Size = new System.Drawing.Size(672, 709);
this.SettingsPage.TabIndex = 1;
this.SettingsPage.Text = "Settings";
this.SettingsPage.UseVisualStyleBackColor = true;
            // 
// label18
            // 
this.label18.AutoSize = true;
this.label18.BackColor = System.Drawing.Color.Transparent;
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label18.Location = new System.Drawing.Point(39, 604);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(510, 16);
this.label18.TabIndex = 35;
this.label18.Text = "Return Listings of this Type (PhoneBook SourceType - US Markets Only):";
            // 
// cbxWebFileType
            // 
this.cbxWebFileType.FormattingEnabled = true;
this.cbxWebFileType.Items.AddRange(new object[] {
"No File Type Preference",
"Microsoft Word Document Files (.DOC Extension)",
"Autodesk .DWF Files (.DWF Extension)",
"HTML Files (.HTM Extension)",
"HTML Files (.HTML Extension)",
"Adobe Acrobat Portable Document Format Files (.PDF Extension)",
"Microsoft PowerPoint Files (.PPT Extension)",
"Adobe PostScript Files (.PS Extension)",
"Microsoft Rich Text Format Files (.RTF or .DOC Extension)",
"Generic Text Files (.TEXT Extension)",
"Generic Text Files (.TXT Extension)",
"Microsoft Excel Workbook Files (.XLS Extension)"});
this.cbxWebFileType.Location = new System.Drawing.Point(144, 565);
this.cbxWebFileType.Name = "cbxWebFileType";
this.cbxWebFileType.Size = new System.Drawing.Size(421, 21);
this.cbxWebFileType.TabIndex = 34;
this.cbxWebFileType.Text = "No File Type Preference";
            // 
// groupBox3
            // 
this.groupBox3.Controls.Add(this.optFileTypeYP_Only);
this.groupBox3.Controls.Add(this.optFileTypeWP_Only);
this.groupBox3.Controls.Add(this.optFileTypeAny);
this.groupBox3.Location = new System.Drawing.Point(251, 622);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(315, 71);
this.groupBox3.TabIndex = 33;
this.groupBox3.TabStop = false;
            // 
// optFileTypeYP_Only
            // 
this.optFileTypeYP_Only.AutoSize = true;
this.optFileTypeYP_Only.Location = new System.Drawing.Point(30, 46);
this.optFileTypeYP_Only.Name = "optFileTypeYP_Only";
this.optFileTypeYP_Only.Size = new System.Drawing.Size(214, 17);
this.optFileTypeYP_Only.TabIndex = 2;
this.optFileTypeYP_Only.Text = "Yellow Pages (Commercial) Listings Only";
this.optFileTypeYP_Only.UseVisualStyleBackColor = true;
            // 
// optFileTypeWP_Only
            // 
this.optFileTypeWP_Only.AutoSize = true;
this.optFileTypeWP_Only.Location = new System.Drawing.Point(30, 29);
this.optFileTypeWP_Only.Name = "optFileTypeWP_Only";
this.optFileTypeWP_Only.Size = new System.Drawing.Size(209, 17);
this.optFileTypeWP_Only.TabIndex = 1;
this.optFileTypeWP_Only.Text = "White Pages (Residential) Listings Only";
this.optFileTypeWP_Only.UseVisualStyleBackColor = true;
            // 
// optFileTypeAny
            // 
this.optFileTypeAny.AutoSize = true;
this.optFileTypeAny.Checked = true;
this.optFileTypeAny.Location = new System.Drawing.Point(30, 11);
this.optFileTypeAny.Name = "optFileTypeAny";
this.optFileTypeAny.Size = new System.Drawing.Size(133, 17);
this.optFileTypeAny.TabIndex = 0;
this.optFileTypeAny.TabStop = true;
this.optFileTypeAny.Text = "All PhoneBook Listings";
this.optFileTypeAny.UseVisualStyleBackColor = true;
            // 
// txtNewsSearchTagFilters
            // 
this.txtNewsSearchTagFilters.Location = new System.Drawing.Point(209, 511);
this.txtNewsSearchTagFilters.Name = "txtNewsSearchTagFilters";
this.txtNewsSearchTagFilters.Size = new System.Drawing.Size(357, 20);
this.txtNewsSearchTagFilters.TabIndex = 32;
            // 
// txtWebSearchTagFilters
            // 
this.txtWebSearchTagFilters.Location = new System.Drawing.Point(209, 489);
this.txtWebSearchTagFilters.Name = "txtWebSearchTagFilters";
this.txtWebSearchTagFilters.Size = new System.Drawing.Size(357, 20);
this.txtWebSearchTagFilters.TabIndex = 31;
            // 
// label12
            // 
this.label12.AutoSize = true;
this.label12.BackColor = System.Drawing.Color.Transparent;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label12.Location = new System.Drawing.Point(39, 444);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(351, 16);
this.label12.TabIndex = 30;
this.label12.Text = "Set SearchTagFilter(s) for Web and News Results";
            // 
// label17
            // 
this.label17.AutoSize = true;
this.label17.BackColor = System.Drawing.Color.Transparent;
this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label17.Location = new System.Drawing.Point(39, 540);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(315, 16);
this.label17.TabIndex = 30;
this.label17.Text = "Return Files of this Type (Web SourceType):";
            // 
// label13
            // 
this.label13.AutoSize = true;
this.label13.BackColor = System.Drawing.Color.Transparent;
this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label13.Location = new System.Drawing.Point(41, 372);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(202, 16);
this.label13.TabIndex = 30;
this.label13.Text = "Sort PhoneBook Results By:";
            // 
// groupBox2
            // 
this.groupBox2.Controls.Add(this.optRelevanceSort);
this.groupBox2.Controls.Add(this.optDistanceSort);
this.groupBox2.Location = new System.Drawing.Point(251, 379);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(314, 56);
this.groupBox2.TabIndex = 29;
this.groupBox2.TabStop = false;
            // 
// optRelevanceSort
            // 
this.optRelevanceSort.AutoSize = true;
this.optRelevanceSort.Location = new System.Drawing.Point(30, 30);
this.optRelevanceSort.Name = "optRelevanceSort";
this.optRelevanceSort.Size = new System.Drawing.Size(77, 17);
this.optRelevanceSort.TabIndex = 1;
this.optRelevanceSort.Text = "Relevance";
this.optRelevanceSort.UseVisualStyleBackColor = true;
            // 
// optDistanceSort
            // 
this.optDistanceSort.AutoSize = true;
this.optDistanceSort.Checked = true;
this.optDistanceSort.Location = new System.Drawing.Point(30, 13);
this.optDistanceSort.Name = "optDistanceSort";
this.optDistanceSort.Size = new System.Drawing.Size(110, 17);
this.optDistanceSort.TabIndex = 0;
this.optDistanceSort.TabStop = true;
this.optDistanceSort.Text = "Distance (Default)";
this.optDistanceSort.UseVisualStyleBackColor = true;
            // 
// groupBox1
            // 
this.groupBox1.Controls.Add(this.optSafeSearchModerate);
this.groupBox1.Controls.Add(this.optSafeSearchStrict);
this.groupBox1.Controls.Add(this.optSafeSearchOff);
this.groupBox1.Location = new System.Drawing.Point(251, 89);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(314, 71);
this.groupBox1.TabIndex = 27;
this.groupBox1.TabStop = false;
            // 
// optSafeSearchModerate
            // 
this.optSafeSearchModerate.AutoSize = true;
this.optSafeSearchModerate.Checked = true;
this.optSafeSearchModerate.Location = new System.Drawing.Point(30, 31);
this.optSafeSearchModerate.Name = "optSafeSearchModerate";
this.optSafeSearchModerate.Size = new System.Drawing.Size(234, 17);
this.optSafeSearchModerate.TabIndex = 8;
this.optSafeSearchModerate.TabStop = true;
this.optSafeSearchModerate.Text = "Moderate - Filter sexually explicit images only";
this.optSafeSearchModerate.UseVisualStyleBackColor = true;
            // 
// optSafeSearchStrict
            // 
this.optSafeSearchStrict.AutoSize = true;
this.optSafeSearchStrict.Location = new System.Drawing.Point(30, 13);
this.optSafeSearchStrict.Name = "optSafeSearchStrict";
this.optSafeSearchStrict.Size = new System.Drawing.Size(260, 17);
this.optSafeSearchStrict.TabIndex = 7;
this.optSafeSearchStrict.Text = "Strict - Filter sexually explicit text and image results";
this.optSafeSearchStrict.UseVisualStyleBackColor = true;
            // 
// optSafeSearchOff
            // 
this.optSafeSearchOff.AutoSize = true;
this.optSafeSearchOff.Location = new System.Drawing.Point(30, 49);
this.optSafeSearchOff.Name = "optSafeSearchOff";
this.optSafeSearchOff.Size = new System.Drawing.Size(170, 17);
this.optSafeSearchOff.TabIndex = 9;
this.optSafeSearchOff.Text = "Off - Do not filter search results";
this.optSafeSearchOff.UseVisualStyleBackColor = true;
            // 
// chkDisableHostCollapsing
            // 
this.chkDisableHostCollapsing.AutoSize = true;
this.chkDisableHostCollapsing.Location = new System.Drawing.Point(179, 347);
this.chkDisableHostCollapsing.Name = "chkDisableHostCollapsing";
this.chkDisableHostCollapsing.Size = new System.Drawing.Size(217, 17);
this.chkDisableHostCollapsing.TabIndex = 22;
this.chkDisableHostCollapsing.Text = "Check this box to disable host collapsing";
this.chkDisableHostCollapsing.UseVisualStyleBackColor = true;
            // 
// chkDisableSpellCorrectForSpecialWords
            // 
this.chkDisableSpellCorrectForSpecialWords.AutoSize = true;
this.chkDisableSpellCorrectForSpecialWords.Location = new System.Drawing.Point(179, 330);
this.chkDisableSpellCorrectForSpecialWords.Name = "chkDisableSpellCorrectForSpecialWords";
this.chkDisableSpellCorrectForSpecialWords.Size = new System.Drawing.Size(309, 17);
this.chkDisableSpellCorrectForSpecialWords.TabIndex = 21;
this.chkDisableSpellCorrectForSpecialWords.Text = "Check this box to disable spell correction for query operators";
this.chkDisableSpellCorrectForSpecialWords.UseVisualStyleBackColor = true;
            // 
// txtRadius
            // 
this.txtRadius.Location = new System.Drawing.Point(466, 274);
this.txtRadius.Name = "txtRadius";
this.txtRadius.Size = new System.Drawing.Size(100, 20);
this.txtRadius.TabIndex = 20;
this.txtRadius.Text = "5.0";
            // 
// txtLatitude
            // 
this.txtLatitude.Location = new System.Drawing.Point(466, 252);
this.txtLatitude.Name = "txtLatitude";
this.txtLatitude.Size = new System.Drawing.Size(100, 20);
this.txtLatitude.TabIndex = 19;
this.txtLatitude.Text = "47.422433";
            // 
// txtLongitude
            // 
this.txtLongitude.Location = new System.Drawing.Point(466, 230);
this.txtLongitude.Name = "txtLongitude";
this.txtLongitude.Size = new System.Drawing.Size(100, 20);
this.txtLongitude.TabIndex = 18;
this.txtLongitude.Text = "-122.305833";
            // 
// chkQueryWordMarking
            // 
this.chkQueryWordMarking.AutoSize = true;
this.chkQueryWordMarking.Checked = true;
this.chkQueryWordMarking.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkQueryWordMarking.Location = new System.Drawing.Point(179, 313);
this.chkQueryWordMarking.Name = "chkQueryWordMarking";
this.chkQueryWordMarking.Size = new System.Drawing.Size(314, 17);
this.chkQueryWordMarking.TabIndex = 17;
this.chkQueryWordMarking.Text = "Check this box to enable query word marking (hit highlighting)";
this.chkQueryWordMarking.UseVisualStyleBackColor = true;
            // 
// label11
            // 
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(109, 188);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(293, 13);
this.label11.TabIndex = 16;
this.label11.Text = "Specify the Language and Country/Region for search results";
            // 
// cbxCultureInfo
            // 
this.cbxCultureInfo.FormattingEnabled = true;
this.cbxCultureInfo.Items.AddRange(new object[] {
"da-DK",
"de-AT",
"de-CH",
"de-DE",
"en-AU",
"en-CA",
"en-GB",
"en-ID",
"en-IE",
"en-IN",
"en-MY",
"en-NZ",
"en-PH",
"en-SG",
"en-US",
"en-XA",
"en-ZA",
"es-AR",
"es-ES",
"es-MX",
"es-US",
"es-XL",
"fi-FI",
"fr-BE",
"fr-CA",
"fr-CH",
"fr-FR",
"it-IT",
"ja-JP",
"ko-KR",
"nb-NO",
"nl-BE",
"nl-NL",
"pt-BR",
"sv-SE",
"tr-TR",
"zh-CN",
"zh-HK",
"zh-TW"});
this.cbxCultureInfo.Location = new System.Drawing.Point(445, 184);
this.cbxCultureInfo.Name = "cbxCultureInfo";
this.cbxCultureInfo.Size = new System.Drawing.Size(121, 21);
this.cbxCultureInfo.TabIndex = 15;
this.cbxCultureInfo.Text = "en-US";
            // 
// label10
            // 
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(109, 278);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(198, 13);
this.label10.TabIndex = 14;
this.label10.Text = "Specify the Radius of the search in miles";
            // 
// label9
            // 
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(109, 256);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(180, 13);
this.label9.TabIndex = 13;
this.label9.Text = "Specify the Latitude of your Location";
            // 
// label16
            // 
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label16.Location = new System.Drawing.Point(141, 515);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(42, 13);
this.label16.TabIndex = 12;
this.label16.Text = "News:";
            // 
// label15
            // 
this.label15.AutoSize = true;
this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label15.Location = new System.Drawing.Point(141, 493);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(37, 13);
this.label15.TabIndex = 12;
this.label15.Text = "Web:";
            // 
// label14
            // 
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(109, 466);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(433, 13);
this.label14.TabIndex = 12;
this.label14.Text = "Type your SearchTag Name(s) in the appropriate text box, below, separated by semi" +                "colons";

            // 
// label8
            // 
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(109, 234);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(189, 13);
this.label8.TabIndex = 12;
this.label8.Text = "Specify the Longitude of your Location";
            // 
// txtOffset
            // 
this.txtOffset.Location = new System.Drawing.Point(466, 52);
this.txtOffset.Name = "txtOffset";
this.txtOffset.Size = new System.Drawing.Size(100, 20);
this.txtOffset.TabIndex = 11;
this.txtOffset.Text = "0";
            // 
// txtNumResults
            // 
this.txtNumResults.Location = new System.Drawing.Point(466, 29);
this.txtNumResults.Name = "txtNumResults";
this.txtNumResults.Size = new System.Drawing.Size(100, 20);
this.txtNumResults.TabIndex = 10;
this.txtNumResults.Text = "5";
            // 
// label7
            // 
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(109, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(286, 13);
this.label7.TabIndex = 6;
this.label7.Text = "Specify the starting point for results (Offset Value - 0 to 999)";
            // 
// label6
            // 
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(109, 33);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(272, 13);
this.label6.TabIndex = 5;
this.label6.Text = "Specify the number of results per page to return (1 to 50)";
            // 
// label5
            // 
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(41, 301);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(96, 16);
this.label5.TabIndex = 4;
this.label5.Text = "SearchFlags";
            // 
// label4
            // 
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(41, 164);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(133, 16);
this.label4.TabIndex = 3;
this.label4.Text = "CultureInfo Setting";
            // 
// label3
            // 
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(41, 212);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(147, 16);
this.label3.TabIndex = 2;
this.label3.Text = "Location Information";
            // 
// label2
            // 
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(41, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(146, 16);
this.label2.TabIndex = 1;
this.label2.Text = "SafeSearch Options";
            // 
// label1
            // 
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(41, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(203, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Results Per Page and Offset";
            // 
// frmSearchSample
            // 
this.AcceptButton = this.btnSearch;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(680, 734);
this.Controls.Add(this.tabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "frmSearchSample";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Live Search API Version 1.1 Sample Application";
this.tabControl1.ResumeLayout(false);
this.SearchPage.ResumeLayout(false);
this.SearchPage.PerformLayout();
this.SettingsPage.ResumeLayout(false);
this.SettingsPage.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);

        }

#endregion

private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage SearchPage;
private System.Windows.Forms.TabPage SettingsPage;
private System.Windows.Forms.TextBox txtQuery;
private System.Windows.Forms.Button btnNearMe;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.WebBrowser webBrowser1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RadioButton optSafeSearchStrict;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox chkQueryWordMarking;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.ComboBox cbxCultureInfo;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtOffset;
private System.Windows.Forms.TextBox txtNumResults;
private System.Windows.Forms.RadioButton optSafeSearchOff;
private System.Windows.Forms.RadioButton optSafeSearchModerate;
private System.Windows.Forms.TextBox txtRadius;
private System.Windows.Forms.TextBox txtLatitude;
private System.Windows.Forms.TextBox txtLongitude;
private System.Windows.Forms.CheckBox chkDisableSpellCorrectForSpecialWords;
private System.Windows.Forms.CheckBox chkDisableHostCollapsing;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton optRelevanceSort;
private System.Windows.Forms.RadioButton optDistanceSort;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox txtNewsSearchTagFilters;
private System.Windows.Forms.TextBox txtWebSearchTagFilters;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.RadioButton optFileTypeYP_Only;
private System.Windows.Forms.RadioButton optFileTypeWP_Only;
private System.Windows.Forms.RadioButton optFileTypeAny;
private System.Windows.Forms.ComboBox cbxWebFileType;
private System.Windows.Forms.Label label18;
    }
}