示例#1
0
        private void OnaddContact_Click(object sender, EventArgs e)
        {
            var form = new ContactForm();

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            if (_database.ExistingContact(form.Contact))
            {
                MessageBox.Show(this, "Contact already exists", "Duplicate Contact", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            else
            {
                _database.Add(form.Contact);
                RefreshContacts();
            };
        }