Ejemplo n.º 1
0
        private void AuthTestBtn_Click(object sender, RoutedEventArgs e)
        {
            Common.appSettings.TXappID  = TransAppIDBox.Text;
            Common.appSettings.TXappKey = TransSecretKeyBox.Text;
            ITranslator Trans = new TencentFYJTranslator();

            Trans.TranslatorInit(TransAppIDBox.Text, TransSecretKeyBox.Text);
            if (Trans.Translate("apple", "zh", "en") != null)
            {
                HandyControl.Controls.Growl.Success("翻译君API工作正常!");
            }
            else
            {
                HandyControl.Controls.Growl.Error("翻译君API工作异常\n" + Trans.GetLastError());
            }
        }
Ejemplo n.º 2
0
        private void TransTestBtn_Click(object sender, RoutedEventArgs e)
        {
            ITranslator Trans = new TencentFYJTranslator();

            Trans.TranslatorInit(Common.appSettings.TXappID, Common.appSettings.TXappKey);
            string res = Trans.Translate(TestSrcText.Text, TestDstLang.Text, TestSrcLang.Text);

            if (res != null)
            {
                HandyControl.Controls.MessageBox.Show(res, "翻译结果");
            }
            else
            {
                HandyControl.Controls.Growl.Error("翻译君API工作异常\n" + Trans.GetLastError());
            }
        }
Ejemplo n.º 3
0
        private async void TransTestBtn_Click(object sender, RoutedEventArgs e)
        {
            ITranslator Trans = new TencentFYJTranslator();

            Trans.TranslatorInit(Common.appSettings.TXappID, Common.appSettings.TXappKey);
            string res = await Trans.TranslateAsync(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()}");
            }
        }
Ejemplo n.º 4
0
        private async void AuthTestBtn_Click(object sender, RoutedEventArgs e)
        {
            Common.appSettings.TXappID  = TransAppIDBox.Text;
            Common.appSettings.TXappKey = TransSecretKeyBox.Text;
            ITranslator Trans = new TencentFYJTranslator();

            Trans.TranslatorInit(TransAppIDBox.Text, TransSecretKeyBox.Text);
            if (await Trans.TranslateAsync("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 AuthTestBtn_Click(object sender, RoutedEventArgs e)
        {
            Common.appSettings.TXappID  = TransAppIDBox.Text;
            Common.appSettings.TXappKey = TransSecretKeyBox.Text;
            ITranslator Trans = new TencentFYJTranslator();

            Trans.TranslatorInit(TransAppIDBox.Text, TransSecretKeyBox.Text);
            if (Trans.Translate("apple", "zh", "en") != null)
            {
                HandyControl.Controls.Growl.Success("翻译君" + App.Current.Resources["APITest_Success_Hint"].ToString());
            }
            else
            {
                HandyControl.Controls.Growl.Error("翻译君" + App.Current.Resources["APITest_Error_Hint"].ToString() + "\n" + Trans.GetLastError());
            }
        }