/// <summary> /// Creates an instance of PasswordDialog and uses it to obtain the user's password. /// </summary> /// <returns>Returns the user's password as entered, or null if he/she clicked Cancel.</returns> public static string GetPassword() { PasswordDialogWpf dialog = new PasswordDialogWpf(); dialog.passwordBox.Focus(); dialog.ShowDialog(); if (dialog.DialogResult == true) { return dialog.passwordBox.Password; } else { return null; } }
/// <summary> /// Creates an instance of PasswordDialog and uses it to obtain the user's password. /// </summary> /// <returns>Returns the user's password as entered, or null if he/she clicked Cancel.</returns> public static string GetPassword() { PasswordDialogWpf dialog = new PasswordDialogWpf(); dialog.passwordBox.Focus(); dialog.ShowDialog(); if (dialog.DialogResult == true) { return(dialog.passwordBox.Password); } else { return(null); } }