Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8129303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:16:02+00:00 2026-06-06T08:16:02+00:00

Previously there the bing translator was easily accessible with the SOAP interface. Now it

  • 0

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.

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.

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<Language>;

            string langstring = "";
            foreach (Language lang in query.EndExecute(result))
            {
                langstring += lang.Code + "\n";
            }
            MessageBox.Show(langstring);
        }
    }
}

In OnQueryComplete() the query 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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:16:03+00:00Added an answer on June 6, 2026 at 8:16 am

    With help from Bing Translator team I got it working in my Silverlight Application:

    1. UseDefaultCredentials needs to be turned off on the proxy

    2. On the async callback, you were casting the result to a DSQ, but it’s the result’s AsyncState that needs to be casted. See below.

      private void Button_Click_1(object sender, RoutedEventArgs e)
      {
          var serviceUri = new Uri("https://api.datamarket.azure.com/Bing/MicrosoftTranslator/");
          var accountKey = "**********************"; // 
          var tcode = new Microsoft.TranslatorContainer(serviceUri);
      
          tcode.Credentials = new NetworkCredential(accountKey, accountKey);
          tcode.UseDefaultCredentials = false;
          var query = tcode.GetLanguagesForTranslation();
          query.BeginExecute(OnQueryComplete, query);
      }
      
      public void OnQueryComplete(IAsyncResult result)
      {
          var query = (DataServiceQuery<Microsoft.Language>)result.AsyncState;
          var enumerableLanguages = query.EndExecute(result);
          string langstring = "";
          foreach (Microsoft.Language lang in enumerableLanguages)
          {
              langstring += lang.Code + "\n";
          }
          MessageBox.Show(langstring);
      }
      

    This way you can use BeginExecute() and BeginEnd() to get Async results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have updated my website. Previously there were links like these: http://example.com/bla-bla-bla?language=de . After
After getting good help previously, I have completed my Minesweeper game. However, there is
Previously I've worked alone... Now I may have many collaborators. But I don't want
I have previously asked two questions Question 1 and Question 2 but there is
I have been learning Prism and Silverlight and am now trying to create a
previously, there is such method for Rectangle in MFC, i dont know why there
is there a way to capture application that was previously active, before my application
Previously,I used the window.showModalDialog() function to popup a window: window.showModalDialog(myHtml) In myHtml,there are some
I implemented Admob in my application previously in 3.x versions of SDk there i
Suppose that we have previously instantiated three objects A, B, C from class D

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.