#region using System; using System.Windows.Forms; #endregion namespace CSFrameworkV5.Language { public partial class frmBaiduTrans : Form { private bool _OK; private frmBaiduTrans() { InitializeComponent(); } private void btnTran_Click(object sender, EventArgs e) { if (txtLanTo.Text != "") { _OK = true; Close(); } else { txtLanTo.Focus(); } } public static string Execute() { var form = new frmBaiduTrans(); form.ShowDialog(); return form.GetTargetLan(); } private void frmBaiduTrans_Load(object sender, EventArgs e) { txtLanFrom.Text = "中文简体"; txtLanTo.Text = "英文"; } private string GetTargetLan() { if (_OK) { if (txtLanTo.Text == "中文繁体") return "cht"; if (txtLanTo.Text == "英文") return "en"; if (txtLanTo.Text == "越南文") return "vie"; } return ""; } } }