Esempio n. 1
0
        static SearchRequest BuildRequest(string  fromLang, string toLang, string query)
        {
            SearchRequest request = new SearchRequest();

            // Common request fields (required)
            request.AppId = APP_ID;
            request.Query =query;
            request.Sources = new SourceType[] { SourceType.Translation };

            // SourceType-specific fields (required)
            request.Translation = new TranslationRequest();
            request.Translation.SourceLanguage = fromLang;
            request.Translation.TargetLanguage = toLang;

            // Common request fields (optional)
            request.Version = "2.2";

            return request;
        }
Esempio n. 2
0
 /// <remarks/>
 public void SearchAsync(SearchRequest parameters, object userState) {
     if ((this.SearchOperationCompleted == null)) {
         this.SearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSearchOperationCompleted);
     }
     this.InvokeAsync("Search", new object[] {
                 parameters}, this.SearchOperationCompleted, userState);
 }
Esempio n. 3
0
 /// <remarks/>
 public void SearchAsync(SearchRequest parameters) {
     this.SearchAsync(parameters, null);
 }
Esempio n. 4
0
 public SearchResponse Search(SearchRequest parameters) {
     object[] results = this.Invoke("Search", new object[] {
                 parameters});
     return ((SearchResponse)(results[0]));
 }