private void LblPasswordDoubleClick(object sender, EventArgs e) { if (this.txtPassword.PasswordChar == '\0') { this.ResetLastString(); } else { this.lastString = this.txtPassword.Text; if (this.lastString == CredentialPanel.HIDDEN_PASSWORD) { this.txtPassword.Text = StoredCredentials.GetByName(this.editedCredentialName).SecretKey; if (!string.IsNullOrEmpty(StoredCredentials.GetByName(this.editedCredentialName).SecretKey)) { Clipboard.SetText(StoredCredentials.GetByName(this.editedCredentialName).SecretKey); } } this.txtPassword.PasswordChar = '\0'; this.reset = true; this.timer = new Timer(); this.timer.Tick += delegate { this.ResetLastString(); }; this.timer.Interval = 3000; this.timer.Enabled = true; this.timer.Start(); } }
private void setCredentialByTagToolStripMenuItem_Click(object sender, EventArgs e) { String tagName = this.TreeView.SelectedNode.Name; string input = "Set Credential by Tag\r\n\r\nThis will replace the credential used for all Favorites within this tag.\r\n\r\nUse at your own risk!"; if (InputBox.Show(ref input, "Change Credential" + " - " + tagName) == DialogResult.OK) { CredentialSet credentialSet = StoredCredentials.GetByName(input); if (credentialSet == null) { MessageBox.Show("The credential you specified does not exist."); return; } this.GetMainForm().Cursor = Cursors.WaitCursor; Application.DoEvents(); List <FavoriteConfigurationElement> selectedFavorites = this.GetSelectedFavorites(); Settings.ApplyCredentialsForAllSelectedFavorites(selectedFavorites, credentialSet.Name); this.GetMainForm().Cursor = Cursors.Default; Application.DoEvents(); MessageBox.Show("Set Credential by Tag Complete."); } }
private CredentialSet GetSelectedItemCredentials() { if (this.CredentialsListView.SelectedItems != null && this.CredentialsListView.SelectedItems.Count > 0) { string name = this.CredentialsListView.SelectedItems[0].Text; return(StoredCredentials.GetByName(name)); } return(null); }
private void connectAsCred_Click(object sender, EventArgs e) { FavoriteConfigurationElement fav = this.TreeView.SelectedFavorite; if (fav != null) { this.GetMainForm().Connect(fav.Name, this.consoleToolStripMenuItem.Checked, this.newWindowToolStripMenuItem.Checked, fav.IsDatabaseFavorite, StoredCredentials.GetByName(sender.ToString()), true); } }
private bool UpdateCredential() { CredentialSet conflicting = StoredCredentials.GetByName(this.txtName.Text); CredentialSet oldItem = StoredCredentials.GetByName(this.editedCredentialName); if (conflicting != null && this.editedCredentialName != this.txtName.Text) { return(this.UpdateConflicting(conflicting, oldItem)); } this.UpdateOldOrCreateNew(oldItem); return(true); }
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(); }
private void ResetLastString() { this.txtPassword.PasswordChar = CredentialPanel.HIDDEN_PASSWORD_CHAR; this.reset = false; if (this.timer != null) { this.timer.Stop(); this.timer = null; } if (string.IsNullOrEmpty(this.lastString)) { this.lastString = StoredCredentials.GetByName(this.editedCredentialName).SecretKey; } this.txtPassword.Text = this.lastString; }