private void AuthTestBtn_Click(object sender, RoutedEventArgs e) { Common.appSettings.xiaoniuApiKey = TransTokenBox.Text; ITranslator Trans = new XiaoniuTranslator(); Trans.TranslatorInit(TransTokenBox.Text, ""); if (Trans.Translate("apple", "zh", "en") != null) { HandyControl.Controls.Growl.Success($"小牛翻译{Application.Current.Resources["APITest_Success_Hint"]}"); } else { HandyControl.Controls.Growl.Error($"小牛翻译{Application.Current.Resources["APITest_Error_Hint"]}\n{Trans.GetLastError()}"); } }
private void TransTestBtn_Click(object sender, RoutedEventArgs e) { ITranslator Trans = new XiaoniuTranslator(); Trans.TranslatorInit(Common.appSettings.xiaoniuApiKey, ""); string res = Trans.Translate(TestSrcText.Text, TestDstLang.Text, TestSrcLang.Text); if (res != null) { HandyControl.Controls.MessageBox.Show(res, Application.Current.Resources["MessageBox_Result"].ToString()); } else { HandyControl.Controls.Growl.Error($"小牛翻译{Application.Current.Resources["APITest_Error_Hint"]}\n{Trans.GetLastError()}"); } }