<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Walter Soto</title>
	<atom:link href="http://www.waltersoto.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.waltersoto.com</link>
	<description></description>
	<lastBuildDate>Mon, 16 May 2011 13:34:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>JavaScript tutorial series</title>
		<link>http://www.waltersoto.com/2011/05/16/javascript-tutorial-series/</link>
		<comments>http://www.waltersoto.com/2011/05/16/javascript-tutorial-series/#comments</comments>
		<pubDate>Mon, 16 May 2011 13:34:50 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.waltersoto.com/?p=31</guid>
		<description><![CDATA[I will begin a series on how to create a JavaScript framework from the ground up. The purpose of the posts is to explore and create a base library for all the examples in the blog.  The library will be called simplex and you may find the main sequence by following the tag &#8220;simplex&#8221; in the JavaScriptFramework [...]]]></description>
			<content:encoded><![CDATA[<p>I will begin a series on how to create a JavaScript framework from the ground up. The purpose of the posts is to explore and create a base library for all the examples in the blog.  The library will be called simplex and you may find the main sequence by following the tag &#8220;simplex&#8221; in the JavaScriptFramework  blog.</p>
<p>See: <a href="http://www.javascriptframework.com/tag/simplex/">http://www.javascriptframework.com/tag/simplex/</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.waltersoto.com/2011/05/16/javascript-tutorial-series/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Create thumbnails with C#</title>
		<link>http://www.waltersoto.com/2011/05/16/create-thumbnails-with-c/</link>
		<comments>http://www.waltersoto.com/2011/05/16/create-thumbnails-with-c/#comments</comments>
		<pubDate>Mon, 16 May 2011 13:30:21 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[GDI]]></category>

		<guid isPermaLink="false">http://www.waltersoto.com/?p=29</guid>
		<description><![CDATA[I added a quick snip on how to use the .NET&#8217;s Image class to create thumbnail&#8217;s from an image. See it here:  http://www.developercaster.com/2011/05/create-thumbnails-with-c-image-class.html &#160;]]></description>
			<content:encoded><![CDATA[<p>I added a quick snip on how to use the .NET&#8217;s Image class to create thumbnail&#8217;s from an image.</p>
<p>See it here:  <a href="http://www.developercaster.com/2011/05/create-thumbnails-with-c-image-class.html">http://www.developercaster.com/2011/05/create-thumbnails-with-c-image-class.html</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.waltersoto.com/2011/05/16/create-thumbnails-with-c/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bing API &#8211; Using the Bing Translator with C#</title>
		<link>http://www.waltersoto.com/2011/03/21/bing-api-using-the-bing-translator-with-c/</link>
		<comments>http://www.waltersoto.com/2011/03/21/bing-api-using-the-bing-translator-with-c/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 17:11:30 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://waltersoto.com.doghorn.arvixe.com/?p=4</guid>
		<description><![CDATA[This will be the first post of a series about creating a class library for Microsoft Bing APIs in C#. I had ignore Microsoft offering in the past because Google APIs have always done the work for me; however, I recently worked in my first WP7 application and found Bing services to be really mature [...]]]></description>
			<content:encoded><![CDATA[<p>This will be the first post of a series about creating a class library for Microsoft Bing APIs in C#. I had ignore Microsoft offering in the past because Google APIs have always done the work for me; however, I recently worked in my first WP7 application and found Bing services to be really mature and capable of delivering results just as good as Google’s.</p>
<div><strong>Let’s Begin</strong></div>
<div><strong><br />
</strong></div>
<div><em>NOTE:  You need to register and create an AppID at </em><a href="http://www.bing.com/developers"><em>http://www.bing.com/developers</em></a><em>.</em></div>
<div><em><br />
</em></div>
<div>Create a new project called .NET 4.0 Class Library called <strong>DeveloperCaster.Bing</strong>; we will wrap all API calls within this class library.</div>
<div><img class="alignnone" title="Create Solution" src="https://lh3.googleusercontent.com/-ULcJaWE7KlQ/TXVU_dE8hqI/AAAAAAAAALM/qywuIY5Wmr4/s1600/bingapi_p1_img1.jpg" alt="" width="482" height="334" /></div>
<div><a href="https://lh3.googleusercontent.com/-ULcJaWE7KlQ/TXVU_dE8hqI/AAAAAAAAALM/qywuIY5Wmr4/s1600/bingapi_p1_img1.jpg"></a></div>
<div>I want to be able to expand this library beyond the translation API so I will leave room to extend it in future posts.</div>
<div>We will begin by adding the following objects:</div>
<div><strong>The Bing Parameter Class</strong> &#8211; It is a simple value pair class that will be used to represent request parameters to the API.</div>
<div><img class="alignnone" title="Bing Parameter Class" src="https://lh3.googleusercontent.com/-_uXubowvLfg/TXVU_5Om4aI/AAAAAAAAALQ/MahFba3ddak/s1600/bingapi_p1_img2.jpg" alt="" width="216" height="134" /></div>
<div><a href="https://lh3.googleusercontent.com/-_uXubowvLfg/TXVU_5Om4aI/AAAAAAAAALQ/MahFba3ddak/s1600/bingapi_p1_img2.jpg"></a></div>
<div>
<div>Source code:</div>
<div style="padding-left: 30px;">public class BingParameter</div>
<div style="padding-left: 30px;">{</div>
<div style="padding-left: 60px;">public string Name</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set;</div>
<div style="padding-left: 90px;">get;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public string Value</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set;</div>
<div style="padding-left: 90px;">get;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 30px;">}</div>
</div>
<div><strong>The IBingRequest Interface</strong> – Will be our datatype for request to the Bing service (see BingService class).</div>
<div><img class="alignnone" title="IBingRequest" src="https://lh3.googleusercontent.com/-ExMR85xUCu0/TXVVAL4p1hI/AAAAAAAAALU/FeFy_9UUJf8/s1600/bingapi_p1_img3.jpg" alt="" width="215" height="117" /></div>
<div><a href="https://lh3.googleusercontent.com/-ExMR85xUCu0/TXVVAL4p1hI/AAAAAAAAALU/FeFy_9UUJf8/s1600/bingapi_p1_img3.jpg"></a></div>
<div>
<p>Source code:</p>
</div>
<div>public interface IBingRequest</div>
<div>{</div>
<div style="padding-left: 30px;">List&lt;BingParameter&gt; List { get; }</div>
<div>}</div>
<p><strong>The BingService class</strong> – We are going to use this class to execute all our requests to the Bing API.  BingService provide one method to perform a request and I also added an extra method that will take a IBingRequest plus an anonymous method to process a request using the Request(IBingRequest) method to send its return value to the ResponseHandler parameter (not really needed for core functionality). Our class will embed the Bing API URL (“http://api.bing.net/xml.aspx”); however, you may choose not to do so and pass it as a parameter.</p>
<div><img class="alignnone" title="BingService Class" src="https://lh5.googleusercontent.com/-qg2ei7LcUQk/TXVVATkaCLI/AAAAAAAAALY/6zXU0E_AhkU/s1600/bingapi_p1_img4.jpg" alt="" width="239" height="253" /></div>
<div><a href="https://lh5.googleusercontent.com/-qg2ei7LcUQk/TXVVATkaCLI/AAAAAAAAALY/6zXU0E_AhkU/s1600/bingapi_p1_img4.jpg"></a></div>
<div>Source Code:</div>
<div>using System;</div>
<div>using System.Collections.Generic;</div>
<div>using System.Text;</div>
<div>using System.Net;</div>
<div>namespace DeveloperCaster.Bing</div>
<div>{</div>
<div style="padding-left: 30px;">public delegate void ResponseHandler(HttpWebResponse response);</div>
<div style="padding-left: 30px;">public class BingService</div>
<div style="padding-left: 30px;">{</div>
<div style="padding-left: 60px;">private string _api = &#8220;http://api.bing.net/xml.aspx&#8221;;</div>
<div style="padding-left: 60px;">private string _appId = &#8220;&#8221;;</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Default constructor</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">public BingService()</div>
<div style="padding-left: 60px;">: this(&#8220;&#8221;)</div>
<div style="padding-left: 60px;">{ }</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Contructor with ApiId</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;appId&#8221;&gt;AppId&lt;/param&gt;</div>
<div style="padding-left: 60px;">public BingService(string appId)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 60px;">_appId = appId;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Request with response handler</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;r&#8221;&gt;&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;response&#8221;&gt;&lt;/param&gt;</div>
<div style="padding-left: 60px;">public void ProcessRequest(IBingRequest r, ResponseHandler response)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 60px;">response(Request(r));</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Request from Api</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;list&#8221;&gt;&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;returns&gt;&lt;/returns&gt;</div>
<div style="padding-left: 60px;">public HttpWebResponse Request(IBingRequest r)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">StringBuilder req = new StringBuilder();</div>
<div style="padding-left: 90px;">req.Append(this.Api);</div>
<div style="padding-left: 90px;">foreach (BingParameter field in r.List)</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">req.Append(&#8220;&amp;&#8221; + field.Name + &#8220;=&#8221; + field.Value);</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">HttpWebRequest webRq = (HttpWebRequest)HttpWebRequest.Create(req.ToString());</div>
<div style="padding-left: 90px;">HttpWebResponse result = (HttpWebResponse)webRq.GetResponse();</div>
<div style="padding-left: 90px;">return result;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Get Api</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">public string Api</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">get { return _api + &#8220;?AppId=&#8221; + _appId; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Set/Get Api</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">public string AppId</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set { _appId = value; }</div>
<div style="padding-left: 90px;">get { return _appId; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 30px;">}</div>
<div>}</div>
<p><strong>Translation Request Object</strong></p>
<p>The translation request will be the first Bing request of our series so let’s being.  The Bing API allows us to request services based on SourceTypes. A SourceType is a source of information available by the API (see full documentation).</p>
<p>To work with the Bing Translation SourceType we will need the following two classes for our object:</p>
<p><strong>The TranslationResponse Class</strong> – We will use this object to store our translation API results.</p>
<div><img class="alignnone" title="Translation Response" src="https://lh6.googleusercontent.com/-X6SG38nu_1g/TXVVAo8S__I/AAAAAAAAALc/H5TdVA6iwIg/s1600/bingapi_p1_img5.jpg" alt="" width="215" height="133" /></div>
<div><a href="https://lh6.googleusercontent.com/-X6SG38nu_1g/TXVVAo8S__I/AAAAAAAAALc/H5TdVA6iwIg/s1600/bingapi_p1_img5.jpg"></a></div>
<div>Source Code</div>
<div>using System;</div>
<div>namespace DeveloperCaster.Bing</div>
<div>{</div>
<div style="padding-left: 30px;">public class TranslationResponse</div>
<div style="padding-left: 30px;">{</div>
<div style="padding-left: 60px;">public string SearchedTerms</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set;</div>
<div style="padding-left: 90px;">get;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public string TranslatedTerm</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set;</div>
<div style="padding-left: 90px;">get;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 30px;">}</div>
<div>}</div>
<p><strong>The TranslationRequest Class</strong> – This is or main request object</p>
<div><img class="alignnone" title="TranslationRequest" src="https://lh5.googleusercontent.com/-NGSx5gtCDlg/TXVU_KFHSRI/AAAAAAAAALI/KxEwg7k_7QI/s1600/bingapi_p1_img6.jpg" alt="" width="287" height="400" /></div>
<div><a href="https://lh5.googleusercontent.com/-NGSx5gtCDlg/TXVU_KFHSRI/AAAAAAAAALI/KxEwg7k_7QI/s1600/bingapi_p1_img6.jpg"></a></div>
<div>
<p>Note: Our request object must inherit from the IBingRequest Interface.</p>
</div>
<div>Source Code:</div>
<div>using System;</div>
<div>using System.Collections.Generic;</div>
<div>using System.Net;</div>
<div>using System.Xml;</div>
<div>namespace DeveloperCaster.Bing</div>
<div>{</div>
<div style="padding-left: 30px;">public class TranslationRequest : IBingRequest</div>
<div style="padding-left: 30px;">{</div>
<div style="padding-left: 60px;">private List&lt;BingParameter&gt; _items;</div>
<div style="padding-left: 60px;">private string _query;</div>
<div style="padding-left: 60px;">private string _sourceLanguage;</div>
<div style="padding-left: 60px;">private string _targetLanguage;</div>
<div style="padding-left: 60px;">private string _version;</div>
<div style="padding-left: 60px;">public static TranslationResponse ParseResponse(HttpWebResponse response)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">TranslationResponse result = new TranslationResponse();</div>
<div style="padding-left: 90px;">XmlDocument doc = new XmlDocument();</div>
<div style="padding-left: 90px;">doc.Load(response.GetResponseStream());</div>
<div style="padding-left: 90px;">if (doc.HasChildNodes)</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">try</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (doc.HasChildNodes)</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 150px;">if (doc["SearchResponse"] != null)</div>
<div style="padding-left: 150px;">{</div>
<div style="padding-left: 180px;">if (doc["SearchResponse"]["Query"]["SearchTerms"] !=null)</div>
<div style="padding-left: 180px;">{</div>
<div style="padding-left: 210px;">result.SearchedTerms = doc["SearchResponse"]["Query"]["SearchTerms"].InnerText;</div>
<div style="padding-left: 180px;">}</div>
<div style="padding-left: 180px;">if (doc["SearchResponse"]["tra:Translation"] != null)</div>
<div style="padding-left: 180px;">{</div>
<div style="padding-left: 210px;">result.TranslatedTerm = doc["SearchResponse"]</div>
<div style="padding-left: 210px;">["tra:Translation"]</div>
<div style="padding-left: 210px;">["tra:Results"]</div>
<div style="padding-left: 210px;">["tra:TranslationResult"]["tra:TranslatedTerm"].InnerText;</div>
<div style="padding-left: 180px;">}</div>
<div style="padding-left: 150px;">}</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">catch (NullReferenceException ex)</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">catch (XmlException ex)</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">return result;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Default constructor</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">public TranslationRequest()</div>
<div style="padding-left: 60px;">: this(&#8220;&#8221;, &#8220;&#8221;, &#8220;&#8221;, &#8220;&#8221;) { }</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Second constructor</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;query&#8221;&gt;query&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;sourceLanguage&#8221;&gt;source language&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;targetLanguage&#8221;&gt;target language&lt;/param&gt;</div>
<div style="padding-left: 60px;">public TranslationRequest(string query, string sourceLanguage,</div>
<div style="padding-left: 60px;">string targetLanguage)</div>
<div style="padding-left: 60px;">: this(query, sourceLanguage, targetLanguage, &#8220;2.2&#8243;) { }</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Third constructor</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;query&#8221;&gt;query&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;sourceLanguage&#8221;&gt;source language&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;targetLanguage&#8221;&gt;target language&lt;/param&gt;</div>
<div style="padding-left: 60px;">/// &lt;param name=&#8221;version&#8221;&gt;api version&lt;/param&gt;</div>
<div style="padding-left: 60px;">public TranslationRequest(string query, string sourceLanguage, string targetLanguage, string version)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">_items = new List&lt;BingParameter&gt;();</div>
<div style="padding-left: 90px;">_items.Add(new BingParameter</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">Name = &#8220;Sources&#8221;,</div>
<div style="padding-left: 90px;">Value = &#8220;Translation&#8221;</div>
<div style="padding-left: 90px;">});</div>
<div style="padding-left: 90px;">if (!Exists(&#8220;Query&#8221;))</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">_query = query;</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">if (!Exists(&#8220;Translation.SourceLanguage&#8221;))</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">_sourceLanguage = sourceLanguage;</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">if (!Exists(&#8220;Translation.TargetLanguage&#8221;))</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">_targetLanguage = targetLanguage;</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">if (!Exists(&#8220;Version&#8221;))</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">_version = version;</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">private void Add(string name, string val)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">_items.Add(new BingParameter</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 90px;">Name = name,</div>
<div style="padding-left: 90px;">Value = val</div>
<div style="padding-left: 90px;">});</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">private bool Exists(string name)</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">bool result = false;</div>
<div style="padding-left: 90px;">foreach (BingParameter f in _items)</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (f.Name.ToLower() == name.ToLower())</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 150px;">result = true;</div>
<div style="padding-left: 150px;">break;</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">return result;</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public ResponseHandler Response;</div>
<div style="padding-left: 60px;">public string Query</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (!Exists(&#8220;Query&#8221;))</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 150px;">_query = value;</div>
<div style="padding-left: 150px;">Add(&#8220;Query&#8221;, value);</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">get { return _query; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public string SourceLanguage</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (!Exists(&#8220;Translation.SourceLanguage&#8221;))</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 150px;">_sourceLanguage = value;</div>
<div style="padding-left: 150px;">Add(&#8220;Translation.SourceLanguage&#8221;, value);</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">get { return _sourceLanguage; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public string TargetLanguage</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (!Exists(&#8220;Translation.TargetLanguage&#8221;))</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 150px;">_targetLanguage = value;</div>
<div style="padding-left: 150px;">Add(&#8220;Translation.TargetLanguage&#8221;, value);</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">get { return _targetLanguage; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">public string Version</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">set</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">if (!Exists(&#8220;Version&#8221;))</div>
<div style="padding-left: 120px;">{</div>
<div style="padding-left: 120px;">_version = value;</div>
<div style="padding-left: 120px;">Add(&#8220;Version&#8221;, value);</div>
<div style="padding-left: 120px;">}</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 90px;">get { return _version; }</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 60px;">/// &lt;summary&gt;</div>
<div style="padding-left: 60px;">/// Set/Get Items</div>
<div style="padding-left: 60px;">/// &lt;/summary&gt;</div>
<div style="padding-left: 60px;">public List&lt;BingParameter&gt; List</div>
<div style="padding-left: 60px;">{</div>
<div style="padding-left: 90px;">get</div>
<div style="padding-left: 90px;">{</div>
<div style="padding-left: 120px;">return _items;</div>
<div style="padding-left: 90px;">}</div>
<div style="padding-left: 60px;">}</div>
<div style="padding-left: 30px;">}</div>
<div>}</div>
<p><strong>Usage</strong></p>
<div>
<p>We will test our library by translating a phrase from English to Spanish. Create a console application, create a reference to our complied dll, and add the following code to test our library:</p>
</div>
<div>BingService bing = new BingService(&#8220;<strong>ADD YOUR APPID HERE</strong>&#8220;);</div>
<div>TranslationResponse response =TranslationRequest.ParseResponse(bing.Request(</div>
<div style="padding-left: 30px;">new   TranslationRequest{</div>
<div style="padding-left: 30px;">Query = &#8220;Welcome to my blog&#8221;,</div>
<div style="padding-left: 30px;">SourceLanguage = &#8220;en&#8221;,</div>
<div style="padding-left: 30px;">TargetLanguage = &#8220;es&#8221;</div>
<div style="padding-left: 30px;">})</div>
<div>);</div>
<div>Console.WriteLine(&#8220;{0} = {1}&#8221;, response.SearchedTerms, response.TranslatedTerm);</div>
<div>
<p>Console.ReadLine();</p>
</div>
<div>Output:</div>
<div>Welcome to my blog = Bienvenido a mi blog</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.waltersoto.com/2011/03/21/bing-api-using-the-bing-translator-with-c/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

