Exemplo n.º 1
0
        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();
                }
            }
        }
Exemplo n.º 2
0
        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);
        }