Beispiel #1
0
        /// <summary>
        ///     Добавление контакта.
        /// </summary>
        private void AddContact()
        {
            var addForm = new ContactForm();

            if (addForm.ShowDialog() == DialogResult.OK)
            {
                _project.List.Add(addForm.Contact);

                ProjectSave();
            }

            FindTextBoxCheck();
            ContactsListBox.SelectedItem = addForm.Contact;
        }
Beispiel #2
0
        /// <summary>
        ///     Редактирования контакта.
        /// </summary>
        private void EditContact()
        {
            if (ContactsListBox.SelectedIndex == -1)
            {
                return;
            }

            var selectedContact = (Contact)ContactsListBox.SelectedItem;

            var editForm = new ContactForm {
                Contact = selectedContact
            };

            if (editForm.ShowDialog() == DialogResult.OK)
            {
                _project.List.Remove(selectedContact);
                _project.List.Add(editForm.Contact);
                ProjectSave();
            }

            FindTextBoxCheck();
            ContactsListBox.SelectedItem = editForm.Contact;
        }