Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use the Microsoft Translator API over Windows Azure, for Windows Phone?
    text
    copied!<p>Previously there the bing translator was easily accessible with the SOAP interface. Now it has been migrated to Windows Azure. I have registered in the Azure marketplace for 10000 letters per month (free). How can I translate text through the translator api, for windows phone in C#? Please help. I am not sure how to use the BeginExecute and EndExecute for queries. </p> <p>I have downloaded and added the TranslatorContainer.cs to my project. For now I am just trying to get the Languages with the GetLanguagesForTranslation method. This is the code which I have written. </p> <pre><code>public partial class PhonePage1 : PhoneApplicationPage { public PhonePage1() { InitializeComponent(); Translator transInstance = new Translator(); } class Translator { private Uri service_root; private TranslatorContainer context; public Translator() { service_root = new Uri("https://api.datamarket.azure.com/Bing/MicrosoftTranslator/"); context = new TranslatorContainer(service_root); context.Credentials = new NetworkCredential("ID","..........."); var query = context.GetLanguagesForTranslation(); query.BeginExecute(OnQueryComplete, query); } public void OnQueryComplete(IAsyncResult result) { var query = result as DataServiceQuery&lt;Language&gt;; string langstring = ""; foreach (Language lang in query.EndExecute(result)) { langstring += lang.Code + "\n"; } MessageBox.Show(langstring); } } } </code></pre> <p>In OnQueryComplete() the <code>query</code> is null even after the assignment. The result has the Properties IsCompleted as true, and statusCode is OK. I am not able to figure out how to go about this. Please help. Thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload