ConverterTextDialog.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using PDF_Master.CustomControl;
  2. using PDF_Master.Helper;
  3. using PDF_Master.ViewModels.Dialog.ConverterDialogs;
  4. using System.Diagnostics;
  5. using System.Linq;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. namespace PDF_Master.Views.Dialog.ConverterDialogs
  9. {
  10. /// <summary>
  11. /// Interaction logic for ConverterTxtDialog
  12. /// </summary>
  13. public partial class ConverterTextDialog : UserControl
  14. {
  15. public ConverterTextDialog()
  16. {
  17. InitializeComponent();
  18. }
  19. private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
  20. {
  21. ConverterPreview.document = ((ConverterTextDialogViewModel)this.DataContext).currentViewer.Document;
  22. char[] enumerationSeparator = new char[] { ',' };
  23. char[] rangeSeparator = new char[] { '-' };
  24. if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, "1-" + ConverterPreview.document.PageCount.ToString(), ConverterPreview.document.PageCount, enumerationSeparator, rangeSeparator))
  25. { //TODO
  26. Trace.WriteLine("输入不对");
  27. MessageBoxEx.Show("输入不对");
  28. return;
  29. }
  30. ConverterPreview.AwaitRenderBitmap(ConverterPreview.document);
  31. ConverterPreview.PageIndex.Text = ConverterPreview.document.PageCount.ToString();
  32. }
  33. private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
  34. {
  35. PageRangeComboBox.CurrentPage = true;
  36. if (PageRangeComboBox.CurrentPage)
  37. {
  38. ComboBoxItem comboBoxItem = new ComboBoxItem();
  39. comboBoxItem.Content = "当前页面";
  40. PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
  41. }
  42. }
  43. }
  44. }