ConverterExcelDialog.xaml.cs 1.9 KB

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