示例#1
0
        private void TransTestBtn_Click(object sender, RoutedEventArgs e)
        {
            ITranslator Trans = new DreyeTranslator();

            Trans.TranslatorInit(Common.appSettings.DreyePath, "");
            string res = Trans.Translate(TestSrcText.Text, "zh", TestSrcLang.Text);

            if (res != null)
            {
                HandyControl.Controls.MessageBox.Show(res, "翻译结果");
            }
            else
            {
                HandyControl.Controls.Growl.Error("译典通翻译API工作异常\n" + Trans.GetLastError());
            }
        }
示例#2
0
        private void TransTestBtn_Click(object sender, RoutedEventArgs e)
        {
            ITranslator Trans = new DreyeTranslator();

            Trans.TranslatorInit(Common.appSettings.DreyePath, "");
            string res = Trans.Translate(TestSrcText.Text, "zh", 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()}");
            }
        }