123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using PDF_Master.CustomControl;
- using PDF_Master.Helper;
- using PDF_Master.ViewModels.Dialog.HomePageToolsDialogs;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Master.Views.Dialog.HomePageToolsDialogs
- {
- /// <summary>
- /// MainPageInsertDialog.xaml 的交互逻辑
- /// </summary>
- public partial class HomePageInsertDialog : UserControl
- {
- public HomePageInsertDialog()
- {
- InitializeComponent();
- }
- private void PageInsertIndexTextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (this.PageInsertIndexTextBox.Text == "" || int.Parse(this.PageInsertIndexTextBox.Text) < 1)
- {
- this.PageInsertIndexTextBox.Text = "1";
- }
- if (this.PageCountText != null&&this.PageCountText.Text !="")
- {
- if (int.Parse(this.PageInsertIndexTextBox.Text) > int.Parse(this.PageCountText.Text))
- {
- this.PageInsertIndexTextBox.Text = this.PageCountText.Text;
- }
- }
- ((HomePageInsertDialogViewModel)this.DataContext).PageInsertIndex = this.PageInsertIndexTextBox.Text;
- }
- private void CountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
- }
- private void PageTurningPreview_Loaded(object sender, RoutedEventArgs e)
- {
- InsertPreview.document = ((HomePageInsertDialogViewModel)this.DataContext).document;
- char[] enumerationSeparator = new char[] { ',' };
- char[] rangeSeparator = new char[] { '-' };
- if (!CommonHelper.GetPagesInRange(ref InsertPreview.PageIndexLists, "1-" + InsertPreview.document.PageCount.ToString(), InsertPreview.document.PageCount, enumerationSeparator, rangeSeparator))
- { //TODO
- Trace.WriteLine("输入不对");
- MessageBoxEx.Show("输入不对");
- return;
- }
- InsertPreview.AwaitRenderBitmap(InsertPreview.document);
- InsertPreview.PageIndex.Text = InsertPreview.document.PageCount.ToString();
- }
- }
- }
|