Beispiel #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTemplateName.Text == string.Empty)
                {
                    txtTemplateName.Select();
                    MessageBox.Show("Please input the Template name!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (ConfigCtrl.IsTemplateExist(txtTemplateName.Text))
                {
                    txtTemplateName.Select();
                    MessageBox.Show("The template has already existed!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ConfigCtrl.AddTemplate(txtTemplateName.Text);

                _newtemplatename = txtTemplateName.Text;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }