ConverterCSVDialog.xaml.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using PDF_Office.CustomControl;
  2. using PDF_Office.Helper;
  3. using PDF_Office.ViewModels.Dialog.ConverterDialogs;
  4. using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
  5. using System.Diagnostics;
  6. using System.Linq;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. namespace PDF_Office.Views.Dialog.ConverterDialogs
  10. {
  11. /// <summary>
  12. /// Interaction logic for ConverterCSVDialog
  13. /// </summary>
  14. public partial class ConverterCSVDialog : UserControl
  15. {
  16. public ConverterCSVDialog()
  17. {
  18. InitializeComponent();
  19. }
  20. private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
  21. {
  22. ConverterPreview.document = ((ConverterCSVDialogViewModel)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 = true;
  37. if (PageRangeComboBox.CurrentPage)
  38. {
  39. ComboBoxItem comboBoxItem = new ComboBoxItem();
  40. comboBoxItem.Content = "当前页面";
  41. PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
  42. }
  43. }
  44. }
  45. }