Example #1
0
        //new contact
        private void OnContactsNew(object sender, EventArgs e)
        {
            var form = new NewContactForm();

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            _database.AddContact(form.Contact);
            RefreshContact();
        }
Example #2
0
        //helpers
        private void EditContact()
        {
            var item = GetSelectedContact();

            if (item == null)
            {
                return;
            }

            var form = new NewContactForm();

            form.Contact = item;
            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            _database.EditContact(item.Name, form.Contact);
            RefreshContact();
        }