PasswordDialog.xaml.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace compdfkit_tools.PDFView
  16. {
  17. public partial class PasswordDialog : UserControl
  18. {
  19. public event EventHandler Closed;
  20. public event EventHandler Canceled;
  21. public event EventHandler<string> Confirmed;
  22. public PasswordDialog()
  23. {
  24. InitializeComponent();
  25. }
  26. public void SetShowText(string newText)
  27. {
  28. FileEncryptText.Text = newText;
  29. }
  30. private void PasswordDialogClose_Click(object sender, RoutedEventArgs e)
  31. {
  32. Closed?.Invoke(this, EventArgs.Empty);
  33. }
  34. private void PasswordDialogCancel_Click(object sender, RoutedEventArgs e)
  35. {
  36. Canceled?.Invoke(this, EventArgs.Empty);
  37. }
  38. private void PasswordDialogConfirm_Click(object sender, RoutedEventArgs e)
  39. {
  40. Confirmed?.Invoke(this, PasswordBoxText.Password);
  41. }
  42. public void SetShowError(string errorText, Visibility visible)
  43. {
  44. ErrorTipsText.Text = errorText;
  45. ErrorTipsText.Visibility = visible;
  46. }
  47. public void ClearPassword()
  48. {
  49. PasswordBoxText.Password = string.Empty;
  50. }
  51. }
  52. }