public void InitPassword(PasswordSetting password) { if (password != null && password.IsDecrypted && !string.IsNullOrEmpty(password.Value)) { PasswordTextBox.Text = DummyPassword; PasswordChanged = false; } else { PasswordTextBox.Text = string.Empty; } }
private void EditButton_Click(object sender, EventArgs e) { int selectedIndex = _credentialsListBox.SelectedIndex; if (selectedIndex != -1) { CredentialsProfile credentialsProfile = _credentialsListBox.Items[selectedIndex] as CredentialsProfile; using (LogonSettingsDialog logonSettingsDialog = LogonSettingsDialog.NewEditCredentialsDialog(credentialsProfile)) { if (logonSettingsDialog.ShowDialog() == DialogResult.OK) { PasswordSetting password = logonSettingsDialog.PasswordChanged ? logonSettingsDialog.Password : credentialsProfile.Password; credentialsProfile = new CredentialsProfile(credentialsProfile.ProfileName, credentialsProfile.ProfileScope, logonSettingsDialog.UserName, password, logonSettingsDialog.Domain); _credentialsStore[credentialsProfile.ProfileName] = credentialsProfile; _credentialsListBox.Items[selectedIndex] = credentialsProfile; } } } }