예제 #1
0
        private void SaveCredentials(Dictionary <string, vRDConfigurationFileCredentialsFolderCredentials> credentials)
        {
            foreach (string guid in credentials.Keys)
            {
                vRDConfigurationFileCredentialsFolderCredentials toImport = credentials[guid];
                //will store the last one if the same credential name
                CredentialSet destination = StoredCredentials.GetByName(toImport.Name);
                if (destination == null)
                {
                    destination = new CredentialSet();
                    StoredCredentials.Add(destination);
                }

                UpdateFromvrDCredentials(toImport, destination);
            }

            StoredCredentials.Save();
        }
예제 #2
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();
                }
            }
        }
예제 #3
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtName.Text) || string.IsNullOrEmpty(this.txtUserName.Text))
            {
                MessageBox.Show("You must enter both a name and a user name for the credential.",
                                "Credential manager",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.txtName.Focus();
                return;
            }

            if (this.reset)
            {
                this.ResetLastString();
            }

            if (this.UpdateCredential())
            {
                StoredCredentials.Save();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }