예제 #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            // Create new email entry for list
            emailAddress newEmail = new emailAddress();

            // create mail entry form and pass newEmail reference
            EmailInput emailInput = new EmailInput();

            emailInput.ShowDialog(ref newEmail);

            // Process new entry if newEmail != null
            if (newEmail.address != null)
            {
                parentForm.home.email.emailAddresses.Add(newEmail.address, newEmail.canSendCommands, newEmail.notifyWithUpdates);
                emailListBox.DataSource = parentForm.home.email.emailAddresses.getAllEmailAddresses();
            }
        }
예제 #2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Create new email entry for list
                emailAddress curEmail = parentForm.home.email.emailAddresses.emailList[emailListBox.SelectedIndex];
                emailAddress newEmail = curEmail;

                // create mail entry form and pass newEmail reference
                EmailInput emailInput = new EmailInput();
                emailInput.ShowDialog(ref newEmail);

                // Process new entry if newEmail != curEmail
                if ((newEmail.address != curEmail.address) || (newEmail.canSendCommands != curEmail.canSendCommands) || (newEmail.notifyWithUpdates != curEmail.notifyWithUpdates))
                {
                    //string message = "Are you sure you would like to edit " + curEmail + " to " + newEmail + "?";
                    //string caption = "Confirm Email Edit";
                    //MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    //DialogResult result;

                    //result = MessageBox.Show(message, caption, buttons);

                    //if (result == DialogResult.Yes)
                    //{

                    //emailList.emailList[emailListBox.SelectedIndex] = newEmail;
                    parentForm.home.email.emailAddresses.emailList[emailListBox.SelectedIndex] = newEmail;
                    emailListBox.DataSource = parentForm.home.email.emailAddresses.getAllEmailAddresses();
                    //}
                }
            }
            catch
            {
                MessageBox.Show("There are no emails to edit!");
            }
        }