コード例 #1
0
        /// <summary>
        /// Send an email to the selected contact
        /// </summary>
        private void sendEmailToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = contactsListBox.SelectedIndex;

            if (index == -1)
            {
                MessageBox.Show("Select first a contact from the list.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string        name    = contactsListBox.SelectedItem.ToString();
            PersonContact contact = (PersonContact)contactsList.FindContact(name);

            EmailForm form = new EmailForm(contact);

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            messagingService.Send(contact.EmailAddress, form.Subject, form.Message);
        }