using PDF_Office.CustomControl; using PDF_Office.Helper; using PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs; using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs; using PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; 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; using System.Xml.Linq; namespace PDF_Office.Views.Dialog.HomePageToolsDialogs { /// /// MainPageSplitDialog.xaml 的交互逻辑 /// public partial class HomePageSplitDialog : UserControl { public HomePageSplitDialog() { InitializeComponent(); } private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { TextBox textBox = sender as TextBox; switch (textBox.Name.ToString()) { case "FileNameLabelTextBox": { ((HomePageSplitDialogViewModel)this.DataContext).FileNameLabelText = FileNameLabelTextBox.Text; ((HomePageSplitDialogViewModel)this.DataContext).FileNameLabelChangeCommand.Execute(); } break; case "FileNameDeimiterTextBox": { ((HomePageSplitDialogViewModel)this.DataContext).FileNameDeimiterText = FileNameDeimiterTextBox.Text; ((HomePageSplitDialogViewModel)this.DataContext).FileNameDeimiterChangeCommand.Execute(); } break; default: break; } } private void PageTurningPreview_Loaded(object sender, RoutedEventArgs e) { SplitPreview.document = ((HomePageSplitDialogViewModel)this.DataContext).document; char[] enumerationSeparator = new char[] { ',' }; char[] rangeSeparator = new char[] { '-' }; if (!CommonHelper.GetPagesInRange(ref SplitPreview.PageIndexLists, "1-" + SplitPreview.document.PageCount.ToString(), SplitPreview.document.PageCount, enumerationSeparator, rangeSeparator)) { //TODO Trace.WriteLine("输入不对"); MessageBoxEx.Show("输入不对"); return; } SplitPreview.AwaitRenderBitmap(SplitPreview.document); SplitPreview.PageIndex.Text = SplitPreview.document.PageCount.ToString(); } } }