BottomToolContent.xaml.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace PDF_Master.Views
  17. {
  18. /// <summary>
  19. /// BottomToolContent.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class BottomToolContent : UserControl
  22. {
  23. public BottomToolContent()
  24. {
  25. InitializeComponent();
  26. }
  27. private void SetSinglePageCommand_Executed(object sender, ExecutedRoutedEventArgs e)
  28. {
  29. this.SinglePage_Btn.IsChecked = true;
  30. this.DoublePage_Btn.IsChecked = false;
  31. }
  32. private void SetDoublePageCommand_Executed(object sender, ExecutedRoutedEventArgs e)
  33. {
  34. this.SinglePage_Btn.IsChecked = false;
  35. this.DoublePage_Btn.IsChecked = true;
  36. }
  37. private void TextBoxEx_PreviewTextInput(object sender, TextCompositionEventArgs e)
  38. {
  39. Regex regex = new Regex("[^0-9^%]+"); // 限制仅允许数字和百分号
  40. e.Handled = regex.IsMatch(e.Text);
  41. }
  42. }
  43. }