private void client_TranslateCompleted(object sender, TranslateCompletedEventArgs e) { phrase.TranslatedPhrase = e.Result; // If Chinese, generate pinyin if (phrase.TranslatedPhraseLanguage == Language.Chinese.GetStringValue()) { HttpWebRequest request = WebRequest.Create(new System.Uri(string.Format("http://www.popupchinese.com/adso/pinyin.php?text={0}", e.Result))) as HttpWebRequest; request.BeginGetResponse(new AsyncCallback(SavePinyin), request); } else { HttpWebRequest request = WebRequest.Create(new System.Uri(string.Format("http://www.popupchinese.com/adso/pinyin.php?text={0}", phrase.Phrase))) as HttpWebRequest; request.BeginGetResponse(new AsyncCallback(SavePinyin), request); } }
private static void TranslateCompleted(object sender, TranslateCompletedEventArgs e) { string errorStatus = (e.Error != null ? e.Error.Message : null); if (errorStatus != null) { //MessageBoxEx.ShowOK("Translate Error", errorStatus, null); return; } var element = e.UserState; if (element is ContentControl) { ContentControl contentControl = e.UserState as ContentControl; if (contentControl != null) contentControl.Content = e.Result; } else if (element is TextBlock) { TextBlock textBlock = e.UserState as TextBlock; if (textBlock != null) textBlock.Text = e.Result; } else if (element is TextBox) { TextBox textBox = e.UserState as TextBox; if (textBox != null) textBox.Text = e.Result; } }
private void Ter_TranslateCompleted(object sender, TranslateCompletedEventArgs e) { throw new NotImplementedException(); }
private void translator_TranslateCompleted(object sender, TranslateCompletedEventArgs e) { TranslateComplete(this, new TranslatedEventArgs<List<string>>(new List<string> { e.Result }, true, e.UserState)); }