1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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
- {
- /// <summary>
- /// Interaction logic for PasswordDialog.xaml
- /// </summary>
- 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;
- }
- }
- }
|