private void btnAddProfile_Click(object sender, EventArgs e) { // Make sure the email is valid if (SGGlobals.IsEmailValid(txtDefaultAddress.Text) == false) { MessageBox.Show("Email address does not appear to be valid!", "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Make sure the profile doesn't exist try { UserProfiles.GetProfileByName(txtProfileName.Text); // Profile exists! MessageBox.Show("Profile name already exists!", "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } catch (ProfileNotFoundException) { // Profile does not exist, create it Profile objNewProfile = new Profile(); objNewProfile.Name = txtProfileName.Text; objNewProfile.ToAddresses.Add(txtDefaultAddress.Text); objNewProfile.Save(); this._objDialogStatus = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("An unknown error occured creating the new profile:" + Environment.NewLine + ex.Message, "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddBcc_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtAddBcc.Text) == false) { // Make sure the email is valid if (SGGlobals.IsEmailValid(txtAddBcc.Text) == false) { MessageBox.Show("Email address does not appear to be valid!", "Error creating profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } lstBccAddresses.Items.Add(txtAddBcc.Text); txtAddBcc.Text = ""; } SyncBccAddresses(); }