PasswordCallbackFactory(string message) { SecureString passphrase = null; return(new KeyFormatter.GetPassphraseCallback(delegate(string comment) { if (passphrase == null) { var dialog = new PasswordDialog(); dialog.Text = message; if (!string.IsNullOrWhiteSpace(comment)) { dialog.Text += string.Format(" ({0})", comment); } var result = dialog.ShowDialog(); if (result != DialogResult.OK) { return null; } passphrase = dialog.SecureEdit.SecureString; } return passphrase; })); }
public static KeyFormatter.GetPassphraseCallback PasswordCallbackFactory(string message) { SecureString passphrase = null; return new KeyFormatter.GetPassphraseCallback(delegate(string comment) { if (passphrase == null) { var dialog = new PasswordDialog(); dialog.Text = message; if (!string.IsNullOrWhiteSpace(comment)) { dialog.Text += string.Format(" ({0})", comment); } var result = dialog.ShowDialog(); if (result != DialogResult.OK) { return null; } passphrase = dialog.SecureEdit.SecureString; } return passphrase; }); }