private void DeleteButton_Click(object sender, EventArgs e) { CredentialSet toRemove = this.GetSelectedItemCredentials(); if (toRemove != null) { if ( MessageBox.Show( string.Format("Are you sure you want to delete credential {0}?", toRemove.Name), "Credential manager", MessageBoxButtons.YesNo) == DialogResult.Yes) { StoredCredentials.Remove(toRemove); StoredCredentials.Save(); this.BindList(); } } }
private bool UpdateConflicting(CredentialSet conflicting, CredentialSet oldItem) { DialogResult result = MessageBox.Show("The credential name you entered already exists.\nDo you want to overwrite it?", "Credential manager", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result != DialogResult.Yes) { return(false); } if (oldItem != null) { StoredCredentials.Remove(oldItem); } this.UpdateFromControls(conflicting); return(true); }