ConverterHTMLDialog.xaml.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 ConverterHTMLDialog
  12. /// </summary>
  13. public partial class ConverterHTMLDialog : UserControl
  14. {
  15. public ConverterHTMLDialog()
  16. {
  17. InitializeComponent();
  18. }
  19. private void ConverterPreview_Loaded(object sender, System.Windows.RoutedEventArgs e)
  20. {
  21. ConverterPreview.document = ((ConverterHTMLDialogViewModel)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. AlertsMessage alertsMessage = new AlertsMessage();
  28. alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
  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 = App.MainPageLoader.GetString("WritableComboBox_CurrentPage");
  41. PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
  42. }
  43. }
  44. }
  45. }