private void button1_Click(object sender, EventArgs e) { string voc = comboBox1.Text.ToString(); try { //performTranslate(comboBox1.SelectedItem.ToString()); richTextBox2.Text = FormMain.AddWordToMemory(voc); if (richTextBox2.Text != "") { string webUrl = "http://media.shanbay.com/audio/us/" + voc + ".mp3"; bool judgeSuc = GetWebPr.getpron(webUrl, config.mp3_dir); if (judgeSuc == true) { button7.Visible = true; } button1.Visible = false; button3.Visible = true; label5.Visible = true; button3.Focus(); } else { throw new Exception(); } } catch (Exception) { MessageBox.Show("请选择需要翻译的单词"); } }
private void button2_Click(object sender, EventArgs e) { string voc; if (richTextBox1.Text == "") { MessageBox.Show("请输入单词"); } else { voc = richTextBox1.Text; richTextBox2.Text = FormMain.AddWordToMemory(voc); string webUrl = "http://media.shanbay.com/audio/us/" + voc + ".mp3"; bool judgeSuc = GetWebPr.getpron(webUrl, config.mp3_dir); if (judgeSuc == true) { button6.Visible = true; } button4.Visible = true; button2.Visible = false; label3.Visible = true; button4.Focus(); } }