SignatureAnnotProperty.xaml.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using PDF_Master.CustomControl;
  2. using PDF_Master.Helper;
  3. using PDF_Master.Model.AnnotPanel;
  4. using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace PDF_Master.Views.PropertyPanel.AnnotPanel
  20. {
  21. /// <summary>
  22. /// SignatureAnnotProperty.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class SignatureAnnotProperty : UserControl
  25. {
  26. public SignatureAnnotProperty()
  27. {
  28. InitializeComponent();
  29. //KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
  30. //KeyEventsHelper.KeyDown += ShortCut_KeyDown;
  31. }
  32. private void ShortCut_KeyDown(object sender, KeyEventArgs e)
  33. {
  34. if (e.Key == Key.Escape)
  35. {
  36. (DataContext as SignatureAnnotPropertyViewModel).Close();
  37. e.Handled = true;
  38. }
  39. }
  40. private void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
  41. {
  42. (DataContext as SignatureAnnotPropertyViewModel).SetSignature((sender as ListBoxItem).DataContext as Signature);
  43. }
  44. private void Save_Click(object sender, RoutedEventArgs e)
  45. {
  46. MenuItem item = sender as MenuItem;
  47. (DataContext as SignatureAnnotPropertyViewModel).SaveToPath(item.Tag.ToString(), item.DataContext as Signature);
  48. }
  49. private void Delete_Click(object sender, RoutedEventArgs e)
  50. {
  51. MenuItem item = sender as MenuItem;
  52. (DataContext as SignatureAnnotPropertyViewModel).DeleteSignature(item.DataContext as Signature);
  53. }
  54. private void DeleteAll_Click(object sender, RoutedEventArgs e)
  55. {
  56. AlertsMessage alertsMessage = new AlertsMessage();
  57. alertsMessage.ShowDialog("", App.MainPageLoader.GetString("Signature_deleteAllWarning"), App.ServiceLoader.GetString("Text_cancel"), App.ServiceLoader.GetString("Text_ok"));
  58. if (alertsMessage.result == ContentResult.Ok)
  59. {
  60. (DataContext as SignatureAnnotPropertyViewModel).DeleteAll();
  61. }
  62. }
  63. private void UserControl_KeyDown(object sender, KeyEventArgs e)
  64. {
  65. if (e.Key == Key.Escape)
  66. {
  67. (DataContext as SignatureAnnotPropertyViewModel).Close();
  68. e.Handled = true;
  69. }
  70. }
  71. private void UserControl_Loaded(object sender, RoutedEventArgs e)
  72. {
  73. TxtTitle.Text = App.MainPageLoader.GetString("Signatur_Title");
  74. }
  75. }
  76. }