private void button_YoudaoKeyTest_Click(object sender, EventArgs e) { if (TextBoxIsEmpty(groupBox2))// 先判断是否有 没有填的项 { return; } // 先保存数据 // 有道翻译 InitDictionary(changeYoudaoKey: true); if (!Youdao.YoudaoKeyTest()) { return; } try { ConfigFile.WriteFile(config); MessageBox.Show("测试成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("保存到文件失败!\n" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button_YoudaoKeyTest_Click(object sender, EventArgs e) { if (TextBoxIsEmpty(groupBox2))// 先判断是否有 没有填的项 { return; } TextBoxRemoveSpace(groupBox2); // 移除空格 SaveYoudaoKeyToDict(); // 先保存翻译Key if (!Youdao.YoudaoKeyTest()) // 有道翻译 { return; } try { ConfigFile.WriteFile(config); MessageBox.Show("测试成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("保存到文件失败!\n" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }