ConverterRTFDialog.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using PDF_Master.CustomControl;
  2. using PDF_Master.Helper;
  3. using PDF_Master.ViewModels.Dialog.ConverterDialogs;
  4. using System.Collections.Generic;
  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 ConverterRTFDialog
  13. /// </summary>
  14. public partial class ConverterRTFDialog : UserControl
  15. {
  16. public ConverterRTFDialog()
  17. {
  18. InitializeComponent();
  19. }
  20. private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
  21. {
  22. ConverterPreview.document = ((ConverterRTFDialogViewModel)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. }