using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace InABox.Wpf.Editors { /// /// Interaction logic for PasswordDialog.xaml /// public partial class PasswordDialog : ThemableWindow { public PasswordDialog(string caption, string password = "") { InitializeComponent(); Title = caption; PasswordEditor.Password = password; } public string Password { get => PasswordEditor.Password; set => PasswordEditor.Password = value; } private void OK_Click(object sender, RoutedEventArgs e) { DialogResult = true; Close(); } private void Cancel_Click(object sender, RoutedEventArgs e) { DialogResult = false; Close(); } public static bool Execute(string caption, ref string password) { var editor = new PasswordDialog(caption, password); if (editor.ShowDialog() == true) { password = editor.Password; return true; } return false; } } }