private void btnOk_Click(object sender, EventArgs e) { try { if (txtModuleName.Text == string.Empty) { txtModuleName.Select(); MessageBox.Show("Please input the module name!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ConfigCtrl.IsModuleExist(_template, txtModuleName.Text)) { txtModuleName.Select(); MessageBox.Show("The module has already existed!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ConfigCtrl.AddModule(_template, txtModuleName.Text); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }