HomePageSplitDialog.xaml.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using PDF_Master.CustomControl;
  2. using PDF_Master.Helper;
  3. using PDF_Master.Model.Dialog.ToolsDialogs.SaftyDialogs;
  4. using PDF_Master.ViewModels.Dialog.HomePageToolsDialogs;
  5. using PDF_Master.ViewModels.Dialog.ToolsDialogs.SaftyDialogs;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using System.Windows.Controls;
  14. using System.Windows.Data;
  15. using System.Windows.Documents;
  16. using System.Windows.Input;
  17. using System.Windows.Media;
  18. using System.Windows.Media.Imaging;
  19. using System.Windows.Navigation;
  20. using System.Windows.Shapes;
  21. using System.Xml.Linq;
  22. namespace PDF_Master.Views.Dialog.HomePageToolsDialogs
  23. {
  24. /// <summary>
  25. /// MainPageSplitDialog.xaml 的交互逻辑
  26. /// </summary>
  27. public partial class HomePageSplitDialog : UserControl
  28. {
  29. public HomePageSplitDialog()
  30. {
  31. InitializeComponent();
  32. }
  33. private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
  34. {
  35. TextBox textBox = sender as TextBox;
  36. switch (textBox.Name.ToString())
  37. {
  38. case "FileNameLabelTextBox":
  39. {
  40. ((HomePageSplitDialogViewModel)this.DataContext).FileNameLabelText = FileNameLabelTextBox.Text;
  41. ((HomePageSplitDialogViewModel)this.DataContext).FileNameLabelChangeCommand.Execute();
  42. }
  43. break;
  44. case "FileNameDeimiterTextBox":
  45. {
  46. ((HomePageSplitDialogViewModel)this.DataContext).FileNameDeimiterText = FileNameDeimiterTextBox.Text;
  47. ((HomePageSplitDialogViewModel)this.DataContext).FileNameDeimiterChangeCommand.Execute();
  48. }
  49. break;
  50. default:
  51. break;
  52. }
  53. }
  54. private void PageTurningPreview_Loaded(object sender, RoutedEventArgs e)
  55. {
  56. SplitPreview.document = ((HomePageSplitDialogViewModel)this.DataContext).document;
  57. char[] enumerationSeparator = new char[] { ',' };
  58. char[] rangeSeparator = new char[] { '-' };
  59. if (!CommonHelper.GetPagesInRange(ref SplitPreview.PageIndexLists, "1-" + SplitPreview.document.PageCount.ToString(), SplitPreview.document.PageCount, enumerationSeparator, rangeSeparator))
  60. { //TODO
  61. Trace.WriteLine("输入不对");
  62. MessageBoxEx.Show("输入不对");
  63. return;
  64. }
  65. SplitPreview.AwaitRenderBitmap(SplitPreview.document);
  66. SplitPreview.PageIndex.Text = SplitPreview.document.PageCount.ToString();
  67. }
  68. }
  69. }