示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            String newTag = tbTag.Text.Trim().ToLower();

            if (String.IsNullOrEmpty(newTag))
            {
                MessageBox.Show(Resources.Labels.EmptyTagNotAllowed, Resources.Labels.TagRenameErrorTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                if ((!tag.Equals(newTag)) && (!keeper.RenameTag(tag, newTag)))
                {
                    MessageBox.Show(String.Format(Resources.Labels.TagAlreadyExistFormat, newTag), Resources.Labels.TagRenameErrorTitle,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }