SignatureAnnotProperty.xaml.cs 2.4 KB

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