Browse Source

Merge branch 'dev' into practice2

OYXH\oyxh 2 years ago
parent
commit
aa3df3d771
68 changed files with 5044 additions and 149 deletions
  1. 8 7
      .gitignore
  2. 15 1
      PDF Office/App.xaml.cs
  3. 28 0
      PDF Office/CustomControl/NumericUpDown.xaml
  4. 95 0
      PDF Office/CustomControl/NumericUpDown.xaml.cs
  5. 27 0
      PDF Office/CustomControl/PageTurningPreview.xaml
  6. 136 0
      PDF Office/CustomControl/PageTurningPreview.xaml.cs
  7. 22 0
      PDF Office/CustomControl/WritableComboBox.xaml
  8. 109 0
      PDF Office/CustomControl/WritableComboBox.xaml.cs
  9. 29 0
      PDF Office/DataConvert/UnVisivleConvert.cs
  10. 153 0
      PDF Office/Helper/HomePageEditHelper.cs
  11. 134 0
      PDF Office/Helper/PictureConverter.cs
  12. 28 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageExtractDialogModel.cs
  13. 23 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageInsertDialogModel.cs
  14. 58 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogModel.cs
  15. 174 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogModel.cs
  16. 61 0
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageSplitDialogModel.cs
  17. 33 5
      PDF Office/Model/DialogNames.cs
  18. 28 0
      PDF Office/Model/HomePageToolsDialogs/HomePageExtractDialogModel.cs
  19. 22 0
      PDF Office/Model/HomePageToolsDialogs/HomePageInsertDialogModel.cs
  20. 58 0
      PDF Office/Model/HomePageToolsDialogs/HomePageSplitDialogModel.cs
  21. 28 0
      PDF Office/Model/MainPageToolsDialogs/MainPageExtractDialogModel.cs
  22. 26 0
      PDF Office/Model/MainPageToolsDialogs/MainPageInsertDialogModel.cs
  23. 44 0
      PDF Office/Model/MainPageToolsDialogs/MainPageSplitDialogModel.cs
  24. 108 6
      PDF Office/PDF Office.csproj
  25. 268 0
      PDF Office/UpgradeLog2.htm
  26. 268 0
      PDF Office/UpgradeLog3.htm
  27. 169 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageExtractDialogViewModel.cs
  28. 218 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageInsertDialogViewModel.cs
  29. 425 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs
  30. 416 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs
  31. 30 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContentViewModel.cs
  32. 30 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContentViewModel.cs
  33. 27 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContentViewModel.cs
  34. 29 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs
  35. 35 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialogViewModel.cs
  36. 461 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageSplitDialogViewModel.cs
  37. 94 55
      PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs
  38. 0 1
      PDF Office/ViewModels/ViewContentViewModel.cs
  39. 0 9
      PDF Office/Views/Dialog/CompressWindow.xaml
  40. 0 15
      PDF Office/Views/Dialog/CompressWindow.xaml.cs
  41. 70 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageExtractDialog.xaml
  42. 37 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageExtractDialog.xaml.cs
  43. 86 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageInsertDialog.xaml
  44. 59 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageInsertDialog.xaml.cs
  45. 156 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml
  46. 90 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml.cs
  47. 139 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml
  48. 24 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml.cs
  49. 37 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml
  50. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml.cs
  51. 34 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContent.xaml
  52. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContent.xaml.cs
  53. 63 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml
  54. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml.cs
  55. 35 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContent.xaml
  56. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContent.xaml.cs
  57. 58 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml
  58. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml.cs
  59. 95 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageSplitDialog.xaml
  60. 62 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageSplitDialog.xaml.cs
  61. 1 1
      PDF Office/Views/Dialog/PageEditDialogs/InsertDialog.xaml
  62. 0 27
      PDF Office/Views/Dialog/PrinterDialog.xaml
  63. 0 15
      PDF Office/Views/Dialog/PrinterDialog.xaml.cs
  64. 0 0
      PDF Office/Views/Dialog/ToolsDialogs/CompressDialogs/SplitDialog.xaml
  65. 0 0
      PDF Office/Views/Dialog/ToolsDialogs/CompressDialogs/SplitDialog.xaml.cs
  66. 1 1
      PDF Office/Views/MainContent.xaml
  67. 5 4
      PDF Office/Views/MainWindow.xaml
  68. 0 2
      PDF Office/Views/Tools/ToolsBarContent.xaml

+ 8 - 7
.gitignore

@@ -1,7 +1,8 @@
-PDF Office/packages/
-PDF Office/obj/
-PDF Office/bin/
-PDF Office/.vs/
-PDF Office/PDF Office.csproj.user
-PDFSettings/obj/
-PDFSettings/bin/
+PDF Office/packages/
+PDF Office/obj/
+PDF Office/bin/
+PDF Office/.vs/
+PDF Office/PDF Office.csproj.user
+PDFSettings/obj/
+PDFSettings/bin/
+*.htm

+ 15 - 1
PDF Office/App.xaml.cs

@@ -26,9 +26,11 @@ using PDFSettings.Settings;
 using PDF_Office.Views.Tools; 
 using PDF_Office.Views.Dialog.ToolsDialogs.SaftyDialogs;
 using PDF_Office.Views.Dialog.ToolsDialogs.CompressDialogs;
-using PDF_Office.ViewModels.Dialog.ToolsDialogs.SaftyDialogs;
 using PDF_Office.Views.Dialog.PageEditDialogs;
 using PDF_Office.Helper;
+using PDF_Office.Views.Dialog.HomePageToolsDialogs ;
+using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
+
 
 namespace PDF_Office
 {
@@ -101,6 +103,10 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<PageEditContent>();
             containerRegistry.RegisterForNavigation<ToolsBarContent>();
             containerRegistry.RegisterForNavigation<AnnotToolContent>();
+            containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
+            containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
+            containerRegistry.RegisterForNavigation<HomePagePrinterModMutipleContent>();
+            containerRegistry.RegisterForNavigation<HomePagePrinterModBookletContent>();
 
             //注册弹窗
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);
@@ -113,6 +119,14 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<InsertDialog>(DialogNames.InsertDialog);
             containerRegistry.RegisterDialog<SplitDialog>(DialogNames.SplitDialog);
             containerRegistry.RegisterDialog<ExtractDialog>(DialogNames.ExtractDialog);
+            containerRegistry.RegisterDialog<HomePageExtractDialog>(DialogNames.HomePageExtractDialog);
+            containerRegistry.RegisterDialog<HomePageInsertDialog>(DialogNames.HomePageInsertDialog);
+            containerRegistry.RegisterDialog<HomePageSplitDialog>(DialogNames.HomePageSplitDialog);
+            containerRegistry.RegisterDialog<HomePagePrinterDialog>(DialogNames.HomePagePrinterDialog);
+            containerRegistry.RegisterDialog<HomePagePrinterPageSetDialog>(DialogNames.HomePagePrinterPageSetDialog);
+            containerRegistry.RegisterDialog<HomePagePictureToPDFDialog>(DialogNames.HomePagePictureToPDFDialog);
+
+
         }
 
         protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)

+ 28 - 0
PDF Office/CustomControl/NumericUpDown.xaml

@@ -0,0 +1,28 @@
+<UserControl x:Class="PDF_Office.CustomControl.NumericUpDown"
+            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.CustomControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="40" d:DesignWidth="80">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="4*"/>
+            <ColumnDefinition Width="1*"/>
+        </Grid.ColumnDefinitions>
+        <TextBox Name="TextBox_Num" Grid.Column="0" Text="1" FontSize="20" TextAlignment="Center" MinWidth="80" MinHeight="20" VerticalContentAlignment="Center" TextChanged="TextBox_Num_TextChanged" InputMethod.IsInputMethodEnabled="False"  PreviewTextInput="CountTextBox_PreviewTextInput" />
+        <Grid Grid.Column="1">
+            <Grid.RowDefinitions>
+                <RowDefinition/>
+                <RowDefinition/>
+            </Grid.RowDefinitions>
+            <Button Name="Button_Add" Grid.Row="0" Click="Button_Add_Click" Background="White">
+                <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 8L4 1 L8 8" Height="10" Stretch="Fill" Visibility="{Binding CompressLargeStyle}"/>
+            </Button>
+            <Button Name="Button_Sub" Grid.Row="1"   Click="Button_Sub_Click" Background="White">
+                <Path  VerticalAlignment="Center" HorizontalAlignment="Center" Stroke="Black"  Data="M0 8L4 16 L8 8" Height="10" Stretch="Fill" Visibility="{Binding CompressLargeStyle}"/>
+            </Button>
+        </Grid>
+    </Grid>
+</UserControl>

+ 95 - 0
PDF Office/CustomControl/NumericUpDown.xaml.cs

@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+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_Office.CustomControl
+{
+    /// <summary>
+    /// NumericUpDown.xaml 的交互逻辑
+    /// </summary>
+    public partial class NumericUpDown : UserControl
+    {
+        public int Num
+        {
+            get
+            {
+                int value = 0;
+                this.Dispatcher.Invoke(new Action(() =>
+                    value = Convert.ToInt32(this.TextBox_Num.Text.Trim())
+                ));
+                return value;
+            }
+            set
+            {
+                this.Dispatcher.Invoke(new Action(() =>
+                {
+                    this.TextBox_Num.Text = value.ToString();
+                }));
+            }
+        }
+        public NumericUpDown()
+        {
+            InitializeComponent();
+        }
+
+        private void Button_Add_Click(object sender, RoutedEventArgs e)
+        {
+            int num = int.Parse(this.TextBox_Num.Text.Trim());
+            if (num > 0)
+            {
+                this.TextBox_Num.Text = (num + 1).ToString();
+                Text = this.TextBox_Num.Text;
+            }
+        }
+
+        private void Button_Sub_Click(object sender, RoutedEventArgs e)
+        {
+            int num = int.Parse(this.TextBox_Num.Text.Trim());
+            if (num > 0)
+            {
+                if ((num - 1) == 0)
+                    return;
+                this.TextBox_Num.Text = (num - 1).ToString();
+                Text = this.TextBox_Num.Text;
+            }
+        }
+
+
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextProperty =
+            DependencyProperty.Register("Text", typeof(string), typeof(NumericUpDown), new PropertyMetadata(""));
+
+        private void TextBox_Num_TextChanged(object sender, TextChangedEventArgs e)
+        {
+            if (this.TextBox_Num.Text == "" || int.Parse(this.TextBox_Num.Text) < 1)
+            {
+                this.TextBox_Num.Text = "1";
+            }
+            Text = this.TextBox_Num.Text;
+        }
+
+        private void CountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
+        {
+            e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
+        }
+    }
+}

+ 27 - 0
PDF Office/CustomControl/PageTurningPreview.xaml

@@ -0,0 +1,27 @@
+<UserControl x:Class="PDF_Office.CustomControl.PageTurningPreview"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.CustomControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="350" d:DesignWidth="300">
+    <Grid>
+        <Border  Margin="10,40,10,40" Background="LightGray"  Height="218" Width="176">
+            <Viewbox>
+                <Image Name="Image"></Image>
+            </Viewbox>
+        </Border>
+        <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">
+            <Button IsEnabled="False" Name="PrePage" Width="20" Click="PrePage_Click" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                <TextBlock Text="&lt;" VerticalAlignment="Center" ></TextBlock>
+            </Button>
+            <TextBox x:Name="CurrentPage" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="1" InputMethod.IsInputMethodEnabled="False"   PreviewTextInput="CountTextBox_PreviewTextInput" KeyDown="CurrentPage_KeyDown"></TextBox>
+            <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"></TextBlock>
+            <TextBlock x:Name="PageIndex"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
+            <Button Name="NextPage" Click="NextPage_Click" Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
+            </Button>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 136 - 0
PDF Office/CustomControl/PageTurningPreview.xaml.cs

@@ -0,0 +1,136 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using System;
+using System.Collections.Generic;
+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;
+using System.Xml.Linq;
+
+namespace PDF_Office.CustomControl
+{
+    /// <summary>
+    /// PageTurningPreview.xaml 的交互逻辑
+    /// </summary>
+    public partial class PageTurningPreview : UserControl
+    {
+        public CPDFDocument document;
+        public PageTurningPreview()
+        {
+            InitializeComponent();
+        }
+
+        public async Task RenderBitmap(CPDFDocument doc)
+        {
+            CPDFPage page = doc.PageAtIndex(int.Parse(this.CurrentPage.Text) - 1,true);
+
+            byte[] bmp_data = new byte[(int)page.PageSize.Width * (int)page.PageSize.Height * 4];
+            await Task.Run(delegate
+            {
+                page.RenderPageBitmap(0, 0, (int)page.PageSize.Width, (int)page.PageSize.Height, 0xffffffff, bmp_data, 1);
+            });
+            PixelFormat fmt = PixelFormats.Bgra32;
+            BitmapSource bps = BitmapSource.Create((int)page.PageSize.Width, (int)page.PageSize.Height, 96.0, 96.0, fmt, null, bmp_data, ((int)page.PageSize.Width * fmt.BitsPerPixel + 7) / 8);
+            this.Image.Source = bps;
+        }
+        public async void AwaitRenderBitmap(CPDFDocument doc)
+        {
+            await RenderBitmap(doc);
+        }
+
+        private void PrePage_Click(object sender, RoutedEventArgs e)
+        {
+            if (this.CurrentPage.Text == "" || !int.TryParse(this.CurrentPage.Text, out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
+            if (int.Parse(this.CurrentPage.Text) > 1 && int.Parse(this.CurrentPage.Text) <= document.PageCount)
+            {
+                int Page = int.Parse(this.CurrentPage.Text);
+                this.CurrentPage.Text = (--Page).ToString();
+                if (document != null)
+                {
+                    AwaitRenderBitmap(document);
+                }
+            }
+            else if (int.Parse(this.CurrentPage.Text) <= 1) { this.CurrentPage.Text = "1"; }
+            else { this.CurrentPage.Text = document.PageCount.ToString(); }
+            NextPage.IsEnabled = true;
+            if (this.CurrentPage.Text == "1")
+            {
+                PrePage.IsEnabled = false;
+            }
+
+        }
+
+        private void NextPage_Click(object sender, RoutedEventArgs e)
+        {
+
+            if (this.CurrentPage.Text == ""|| !int.TryParse(this.CurrentPage.Text,out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
+            if (int.Parse(this.CurrentPage.Text) < document.PageCount)
+            {
+                int Page = int.Parse(this.CurrentPage.Text);
+                this.CurrentPage.Text = (++Page).ToString();
+                if (document != null)
+                {
+                    AwaitRenderBitmap(document);
+                }
+            }
+            PrePage.IsEnabled= true;
+            if (this.CurrentPage.Text == document.PageCount.ToString())
+            {
+                 NextPage.IsEnabled = false;
+            }
+        }
+
+        private void CurrentPage_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (this.CurrentPage.Text == ""|| !int.TryParse(this.CurrentPage.Text, out int _))
+            {
+                this.CurrentPage.Text = "1";
+            }
+            if (e.Key == Key.Enter)
+            {
+                if (this.CurrentPage.Text == "" || int.Parse(this.CurrentPage.Text) < 1)
+                {
+                    this.CurrentPage.Text = "1";
+                }
+                if (this.PageIndex != null)
+                {
+                    if (int.Parse(this.CurrentPage.Text) > int.Parse(this.PageIndex.Text))
+                    {
+                        this.CurrentPage.Text = this.PageIndex.Text;
+                    }
+                }
+                if (int.Parse(this.CurrentPage.Text) <= document.PageCount && int.Parse(this.CurrentPage.Text) > 0)
+                {
+                    AwaitRenderBitmap(document);
+                }
+                else
+                {
+                    MessageBox.Show("超出页面范围");
+                }
+            }
+        }
+
+        private void CountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
+        {
+            e.Handled = new Regex("[^0-9]+").IsMatch(e.Text);
+        }
+    }
+}
+
+

+ 22 - 0
PDF Office/CustomControl/WritableComboBox.xaml

@@ -0,0 +1,22 @@
+<UserControl x:Class="PDF_Office.CustomControl.WritableComboBox"
+                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.CustomControl"
+             mc:Ignorable="d" 
+             d:DesignHeight="32" d:DesignWidth="200">
+    <Grid>
+
+
+        <ComboBox x:Name="writableComboBox" Grid.Column="1"  Visibility="Visible" MinHeight="32"  MinWidth="58"
+                                      SelectionChanged="writableComboBox_SelectionChanged" SelectedIndex="0">
+            <ComboBoxItem >全部页面</ComboBoxItem>
+            <ComboBoxItem >奇数页</ComboBoxItem>
+            <ComboBoxItem >偶数页</ComboBoxItem>
+            <ComboBoxItem >自定义页面</ComboBoxItem>
+        </ComboBox>
+        <TextBox  x:Name="writableTextBox" VerticalContentAlignment="Center"  Visibility="Hidden" MinHeight="{Binding ElementName=EnterableComboBox, Path=MinHeight}" Grid.Column="0" HorizontalAlignment="Left" TextChanged="writableTextBox_TextChange">
+        </TextBox>
+    </Grid>
+</UserControl>

+ 109 - 0
PDF Office/CustomControl/WritableComboBox.xaml.cs

@@ -0,0 +1,109 @@
+using ImTools;
+using Newtonsoft.Json.Linq;
+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;
+
+namespace PDF_Office.CustomControl
+{
+    /// <summary>
+    /// WritableComboBox.xaml 的交互逻辑
+    /// </summary>
+    public partial class WritableComboBox : UserControl
+    {
+        public WritableComboBox()
+        {
+            InitializeComponent();
+        }
+        private void writableComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if (this.writableComboBox.SelectedIndex == this.writableComboBox.Items.Count - 1)
+            {
+                this.writableTextBox.Width = this.writableComboBox.ActualWidth - 18;
+                Trace.WriteLine(this.writableComboBox.ActualWidth);
+                this.writableTextBox.Visibility = Visibility.Visible;
+
+            }
+            else
+            {
+                if (this.writableTextBox != null)
+                {
+                    this.writableTextBox.Visibility = Visibility.Hidden;
+                }
+            }
+
+            if (this.writableComboBox.Items.Count == 5)
+            {
+                if (this.writableComboBox.SelectedIndex == 1)
+                { IsCurrentPage = true; }
+                else
+                {
+                    IsCurrentPage = false;
+                }
+            }
+            this.SelectedIndex = this.writableComboBox.SelectedIndex.ToString();
+        }
+
+        public bool IsCurrentPage
+        {
+            get { return (bool)GetValue(IsCurrentPageProperty); }
+            set { SetValue(IsCurrentPageProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty IsCurrentPageProperty =
+            DependencyProperty.Register("IsCurrentPage", typeof(bool), typeof(WritableComboBox), new PropertyMetadata(false));
+
+        public bool CurrentPage
+        {
+            get { return (bool)GetValue(CurrentPageProperty); }
+            set { SetValue(CurrentPageProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty CurrentPageProperty =
+            DependencyProperty.Register("CurrentPage", typeof(bool), typeof(WritableComboBox), new PropertyMetadata(false));
+
+        public string SelectedIndex
+        {
+            get { return (string)GetValue(SelectedIndexProperty); }
+            set { SetValue(SelectedIndexProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty SelectedIndexProperty =
+            DependencyProperty.Register("SelectedIndex", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextProperty =
+
+            DependencyProperty.Register("Text", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
+
+        private void writableTextBox_TextChange(object sender, TextChangedEventArgs e)
+        {
+            if (this.writableComboBox.SelectedIndex == this.writableComboBox.Items.Count - 1)
+            {
+                Text = this.writableTextBox.Text;
+            }
+            else { Text = ""; }
+        }
+    }
+}

+ 29 - 0
PDF Office/DataConvert/UnVisivleConvert.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PDF_Office.DataConvert
+{
+    public class UnVisivleConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ((Visibility)value == Visibility.Visible)
+            {
+                return Visibility.Collapsed;
+            }
+            else
+                return Visibility.Visible;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 153 - 0
PDF Office/Helper/HomePageEditHelper.cs

@@ -0,0 +1,153 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using ComPDFKitViewer.PdfViewer;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Documents;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace PDF_Office.Helper
+{
+    public static class HomePageEditHelper
+    {
+        /// <summary>
+        /// 获取所需要分文档份数
+        /// </summary>
+        /// <param name="pagecontent">文档总页数</param>
+        /// <param name="averagepage">平均几页分为一个文档</param>
+        /// <param name="remainder">最后文档的页数的引用 例如11页文档每3页为一份PDF,3,3,3,2,remainder=2</param>
+        /// <returns></returns>
+        public static int AverageSplitPages(int pagecontent, int averagepage, ref int remainder)
+        {
+            if (pagecontent <= 0)
+            {
+                remainder = 0;
+                return 0;
+            }
+            if (pagecontent <= averagepage)
+            {
+                remainder = pagecontent;
+
+                return 1;
+            }
+            if (pagecontent > averagepage)
+            {
+                if (pagecontent % averagepage == 0)
+                {
+                    remainder = 0;
+                    return pagecontent / averagepage;
+                }
+                remainder = pagecontent % averagepage;
+                return (pagecontent / averagepage) + 1;
+
+            }
+            remainder = 0;
+            return -1;
+        }
+        /// <summary>
+        /// 获取平均每个文档的页数
+        /// </summary>
+        /// <param name="pagecontent">文档总页数</param>
+        /// <param name="averagedoc">平均几页分为一个文档</param>
+        /// <param name="remainder">引用,截至第几位文档比后面文档多一 例如11页文档 分为3份 4,4,3 remainder为1 第一个文档和第二文档比后续文档多一</param>
+        /// <returns></returns>
+        public static int AverageSplitDocs(int pagecontent, int averagedoc, ref int remainder)
+        {
+            if (pagecontent <= 0)
+            {
+                remainder = 0;
+                return 0;
+            }
+            if (pagecontent <= averagedoc)
+            {
+                remainder = 0;
+                return 1;
+            }
+            if (pagecontent > averagedoc)
+            {
+                remainder = pagecontent % averagedoc;
+                return pagecontent / averagedoc;
+            }
+            return 0;
+
+        }
+
+        public static void GetPagerange(string PageRangeSelectIndex, CPDFViewer currentViewer, ref string pageRange, string pageRangeText, bool currentpage = false)
+        {
+            if (!currentpage)
+            {
+                if (PageRangeSelectIndex == "0")
+                {
+                    pageRange = "1-" + currentViewer.Document.PageCount.ToString();
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else if (PageRangeSelectIndex == "1")
+                {
+                    pageRange = "1";
+                    for (int i = 3; i <= currentViewer.Document.PageCount; i += 2)
+                        pageRange = pageRange + "," + i;
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else if (PageRangeSelectIndex == "2")
+                {
+                    pageRange = "2";
+                    for (int i = 4; i <= currentViewer.Document.PageCount; i += 2)
+                        pageRange = pageRange + "," + i;
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+
+                }
+                else if (PageRangeSelectIndex == "3")
+                {
+                    if (pageRangeText != "")
+                    {
+                        pageRange = pageRangeText;
+                    }
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else { return; }
+            }
+            else
+            {
+                if (PageRangeSelectIndex == "0")
+                {
+                    pageRange = "1-" + currentViewer.Document.PageCount.ToString();
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                if (PageRangeSelectIndex == "1")
+                {
+                    //pageRange = pageRange;
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else if (PageRangeSelectIndex == "2")
+                {
+                    pageRange = "1";
+                    for (int i = 3; i <= currentViewer.Document.PageCount; i += 2)
+                        pageRange = pageRange + "," + i;
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else if (PageRangeSelectIndex == "3")
+                {
+                    pageRange = "2";
+                    for (int i = 4; i <= currentViewer.Document.PageCount; i += 2)
+                        pageRange = pageRange + "," + i;
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+
+                }
+                else if (PageRangeSelectIndex == "4")
+                {
+                    if (pageRangeText != "")
+                    {
+                        pageRange = pageRangeText;
+                    }
+                    Trace.WriteLine(" extractModel.PageRange" + pageRange);
+                }
+                else { return; }
+
+            }
+        }
+    }
+
+}

+ 134 - 0
PDF Office/Helper/PictureConverter.cs

@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    public class PictureConverter
+    {
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool  SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转PNG(其他图片先转为PNG在转JPG)
+        /// picturefile 图片image
+        /// filePath 保存路径例如//filePath.png
+        /// </summary>
+        public static bool SavePng(Image img, string filePath)
+        {
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 图片转JPeG
+        /// img 图片Image
+        /// filePath 保存路径例如//filePath.jpg
+        /// </summary>
+        public static bool SaveJpeg(Image img, string filePath)
+        {
+            
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+    }
+}

+ 28 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageExtractDialogModel.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageExtractDialogModel
+    {
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public List<int> PageParm = new List<int> { };
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public string PageRange = "1,3-4,10";
+        /// <summary>
+        /// 是否拆分为单文件
+        /// </summary>
+        public bool ExtractToSingleFile = false;
+        /// <summary>
+        /// 提取后删除页面
+        /// </summary>
+        public bool DeleteAfterExtract = false;
+    }
+}

+ 23 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageInsertDialogModel.cs

@@ -0,0 +1,23 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageInsertDialogModel
+    {
+        public string FilePath = "";
+        public int InsertIndex = 1;
+        public string Password = "";
+        public string InserPageRange(CPDFDocument doc)
+        {
+            if (doc.PageCount < 1) { return ""; }
+            if (doc.PageCount == 1) { return "1"; }
+            return "1" + "-" + doc.PageCount.ToString();
+        }
+
+    }
+}

+ 58 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogModel.cs

@@ -0,0 +1,58 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogModel
+    {
+
+        /// <summary>
+        /// 拆分模式
+        /// </summary>
+        public ToPDFFileMode Mode = ToPDFFileMode.NewFiles;
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string RearFileNameLabel = "down";
+
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string FrontFileNameLabel = "part";
+
+        /// <summary>
+        /// 当前文件路径
+        /// </summary>
+        public string FilePath = "";
+
+        /// <summary>
+        /// 文件密码
+        /// </summary>
+        public string Password = "";
+
+        /// <summary>
+        /// 保存逻辑
+        /// </summary>
+        public enum ToPDFFileMode
+        {
+            /// <summary>
+            /// 单独为一个文档
+            /// </summary>
+            NewFiles,
+            /// <summary>
+            /// 保存为一个文档
+            /// </summary>
+            OneNewFile,
+            /// <summary>
+            /// 当前文档
+            /// </summary>
+            SelectFileName
+
+        }
+    }
+}

+ 174 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogModel.cs

@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Numerics;
+using System.Runtime.Remoting.Channels;
+using System.Text;
+using System.Threading.Tasks;
+using static PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialogModel;
+
+namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class PrintSettingsInfo
+    {
+        public bool IsBlackAndWhite { get; set; }
+        public bool IsReverseOrder { get; set; }
+        public EnumPaperSize EnumPaperSize { get; set; }
+        public EnumPageRange EnumPageRange { get; set; }
+        public EnumPrintOrientation EnumPrintOrientation { get; set; }
+        public bool PrintWithAnnot { get; set; }
+        public bool PrintWithForm { get; set; }
+        public int Copies { get; set; }
+        public string PrinterName { get; set; }
+        public string CustomizeRange { get; set; }
+        public SizeSetttingsInfo SizeSetttingsInfo { get; set; }
+        public PostModSplitInfo PostModSplitInfo { get; set; }
+        public PostModTileInfo PostModTileInfo { get; set; }
+        public MutipleInfo MutipleInfo { get; set; }
+        public BookletInfo BookletInfo { get; set; }
+    }
+
+    public class HomePagePrinterDialogModel
+    {
+    }
+
+    public enum EnumPaperSize
+    {
+        StatusA3,
+        StatusA4,
+        StatusA5,
+        StatusB5,
+        StatusNo10Envelope,
+        StatusChoukei3Envelope,
+        StatusDLEnvelope,
+        StatusJISB5,
+        StatusROC16K,
+        StatusExtraLargeBA3,
+        StatusTabloid,
+        StatusExraLargeTabloid,
+        StatusAmericanLegal,
+        StatusAmericanLetter,
+        StatusCustomized
+    }
+
+    public enum EnumSizeType
+    {
+        StatusAdaptive,
+        StatusActural,
+        StatusCustomized,
+    }
+
+    public enum EnumPageRange
+    {
+        StatusAllRange,
+        StatusCurrentRange,
+        StatusOddRange,
+        StatusEvenRange,
+        StatusCustomizedRange
+    }
+
+    public enum EnumPrintOrientation
+    {
+        StatusHorizontal,
+        StatusVertical,
+    }
+
+    public enum EnumPrintContent
+    {
+        StatusOnlyDocument,
+        StatusDocumentAndMarkUps,
+        StatusDocumentAndForm,
+    }
+
+
+    public enum EnumPrintMod
+    {
+        StatusSize,
+        StatusPoster,
+        StatusMutiple,
+        StatusBooklet
+    }
+
+    public enum EnumPosterMod
+    {
+        StatusTile,
+        StatusSplit
+    }
+
+    public enum EnumDisplayPageNumber
+    {
+        StatusTwo,
+        StatusFour,
+        StatusSix,
+        StatusNine,
+        StatusSixteen,
+        StatusCustomized
+    }
+
+    public enum EnumPageOrder
+    {
+        StatusHorizontalOrder,
+        StatusHorizontalReverseOrder,
+        StatusVerticalOrder,
+        StatusVerticalReverseOrder,
+    }
+
+    public enum EnumBookletSubset
+    {
+        StatusBothSides,
+        StatusFrontSideOnly,
+        StatusBackSideOnly
+    }
+
+    public enum EnumBookletBinding
+    {
+        StatusLeft,
+        StatusRight,
+        StatusLeftTall,
+        StatusRightTall
+    }
+
+    public abstract class PrintMod { }
+
+    public class SizeSetttingsInfo : PrintMod
+    {
+        public EnumSizeType SizeType { get; set; }
+        public int DisplayRatio { get; set; }
+    }
+
+
+    public class PosterInfo : PrintMod
+    {
+        public bool CutMarks { get; set; }
+        public double OverLap { get; set; }
+    }
+
+    public class PostModTileInfo : PosterInfo
+    {
+        public int TileRatio { get; set; }
+    }
+
+    public class PostModSplitInfo : PosterInfo
+    {
+        public EnumDisplayPageNumber EnumDisplayPageNumber { get; set; }
+        public int TileRatio { get; set; }
+        public int WidthPartNumber { get; set; }
+        public int HeightPartNumber { get; set; }
+    }
+
+    public class MutipleInfo : PrintMod
+    {
+        public bool AutoRotate { set; get; }
+        public EnumDisplayPageNumber EnumDisplayPageNumber { get; set; }
+        public int WidthPartNumber { get; set; }
+        public int HeightPartNumber { get; set; }
+    }
+
+    public class BookletInfo : PrintMod
+    {
+        public EnumBookletSubset EnumBookletSubset { get; set; }
+        public EnumBookletBinding EnumBookletBinding { get; set; }
+        public int BeginPageIndex { get; set; }
+        public int EndPageIndex { get; set; }
+    }
+}

+ 61 - 0
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePageSplitDialogModel.cs

@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageSplitDialogModel
+    {
+
+        /// <summary>
+        /// 拆分模式
+        /// </summary>
+        public SplitMode Mode = SplitMode.AveragePages;
+        /// <summary>
+        /// 拆分模式份数或者页数
+        /// </summary>
+        public int GetModeCount = 1;
+        /// <summary>
+        /// 页面信息
+        /// </summary>
+        public string PageRange = "1,3-4,10";
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string FileNameLabel = "part";
+        /// <summary>
+        /// 文件名与标签分隔符
+        /// </summary>
+        public string FileNameDeimiter = "-";
+        /// <summary>
+        /// 文件名与标签分隔符
+        /// </summary>
+        public bool FrontFileName = true;
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public List<int> PageParm = new List<int> { };
+        /// <summary>
+        /// 文件名;
+        /// </summary>
+        public string FileName = "";
+
+        public enum SplitMode
+        {
+            /// <summary>
+            /// 按页平均拆分
+            /// </summary>
+            AveragePages,
+            /// <summary>
+            /// 按文件平均拆分
+            /// </summary>
+            AverageFiles,
+            /// <summary>
+            /// 自定义页码范围拆分
+            /// </summary>
+            CustomPageRange
+        }
+    }
+}

+ 33 - 5
PDF Office/Model/DialogNames.cs

@@ -44,10 +44,7 @@ namespace PDF_Office.Model
         /// <summary>
         /// 进度条
         /// </summary>
-        public static string CompressProgressBarDialog = "CompressProgressBarDialog";
-
-        
-
+        public static string CompressProgressBarDialog = "CompressProgressBarDialog"; 
         /// <summary>
         /// 页面编辑- 提取弹窗
         /// </summary>
@@ -56,11 +53,42 @@ namespace PDF_Office.Model
         /// <summary>
         /// 页面编辑-拆分弹窗
         /// </summary>
-        public static string SplitDialog = "SplitDailog";
+        public static string SplitDialog = "SplitDialog";
 
         /// <summary>
         /// 页面编辑-插入弹窗
         /// </summary>
         public static string InsertDialog = "InsertDialog";
+
+        ///<summary>
+        ///主页工具-提取弹窗
+        /// </summary>
+        public static string HomePageExtractDialog = "HomePageExtractDialog";
+
+        ///<summary>
+        ///主页工具-插入弹窗
+        /// </summary
+        public static string HomePageInsertDialog = "HomePageInsertDialog";
+
+        ///<summary>
+        ///主页工具-拆分弹窗
+        /// </summary>
+        public static string HomePageSplitDialog = "HomePageSplitDialog";
+
+        ///<summary>
+        ///主页工具-打印弹窗
+        /// </summary>
+        public static string HomePagePrinterDialog = "HomePagePrinterDialog";
+
+        ///<summary>
+        ///打印弹窗-打印页面设置
+        /// </summary>
+        public static string HomePagePrinterPageSetDialog = "HomePagePrinterPageSetDialog";
+
+        ///<summary>
+        ///主页工具-图片转PDF弹窗
+        /// </summary>
+        public static string HomePagePictureToPDFDialog = "HomePagePictureToPDFDialog";
+
     }
 }

+ 28 - 0
PDF Office/Model/HomePageToolsDialogs/HomePageExtractDialogModel.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageExtractDialogModel
+    {
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public List<int> PageParm=new List<int> { };
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public string PageRange="1,3-4,10";
+        /// <summary>
+        /// 是否拆分为单文件
+        /// </summary>
+        public bool ExtractToSingleFile=true;
+        /// <summary>
+        /// 提取后删除页面
+        /// </summary>
+        public bool DeleteAfterExtract=false;
+    }
+}

+ 22 - 0
PDF Office/Model/HomePageToolsDialogs/HomePageInsertDialogModel.cs

@@ -0,0 +1,22 @@
+using ComPDFKit.PDFDocument;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageInsertDialogModel
+    {
+        public string FilePath = "";
+        public int InsertIndex = 1;
+        public string Password = "";
+        public string InserPageRange(CPDFDocument doc) {
+            if (doc.PageCount < 1) { return ""; }
+            if (doc.PageCount == 1) { return "1"; }
+            return "1"+"-"+ doc.PageCount.ToString();
+        }
+
+    }
+}

+ 58 - 0
PDF Office/Model/HomePageToolsDialogs/HomePageSplitDialogModel.cs

@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.HomePageToolsDialogs
+{
+    public class HomePageSplitDialogModel
+    {
+
+        /// <summary>
+        /// 拆分模式
+        /// </summary>
+        public SplitMode Mode = SplitMode.AveragePages;
+        /// <summary>
+        /// 拆分模式份数或者页数
+        /// </summary>
+        public int GetModeCount = 1;
+        /// <summary>
+        /// 页面信息
+        /// </summary>
+        public string PageRange = "1,3-4,10";
+        /// <summary>
+        /// 文件名标签
+        /// </summary>
+        public string FileNameLabel = "part";
+        /// <summary>
+        /// 文件名与标签分隔符
+        /// </summary>
+        public string FileNameDeimiter = "-";
+        /// <summary>
+        /// 文件名与标签分隔符
+        /// </summary>
+        public bool FrontFileName = true;
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public List<int> PageParm = new List<int> { };
+
+
+        public enum SplitMode
+        {
+            /// <summary>
+            /// 按页平均拆分
+            /// </summary>
+            AveragePages,
+            /// <summary>
+            /// 按文件平均拆分
+            /// </summary>
+            AverageFiles,
+            /// <summary>
+            /// 自定义页码范围拆分
+            /// </summary>
+            CustomPageRange
+        }
+    }
+}

+ 28 - 0
PDF Office/Model/MainPageToolsDialogs/MainPageExtractDialogModel.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.MainPageToolsDialogs
+{
+    internal class MainPageExtractDialogModel
+    {
+        /// <summary>
+        /// 页码 存入页码范围;
+        /// </summary>
+        public List<int> PageParm;
+        /// <summary>
+        /// 自定模式下 把文本内容传过去
+        /// </summary>
+        public string PageName = "";
+        /// <summary>
+        /// 是否拆分为单文件
+        /// </summary>
+        public bool ExtractToSingleFile;
+        /// <summary>
+        /// 提取后删除页面
+        /// </summary>
+        public bool DeleteAfterExtract;
+    }
+}

+ 26 - 0
PDF Office/Model/MainPageToolsDialogs/MainPageInsertDialogModel.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.MainPageToolsDialogs
+{
+    internal class MainPageInsertDialogModel
+    {
+        public class InsertEventClass : EventArgs
+        {
+            public InsertType Type;
+            public string filePath;
+            public string pageRange;
+            public int InsertIndex;
+            public string Password;
+        }
+
+        public enum InsertType
+        {
+            BlankPages,
+            FromOtherPdf
+        }
+    }
+}

+ 44 - 0
PDF Office/Model/MainPageToolsDialogs/MainPageSplitDialogModel.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.MainPageToolsDialogs
+{
+    internal class MainPageSplitDialogModel
+    {
+        public class SplitEventClass : EventArgs
+        {
+            /// <summary>
+            /// 拆分模式
+            /// </summary>
+            public SplitMode Mode;
+            /// <summary>
+            /// 文件名
+            /// </summary>
+            public string FileName;
+            /// <summary>
+            /// 页面信息
+            /// </summary>
+            public string PageRange;
+
+        }
+
+        public enum SplitMode
+        {
+            /// <summary>
+            /// 按页平均拆分
+            /// </summary>
+            AveragePages,
+            /// <summary>
+            /// 按文件平均拆分
+            /// </summary>
+            AverageFiles,
+            /// <summary>
+            /// 自定义页码范围拆分
+            /// </summary>
+            CustomPageRange
+        }
+    }
+}

+ 108 - 6
PDF Office/PDF Office.csproj

@@ -192,16 +192,28 @@
     <Compile Include="CustomControl\IconAndTextTabItem.cs" />
     <Compile Include="CustomControl\ListBoxItemToolBar.cs" />
     <Compile Include="CustomControl\MessageBoxEx.cs" />
+    <Compile Include="CustomControl\NumericUpDown.xaml.cs">
+      <DependentUpon>NumericUpDown.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="CustomControl\PageTurningPreview.xaml.cs">
+      <DependentUpon>PageTurningPreview.xaml</DependentUpon>
+    </Compile>
     <Compile Include="CustomControl\SystemControl\CustomCommandAction .cs" />
     <Compile Include="CustomControl\SystemControl\RoutedEventTrigger.cs" />
     <Compile Include="CustomControl\ToastControl.xaml.cs">
       <DependentUpon>ToastControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="CustomControl\WritableComboBox.xaml.cs">
+      <DependentUpon>WritableComboBox.xaml</DependentUpon>
+    </Compile>
     <Compile Include="DataConvert\FileFormatToIconConvert.cs" />
+    <Compile Include="DataConvert\UnVisivleConvert.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="Helper\HomePageEditHelper.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
     <Compile Include="Helper\SDKLisenceHelper.cs" />
+    <Compile Include="Helper\PictureConverter.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
     <Compile Include="Model\CloudDrive\CloudDriveItem.cs" />
@@ -211,10 +223,15 @@
     <Compile Include="CustomControl\LoadingControl.xaml.cs">
       <DependentUpon>LoadingControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\CompressDialogModel\CompressDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\CheckPasswordDialogModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\DeleteSafetySettintgsModel.cs" />
     <Compile Include="Model\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageExtractDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageInsertDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialogModel.cs" />
+    <Compile Include="Model\Dialog\HomePageToolsDialogs\HomePageSplitDialogModel.cs" />
     <Compile Include="Model\PageEdit\ExtractModel.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
     <Compile Include="Model\ParameterNames.cs" />
@@ -237,9 +254,16 @@
     <Compile Include="ViewModels\BottomToolContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModMutipleContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModPosterContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModSizeContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPageSetDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageSplitDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\PageEditDialogs\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\PageEditDialogs\InsertDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\PageEditDialogs\SplitDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\CompressDialogs\CompressDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\CompressDialogs\CompressProgressBarDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\DeleteSafetySettingsDialogViewModel.cs" />
@@ -253,10 +277,13 @@
     <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\DropbBoxUserItem.cs" />
     <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveManager.cs" />
     <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveUserItem.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeToolsContentViewModel.cs" />
     <Compile Include="ViewModels\MainContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageExtractDialogViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageInsertDialogViewModel.cs" />
     <Compile Include="ViewModels\PageEdit\PageEditContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ToolsBarContentViewModel.cs" />
     <Compile Include="Views\BOTA\BookmarkContent.xaml.cs">
@@ -271,17 +298,44 @@
     <Compile Include="Views\Dialog\FullScreenWindow.xaml.cs">
       <DependentUpon>FullScreenWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageExtractDialog.xaml.cs">
+      <DependentUpon>HomePageExtractDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageInsertDialog.xaml.cs">
+      <DependentUpon>HomePageInsertDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml.cs">
+      <DependentUpon>HomePagePictureToPDFDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml.cs">
+      <DependentUpon>HomePagePrinterModBookletContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModMutipleContent.xaml.cs">
+      <DependentUpon>HomePagePrinterModMutipleContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModPosterContent.xaml.cs">
+      <DependentUpon>HomePagePrinterModPosterContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModSizeContent.xaml.cs">
+      <DependentUpon>HomePagePrinterModSizeContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPageSetDialog.xaml.cs">
+      <DependentUpon>HomePagePrinterPageSetDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageSplitDialog.xaml.cs">
+      <DependentUpon>HomePageSplitDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\PageEditDialogs\ExtractDialog.xaml.cs">
       <DependentUpon>ExtractDialog.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\Dialog\PageEditDialogs\InsertDialog.xaml.cs">
       <DependentUpon>InsertDialog.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\Dialog\PageEditDialogs\SplitDialog.xaml.cs">
+    <Compile Include="Views\Dialog\ToolsDialogs\CompressDialogs\SplitDialog.xaml.cs">
       <DependentUpon>SplitDialog.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\Dialog\PrinterDialog.xaml.cs">
-      <DependentUpon>PrinterDialog.xaml</DependentUpon>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialog.xaml.cs">
+      <DependentUpon>HomePagePrinterDialog.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\Dialog\ToolsDialogs\CompressDialogs\CompressDialog.xaml.cs">
       <DependentUpon>CompressDialog.xaml</DependentUpon>
@@ -361,10 +415,22 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="CustomControl\NumericUpDown.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="CustomControl\PageTurningPreview.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="CustomControl\ToastControl.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="CustomControl\WritableComboBox.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\ComboxStyle.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -421,6 +487,42 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageExtractDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageInsertDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModMutipleContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModPosterContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModSizeContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPageSetDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePageSplitDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\PageEditDialogs\ExtractDialog.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -429,13 +531,13 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Views\Dialog\PageEditDialogs\SplitDialog.xaml">
+    <Page Include="Views\Dialog\ToolsDialogs\CompressDialogs\SplitDialog.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Views\Dialog\PrinterDialog.xaml">
-      <Generator>MSBuild:Compile</Generator>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDialog.xaml">
       <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
     </Page>
     <Page Include="Views\Dialog\ToolsDialogs\CompressDialogs\CompressDialog.xaml">
       <SubType>Designer</SubType>

File diff suppressed because it is too large
+ 268 - 0
PDF Office/UpgradeLog2.htm


File diff suppressed because it is too large
+ 268 - 0
PDF Office/UpgradeLog3.htm


+ 169 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageExtractDialogViewModel.cs

@@ -0,0 +1,169 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using SQLitePCL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using PDF_Office.Model.HomePageToolsDialogs;
+using PDF_Office.Helper;
+using System.Diagnostics;
+using PDF_Office.CustomControl;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePageExtractDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        public CPDFDocument document;
+
+        private CPDFViewer currentViewer;
+
+        private HomePageExtractDialogModel extractModel = new HomePageExtractDialogModel();
+
+        private string savefilepath { get; set; }
+
+
+
+        public string ExtractToSingleFileIsCheck {get;set;} = "False";
+
+        public string DeleteAfterExtractIsCheck { get; set; } = "Fales";
+
+        public string PageRangeText { get; set; } = "";
+
+        public string PageRangeSelectIndex { get; set; } = "";
+        #endregion
+
+        #region 委托声明
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ExtractCommand { get; set; }
+
+        public DelegateCommand ExtractToSingleFileCommand { get; set; }
+
+        public DelegateCommand DeleteAfterExtractCommand { get; set; }
+        #endregion
+
+        public HomePageExtractDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            ExtractCommand = new DelegateCommand(extract);
+            ExtractToSingleFileCommand = new DelegateCommand(extractToSingleFile);
+            DeleteAfterExtractCommand = new DelegateCommand(deleteAfterExtract);
+
+        }
+        #region 逻辑函数
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void extract()
+        {
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref extractModel.PageRange, PageRangeText);
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref extractModel.PageParm, extractModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            if (extractModel.ExtractToSingleFile)
+            {
+                for (int i = 0; i < extractModel.PageParm.ToArray().Length; i++)
+                {
+                    CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                    extractdoc.ImportPages(currentViewer.Document, (extractModel.PageParm.ToArray()[i] + 1).ToString());
+                    Trace.WriteLine(extractModel.PageParm.ToArray()[i].ToString());
+                    extractdoc.WriteToFilePath(savefilepath + currentViewer.Document.FileName + ".extract" + i.ToString() + ".pdf");
+                    extractdoc.Release();
+                }
+                if (extractModel.DeleteAfterExtract)
+                {
+                    currentViewer.Document.RemovePages(extractModel.PageParm.ToArray());
+                    currentViewer.Document.WriteToLoadedPath();
+                }
+
+            }
+            else
+            {
+                CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                extractdoc.ImportPages(currentViewer.Document, extractModel.PageRange);
+                extractdoc.WriteToFilePath(savefilepath + currentViewer.Document.FileName + ".extract.pdf");
+                if (extractModel.DeleteAfterExtract)
+                {
+                    currentViewer.Document.RemovePages(extractModel.PageParm.ToArray());
+                    currentViewer.Document.WriteToLoadedPath();
+                }
+                extractdoc.Release();
+            }
+            System.Diagnostics.Process.Start("Explorer", "/select," + currentViewer.Document.FilePath);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        private void extractToSingleFile()
+        {
+            if (ExtractToSingleFileIsCheck == "True")
+            {
+                extractModel.ExtractToSingleFile = true;
+                Trace.WriteLine("ExtractToSingleFileIsCheck" + extractModel.ExtractToSingleFile);
+            }
+            else
+            {
+                extractModel.ExtractToSingleFile = false;
+                Trace.WriteLine("ExtractToSingleFileIsCheck" + extractModel.ExtractToSingleFile);
+            }
+        }
+
+        private void deleteAfterExtract()
+        {
+
+            if (DeleteAfterExtractIsCheck == "True")
+            {
+                extractModel.DeleteAfterExtract = true;
+                Trace.WriteLine("DeleteAfterExtractIsCheck" + extractModel.DeleteAfterExtract);
+            }
+            else
+            {
+                extractModel.DeleteAfterExtract = false;
+                Trace.WriteLine("DeleteAfterExtractIsCheck" + extractModel.DeleteAfterExtract);
+            }
+
+        }
+        #endregion
+
+        #region 框架行为
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer viewer = null;
+            string filepath = "";
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out viewer);
+            parameters.TryGetValue<string>(ParameterNames.FilePath, out filepath);
+            if (viewer != null && viewer.Document != null)
+            {
+                currentViewer = viewer;
+                savefilepath = filepath.Replace(currentViewer.Document.FileName + ".pdf", "");
+                document = currentViewer.Document;
+            }
+        }
+        #endregion
+    }
+}

+ 218 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageInsertDialogViewModel.cs

@@ -0,0 +1,218 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using PDF_Office.Model.HomePageToolsDialogs;
+using System.Diagnostics;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+using PDF_Office.CustomControl;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePageInsertDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        public CPDFDocument document;
+
+        private CPDFViewer currentViewer;
+
+        private HomePageInsertDialogModel insertModel = new HomePageInsertDialogModel();
+
+        private string selectFilePath = "选择文件";
+        public string SelectFilePath
+        {
+            get { return selectFilePath; }
+            set
+            {
+                SetProperty(ref selectFilePath, value);
+            }
+        }
+
+        public string PageLocation { get; set; } = "0";
+
+        private string pageNumber = "1";
+        public string PageNumber
+        {
+            get { return pageNumber; }
+            set
+            {
+                SetProperty(ref pageNumber, value);
+            }
+        }
+
+        public string PageInsertIndex { get; set; } = "1";
+
+        private string firstIsCheck = "True";
+        public string FirstIsCheck
+        {
+            get { return firstIsCheck; }
+            set
+            {
+                SetProperty(ref firstIsCheck, value);
+            }
+        }
+
+        private string lastIsCheck = "False";
+        public string LastIsCheck
+        {
+            get { return lastIsCheck; }
+            set
+            {
+                SetProperty(ref lastIsCheck, value);
+            }
+        }
+
+        private string customIsCheck = "False";
+        public string CustomIsCheck
+        {
+            get { return customIsCheck; }
+            set
+            {
+                SetProperty(ref customIsCheck, value);
+            }
+        }
+
+        private string customIsEnabled = "False";
+        public string CustomIsEnabled
+        {
+            get { return customIsEnabled; }
+            set
+            {
+                SetProperty(ref customIsEnabled, value);
+            }
+        }
+        #endregion
+
+        #region 委托声明
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand InsertCommand { get; set; }
+
+        public DelegateCommand SelectFileCommand { get; set; }
+
+        public DelegateCommand FirstPageCommand { get; set; }
+
+        public DelegateCommand LastPageCommand { get; set; }
+
+        public DelegateCommand CustomPageCommand { get; set; }
+        #endregion
+
+        public HomePageInsertDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            InsertCommand = new DelegateCommand(insert);
+            SelectFileCommand = new DelegateCommand(selectFile);
+            FirstPageCommand = new DelegateCommand(firstPage);
+            LastPageCommand = new DelegateCommand(lastPage);
+            CustomPageCommand = new DelegateCommand(customPage);
+        }
+        #region 逻辑函数
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void insert()
+        {
+
+            CPDFDocument insertdocument = CPDFDocument.InitWithFilePath(insertModel.FilePath);
+            if (insertdocument == null)
+            {
+                Trace.WriteLine("Document==null");
+                //TODO
+                MessageBoxEx.Show("文档为空");
+                return;
+            }
+            if (insertdocument.IsEncrypted)
+            {
+                Trace.WriteLine("youmima");
+                MessageBoxEx.Show("文档加密");
+                //TODO
+                return;
+            }
+
+            insertModel.InsertIndex = int.Parse(PageInsertIndex);
+            if (PageLocation == "1")
+            {
+                insertModel.InsertIndex = insertModel.InsertIndex - 1;
+            }
+            currentViewer.Document.ImportPagesAtIndex(insertdocument, insertModel.InserPageRange(insertdocument), insertModel.InsertIndex);
+            currentViewer.Document.WriteToLoadedPath();
+            insertdocument.Release();
+            System.Diagnostics.Process.Start("Explorer", "/select," + currentViewer.Document.FilePath);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        private void selectFile()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                insertModel.FilePath = dlg.FileName;
+                SelectFilePath = dlg.FileName;
+            }
+
+        }
+
+        private void firstPage()
+        {
+            insertModel.InsertIndex = 1;
+            CustomIsEnabled = "False";
+            FirstIsCheck = "True";
+            LastIsCheck = "False";
+            CustomIsCheck = "False";
+        }
+
+        private void lastPage()
+        {
+            insertModel.InsertIndex = currentViewer.Document.PageCount;
+            CustomIsEnabled = "False";
+            FirstIsCheck = "False";
+            LastIsCheck = "True";
+            CustomIsCheck = "False";
+        }
+
+        private void customPage()
+        {
+            CustomIsEnabled = "True";
+            FirstIsCheck = "False";
+            LastIsCheck = "False";
+            CustomIsCheck = "True";
+        }
+        #endregion
+
+        #region 构架行为
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer viewer = null;
+            string filepath = "";
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out viewer);
+            parameters.TryGetValue<string>(ParameterNames.FilePath, out filepath);
+            if (viewer != null && viewer.Document != null)
+            {
+                currentViewer = viewer;
+                document = currentViewer.Document;
+                PageNumber = currentViewer.Document.PageCount.ToString();
+            }
+        }
+        #endregion
+    }
+}

+ 425 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialogViewModel.cs

@@ -0,0 +1,425 @@
+using PDF_Office.Model;
+using Prism.Commands;
+using System.Data;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using System.IO;
+using System.Diagnostics;
+using PDF_Office.CustomControl;
+using System.Windows;
+using PDF_Office.Helper;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+using ComPDFKit.PDFDocument;
+using System.Drawing;
+using DialogResult = Prism.Services.Dialogs.DialogResult;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePagePictureToPDFDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        private List<string> fileNames;
+        
+        public List<int> fileNamesView = new List<int>();
+        public HomePagePictureToPDFDialogModel pictureToPDFModel=new HomePagePictureToPDFDialogModel();
+        private DataTable imagesDataTable = new DataTable();
+        public DataTable ImagesDataTable
+        {
+            get { return imagesDataTable; }
+            set
+            {
+                SetProperty(ref imagesDataTable, value);
+            }
+        }
+        private string removeIsEnable = "False";
+        public string RemoveIsEnable
+        {
+            get { return removeIsEnable; }
+            set
+            {
+                SetProperty(ref removeIsEnable, value);
+            }
+        }
+
+        private string selectFileName = "False";
+        public string SelectFileName
+        {
+            get { return selectFileName; }
+            set
+            {
+                SetProperty(ref selectFileName, value);
+            }
+        }
+
+        private Visibility addFileVisibility = Visibility.Hidden;
+        public Visibility AddFileVisibility
+        {
+            get { return addFileVisibility; }
+            set
+            {
+                SetProperty(ref addFileVisibility, value);
+                RaisePropertyChanged();
+
+            }
+        }
+
+        #endregion
+        #region 委托声明
+
+        public DelegateCommand ToPDFCommand { get; set; }
+
+        public DelegateCommand ADDPictureCommand { get; set; }
+
+        public DelegateCommand ADDPictureFilesCommand { get; set; }
+
+        public DelegateCommand RemovePictureFileCommand { get; set; }
+
+        public DelegateCommand SelectFileCommand { get; set; }
+
+        #endregion
+        public HomePagePictureToPDFDialogViewModel()
+        {
+            ToPDFCommand = new DelegateCommand(topdf);
+            ADDPictureCommand = new DelegateCommand(addpicture);
+            ADDPictureFilesCommand = new DelegateCommand(addpicturefiles);
+            RemovePictureFileCommand = new DelegateCommand(removepicturefile);
+            SelectFileCommand = new DelegateCommand(selectFile);
+
+        }
+        #region 逻辑函数
+        private void topdf() {
+            updateListview("正在转换");
+            DataTable imagesdatayable = new DataTable();
+            imagesdatayable.Columns.Add("FileName");
+            imagesdatayable.Columns.Add("FileSize");
+            imagesdatayable.Columns.Add("FileState");
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles)
+            {
+                foreach (var filename in fileNames)
+                {
+                    Image img = Image.FromFile(filename);
+                    CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width,img.Height);
+                    Trace.WriteLine("Path.GetTempPath():" + Path.GetTempPath());
+                    topdfdoc.WriteToFilePath(savefilename(filename));
+                    topdfdoc.Release();
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile)
+            {
+                CPDFDocument topdfdoc = CPDFDocument.CreateDocument();
+                int pageindex = 0;
+                foreach (var filename in fileNames) {
+                    Image img = Image.FromFile(filename);
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo,img.Width, img.Height);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                System.Diagnostics.Process.Start("Explorer", "/select," + savefilename(fileNames[0]));
+                topdfdoc.WriteToFilePath(savefilename(fileNames[0]));
+                topdfdoc.Release();
+            }
+            if (pictureToPDFModel.Mode == HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName)
+            {
+                CPDFDocument topdfdoc =CPDFDocument.InitWithFilePath(pictureToPDFModel.FilePath);
+                if (topdfdoc == null)
+                {
+                    Trace.WriteLine("Document==null");
+                    //TODO
+                    MessageBoxEx.Show("文档为空");
+                    return;
+                }
+                if (topdfdoc.IsEncrypted)
+                {
+                    Trace.WriteLine("youmima");
+                    MessageBoxEx.Show("文档加密");
+                    //TODO
+                    return;
+                }
+                int pageindex = topdfdoc.PageCount;
+                foreach (var filename in fileNames)
+                {
+                    Image img = Image.FromFile(filename);
+                    FileInfo fileinfo = new FileInfo(filename);
+                    JpegInsertPage(ref topdfdoc, filename, fileinfo, img.Width, img.Height, pageindex);
+                    pageindex++;
+                    string file_size = (((float)fileinfo.Length) / 1024).ToString() + " K";
+                    imagesdatayable.Rows.Add(fileinfo.Name, file_size, "确认");
+                    ImagesDataTable = imagesdatayable;
+                }
+                topdfdoc.WriteToLoadedPath();
+                System.Diagnostics.Process.Start("Explorer", "/select," + topdfdoc.FilePath);
+                topdfdoc.Release();
+            }
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        /// <summary>
+        /// 设置保存后的文件名
+        /// </summary>
+        public string savefilename(string filename)
+        {
+            FileInfo file = new FileInfo(filename);
+            return filename.Replace(file.Name, "") +pictureToPDFModel.FrontFileNameLabel+file.Name+pictureToPDFModel.RearFileNameLabel+".pdf";
+        }
+
+        /// <summary>
+        /// 选择PDF文件
+        /// </summary>
+        private void selectFile()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                SelectFileName=dlg.FileName;
+                pictureToPDFModel.FilePath = dlg.FileName;
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件
+        /// </summary>
+        private void addpicture()
+        {
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = true;
+            dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*.bmp;*.gif;*tiff;";
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                fileNames.AddRange(dlg.FileNames.ToList());
+                RemoveExcess(ref fileNames);
+                AddFileVisibility = Visibility.Collapsed;
+                updateListview("待确定");
+            }
+        }
+
+        /// <summary>
+        /// 添加图片文件夹
+        /// </summary>
+        private void addpicturefiles()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择文件路径";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+
+                string foldPath = dialog.SelectedPath;
+                var apps = System.IO.Directory.GetFiles(foldPath);
+                foreach (string app in apps)
+                {
+                    var fi = new FileInfo(app);
+                    if (fi.Extension == ".png" || fi.Extension == ".jpg" || fi.Extension == ".jpeg" || fi.Extension ==".bmp"|| fi.Extension == ".gif"|| fi.Extension == ".tiff")
+                    {
+                        fileNames.Add(app);
+                    }
+                }
+                RemoveExcess(ref fileNames);
+                updateListview("待确定");
+                AddFileVisibility = Visibility.Collapsed;
+            }
+        }
+
+        /// <summary>
+        /// 删除图片文件
+        /// </summary>
+        public void removepicturefile() {
+            Reverseorder(ref fileNamesView);
+            foreach (int filenamesview in fileNamesView)
+            {
+                //Trace.WriteLine(filenamesview);
+                fileNames.Remove(fileNames[filenamesview]);
+            }
+            if (fileNames.Count < 1)
+            {
+                AddFileVisibility = Visibility.Visible;
+            }
+            updateListview("待确定");
+        }
+
+        /// <summary>
+        /// 打开文件图片
+        /// </summary>
+        public void openfiledialog(){
+
+            foreach (int filenamesview in fileNamesView)
+            {
+                System.Diagnostics.Process.Start(fileNames[filenamesview]);
+            }
+        }
+
+        /// <summary>
+        /// 删除重复的文件
+        /// </summary>
+        public void RemoveExcess(ref List<string> Filenames) {
+            List<string> filenames = new List<string>();
+            foreach (var fileName in Filenames)
+            {
+                if (!filenames.Contains(fileName))
+                {
+                    filenames.Add(fileName);
+                }
+            }
+            Filenames.Clear();
+            Filenames = filenames;
+        }
+
+        /// <summary>
+        /// 逆序int类型集合
+        /// </summary>
+        public void Reverseorder(ref List<int> Numbers)
+        {
+            Numbers=Numbers.OrderBy(a=>a).ToList();
+            Numbers.Reverse();
+        }
+
+        /// <summary>
+        /// 更新listview显示
+        /// state 状态显示字符串
+        /// </summary>
+        public void updateListview( string state) {
+            DataTable imagesdatayable = new DataTable();
+            imagesdatayable.Columns.Add("FileName");
+            imagesdatayable.Columns.Add("FileSize");
+            imagesdatayable.Columns.Add("FileState");
+            foreach (var fileName in fileNames)
+            {
+                string file_all = fileName;
+                FileInfo f = new FileInfo(file_all);
+                string file_size = (((float)f.Length)/1024).ToString()+" K";
+                imagesdatayable.Rows.Add(f.Name, file_size, state);
+            }
+            ImagesDataTable = imagesdatayable;
+
+        }
+
+        /// <summary>
+        /// 图片转PNG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SavePng(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 图片转JPeG
+        /// picturefile 图片文件名
+        /// filePath 保存路径
+        /// </summary>
+        public bool SaveJpeg(string picturefile, string filePath)
+        {
+            Image img = Image.FromFile(picturefile);
+            try
+            {
+                using (var bmp = new Bitmap(img.Width, img.Height))
+                {
+                    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
+
+                    using (var g = Graphics.FromImage(bmp))
+                    {
+                        g.Clear(Color.White);
+                        g.DrawImageUnscaled(img, 0, 0);
+                    }
+                    //存储各种格式
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Gif);
+                    //bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
+                    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// 插入JPeG图片
+        /// topdfdoc 所要插入的文档
+        /// filename 图片文件名
+        /// fileinfo 文件信息
+        /// width page宽
+        /// height page高
+        /// index 插入位置
+        /// </summary>
+        private void JpegInsertPage(ref CPDFDocument topdfdoc,string filename, FileInfo fileinfo,int width,int height,int index=0) {
+
+            string tempFileName = "";
+            if (fileinfo.Extension == ".jpg"|| fileinfo.Extension == ".jpeg")
+            {
+                topdfdoc.InsertPage(index, width, height, filename);
+            }
+            else 
+            {
+                tempFileName = Path.GetTempPath() + "pngtemp.jpg";
+                if (!PictureConverter.SaveJpeg(filename, tempFileName))
+                { 
+                    MessageBoxEx.Show("图片格式有问题");
+                }
+                topdfdoc.InsertPage(index, width, height, tempFileName);
+            }
+        }
+        #endregion
+
+        #region 构架行为
+        public string Title => "图片转PDF";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            string[] filepath=null;
+            parameters.TryGetValue<string[]>(ParameterNames.FilePath, out filepath);
+            if (filepath!=null)
+            {
+                fileNames=filepath.ToList();
+                ImagesDataTable.Columns.Add("FileName");
+                ImagesDataTable.Columns.Add("FileSize");
+                ImagesDataTable.Columns.Add("FileState");
+                updateListview("待确定");
+            }
+        }
+        #endregion
+    }
+}

+ 416 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -0,0 +1,416 @@
+using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Windows.Controls;
+using System.Windows;
+using System.Diagnostics;
+using System.Drawing.Printing;
+using PDFSettings;
+using ComPDFKit.PDFDocument;
+using PDF_Office.Model;
+using System.Drawing;
+using System.Reflection;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using System.Threading.Tasks;
+using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.SetPasswordDialogModel;
+using ComPDFKit.PDFPage;
+using PDF_Office.Helper;
+using System.Drawing.Drawing2D;
+using static PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialogModel;
+using ComPDFKitViewer.PdfViewer;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterDialogViewModel : BindableBase, IDialogAware, INavigationAware
+    {
+        public IDialogService Dialogs;
+        public IRegionManager PrintModRegion;
+        private Object locker = new Object();
+        private CPDFViewer currentViewer;
+        private string currentPrintModName;
+
+        public Dictionary<string, string> GetContentByPrintMod;
+        public Dictionary<int, string> GetPrinterNameByPrinterIndex;
+
+        public HomePagePrinterDialogModel homePagePrinterDialogModel;
+        public PrintSettingsInfo printSettingsInfo;
+
+        private Visibility _printModVisible = Visibility.Collapsed;
+        public Visibility PrintModVisible
+        {
+            get { return _printModVisible; }
+            set { SetProperty(ref _printModVisible, value); }
+        }
+
+        #region 界面和组件初始化
+        private string _printModRegionName;
+        public string PrintModRegionName
+        {
+            get
+            {
+                return _printModRegionName;
+            }
+            set
+            {
+                SetProperty(ref _printModRegionName, value);
+            }
+        }
+
+        private List<string> _printerNameList;
+        public List<string> PrinterNameList
+        {
+            get { return _printerNameList; }
+            set { _printerNameList = value; }
+        }
+
+        private List<string> _printContentList;
+        public List<string> PrintContentList
+        {
+            get { return _printContentList; }
+            set { _printContentList = value; }
+        }
+
+        private List<string> _printerDirectionList;
+        private CPDFDocument document;
+
+        public List<string> PrintDirectionList
+        {
+            get { return _printerDirectionList; }
+            set { _printerDirectionList = value; }
+        }
+        #endregion
+
+        #region 属性设置
+        private int _printerIndex;
+        public int PrinterIndex
+        {
+            get { return _printerIndex; }
+            set { _printerIndex = value; }
+        }
+        #endregion
+
+        #region 打印
+        private PrintDocument printDocument = new PrintDocument();
+        private PrinterSettings printerSettings = new PrinterSettings();
+        private PageSettings PageSettings = new PageSettings();
+
+        /// <summary>
+        ///待打印页面集合,存储页面索引值
+        /// </summary>
+        private List<int> TargetPages = new List<int>();
+
+        private int currentListIndex = 0;
+        private bool annotation = true;
+        private bool form = true;
+
+        private int currentViewerPageIndex = 0;
+
+        System.Drawing.Point location = new System.Drawing.Point(10, 10);
+        System.Drawing.Size size = new System.Drawing.Size(600, 150);
+        #endregion
+
+        public DelegateCommand<object> DelegateChangePrintModCommand { get; set; }
+
+        public HomePagePrinterDialogViewModel(IDialogService dialogService, IRegionManager regionManager)
+        {
+            Dialogs = dialogService;
+            PrintModRegion = regionManager;
+            PrintModVisible = Visibility.Visible;
+            PrintModRegionName = Guid.NewGuid().ToString();
+            DelegateChangePrintModCommand = new DelegateCommand<object>(ChangePrintMod);
+            homePagePrinterDialogModel = new HomePagePrinterDialogModel();
+            printSettingsInfo = new PrintSettingsInfo();
+
+            GetContentByPrintMod = new Dictionary<string, string>();
+            InitGetContentByPrintMod(ref GetContentByPrintMod);
+
+            GetPrinterNameByPrinterIndex = new Dictionary<int, string>();
+            InitGetPrinterNameByPrinterIndex(ref GetPrinterNameByPrinterIndex);
+
+            InitComponentAsync();
+            InitPrinterSettings();
+
+        }
+
+        #region 组件初始化
+        private void InitComponentAsync()
+        {
+            InitPrinterNameList();
+            InitPrintContentList();
+            InitPrintContentList();
+            InitPrintDirectionList();
+        }
+
+        private void PaintPageAtIndex(object currentViewerIndex)
+        {
+            try
+            {
+                lock (locker)
+                {
+                    #region 根据不同打印模式 做不同处理
+                    switch (currentPrintModName)
+                    {
+                        case "ModPoster":
+
+                            break;
+                        case "ModMutiple":
+
+                            break;
+                        case "ModBooklet":
+                            //打印机要适时设置双面打印
+
+                            break;
+                        case "ModSize"://普通 大小模式
+                        default:
+                            PreviewModSize(currentViewerPageIndex);
+                            break;
+                    }
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        private void InitPrinterNameList()
+        {
+            PrinterNameList = new List<string>();
+            PrintDocument printDocument = new PrintDocument();
+            string defaultPrinterName = printDocument.PrinterSettings.PrinterName;
+
+            foreach (string printerListItem in PrinterSettings.InstalledPrinters)
+            {
+                PrinterNameList.Add(printerListItem);
+            }
+        }
+        private void InitPrintContentList()
+        {
+            PrintContentList = new List<string>();
+            PrintContentList.Add("文档");
+            PrintContentList.Add("文档和标记");
+            PrintContentList.Add("文档和图章");
+        }
+
+        private void InitPrintDirectionList()
+        {
+            PrintDirectionList = new List<string>();
+            PrintDirectionList.Add("横向");
+            PrintDirectionList.Add("纵向");
+        }
+
+        private void InitGetContentByPrintMod(ref Dictionary<string, string> dictionary)
+        {
+            dictionary.Add("ModSize", "HomePagePrinterModSizeContent");
+            dictionary.Add("ModPoster", "HomePagePrinterModPosterContent");
+            dictionary.Add("ModMutiple", "HomePagePrinterModMutipleContent");
+            dictionary.Add("ModBooklet", "HomePagePrinterModBookletContent");
+        }
+
+        private void InitGetPrinterNameByPrinterIndex(ref Dictionary<int, string> dictionary)
+        {
+            int index = 0;
+            PrinterNameList = new List<string>();
+            PrintDocument printDocument = new PrintDocument();
+            string defaultPrinterName = printDocument.PrinterSettings.PrinterName;
+
+            foreach (string printerListItem in PrinterSettings.InstalledPrinters)
+            {
+                dictionary.Add(index++, printerListItem);
+            }
+            if (index == 0)
+            {
+#if DEBUG
+                MessageBox.Show("No Printer!");
+#endif
+            }
+        }
+
+        #endregion
+
+        #region 打印初始化
+        public double GetDpiByGraphics()
+        {
+            BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
+            PropertyInfo property = typeof(SystemParameters).GetProperty("Dpi", bindingAttr);
+            return (int)property.GetValue(null, null);
+        }
+        public void InitPrinterSettings()
+        {
+            location = new System.Drawing.Point((int)(18 * GetDpiByGraphics() / 120), (int)(66 * GetDpiByGraphics() / 120));
+            size = new System.Drawing.Size((int)(624 * GetDpiByGraphics() / 120), (int)(130 * GetDpiByGraphics() / 120));
+        }
+
+        public async Task InitPrintParamsAsync()
+        {
+            printSettingsInfo.PrinterName = GetPrinterNameByPrinterIndex[PrinterIndex];
+            printSettingsInfo.Copies = 1;
+            printSettingsInfo.IsBlackAndWhite = false;
+            printSettingsInfo.IsReverseOrder = false;
+            printSettingsInfo.PrintWithAnnot = true;
+            printSettingsInfo.PrintWithForm = true;
+            printSettingsInfo.EnumPrintOrientation = EnumPrintOrientation.StatusHorizontal;
+
+            SizeSetttingsInfo sizeSetttingsInfo = new SizeSetttingsInfo();
+            sizeSetttingsInfo.SizeType = EnumSizeType.StatusAdaptive;
+            sizeSetttingsInfo.DisplayRatio = 100;
+            printSettingsInfo.SizeSetttingsInfo = sizeSetttingsInfo;
+
+            await Task.Run(() => { PaintPageAtIndex(currentViewerPageIndex); });
+        }
+        #endregion
+
+        #region 四种打印的预览
+        /// <summary>
+        /// 重新调整图片大小(比例不变) 缩放图片
+        /// 可以直接传入目标区域大小,不会丢失原图比例
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="size"></param>
+        /// <returns></returns>
+        public System.Drawing.Image ResizeImage(System.Drawing.Image image, System.Drawing.Size size)
+        {
+            //获取图片宽度
+            int sourceWidth = image.Width;
+            //获取图片高度
+            int sourceHeight = image.Height;
+
+            float nPercent = 0;
+            float nPercentW = 0;
+            float nPercentH = 0;
+            //计算宽度的缩放比例
+            //nPercentW = ((float)size.Width * (float)GetDpiByGraphics()/120/ (float)sourceWidth);
+            ////计算高度的缩放比例
+            //nPercentH = ((float)size.Height*(float)GetDpiByGraphics() / 120 / (float)sourceHeight);
+            nPercentW = ((float)size.Width / (float)sourceWidth);
+            //计算高度的缩放比例
+            nPercentH = ((float)size.Height / (float)sourceHeight);
+
+            if (nPercentH < nPercentW)
+                nPercent = nPercentH;
+            else
+                nPercent = nPercentW;
+            //期望的宽度
+            int destWidth = (int)(sourceWidth * nPercent);
+            //期望的高度
+            int destHeight = (int)(sourceHeight * nPercent);
+
+            System.Drawing.Bitmap b = new System.Drawing.Bitmap(destWidth, destHeight);
+            Graphics g = Graphics.FromImage((System.Drawing.Image)b);
+            //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
+            g.SmoothingMode = SmoothingMode.None; //抗锯齿
+            g.InterpolationMode = InterpolationMode.HighQualityBicubic; //高质量的双三次插值
+            g.CompositingQuality = CompositingQuality.HighQuality; //高质量、低速度复合
+            //绘制图像
+            g.DrawImage(image, 0, 0, destWidth, destHeight);
+            g.Dispose();
+            return (System.Drawing.Image)b;
+        }
+
+        private async void PreviewModSize(int pageIndex)
+        {
+            CPDFPage cPDFPage = document.PageAtIndex(pageIndex);
+            if (cPDFPage == null)
+            {
+                double left = 0;
+                double top = 0;
+                double rate = 0;
+                int dpi = (int)GetDpiByGraphics();
+                Bitmap bitmap = await ToolMethod.RenderPageBitmap(document, (int)(cPDFPage.PageSize.Width * rate * 1.4), (int)(cPDFPage.PageSize.Height * rate * 1.4), pageIndex, printSettingsInfo.PrintWithAnnot, printSettingsInfo.PrintWithForm);
+                var pageBound = printDocument.DefaultPageSettings.Bounds;
+                double ZoomRate = (double)printSettingsInfo.SizeSetttingsInfo.DisplayRatio / 100.0;
+                if (printSettingsInfo.SizeSetttingsInfo.SizeType == EnumSizeType.StatusAdaptive)
+                {
+                    float zoompercent = 0;
+                    float percentW = 0;
+                    float percentH = 0;
+                    percentW = ((float)(pageBound.Width * rate) / (float)bitmap.Width);
+                    percentH = ((float)(pageBound.Height * rate) / (float)bitmap.Height);
+                    zoompercent = percentH > percentW ? percentW : percentH;
+
+                    var newSize = new System.Drawing.Size((int)(bitmap.Width * zoompercent), (int)(bitmap.Height * zoompercent));
+                    bitmap = (Bitmap)ResizeImage(bitmap, newSize);
+
+                    left = (pageBound.Width * rate - bitmap.Width) / 2;
+                    top = (pageBound.Height * rate - bitmap.Height) / 2;
+
+                    int pwidth = (int)(pageBound.Width * rate);
+                    int pheight = (int)(pageBound.Height * rate);
+
+                    Bitmap bmp = new Bitmap(pwidth, pheight);
+                    Graphics g = Graphics.FromImage(bmp);
+                    g.DrawImage(bitmap, (float)left, (float)top, bitmap.Width, bitmap.Height);
+                }
+            }
+        }
+        #endregion
+
+        private void EnterSelectedMod(string currentPrinterModContent)
+        {
+            NavigationParameters param = new NavigationParameters();
+            PrintModVisible = Visibility.Collapsed;
+            PrintModRegion.RequestNavigate(PrintModRegionName, GetContentByPrintMod[currentPrinterModContent]);
+            PrintModVisible = Visibility.Visible;
+            //TODO:
+        }
+
+
+
+        private void ChangePrintMod(object e)
+        {
+            var args = e as Button;
+            if (args != null)
+            {
+                currentPrintModName = args.Name;
+                EnterSelectedMod(currentPrintModName);
+                //TODO:
+            }
+        }
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer viewer = null;
+            string filepath = "";
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out viewer);
+            parameters.TryGetValue<string>(ParameterNames.FilePath, out filepath);
+            if (viewer != null && viewer.Document != null)
+            {
+                currentViewer = viewer;
+                document = currentViewer.Document;
+                InitPrintParamsAsync();
+
+            }
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 30 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContentViewModel.cs

@@ -0,0 +1,30 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModBookletContentViewModel : BindableBase, INavigationAware
+    {
+        public HomePagePrinterModBookletContentViewModel()
+        {
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 30 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContentViewModel.cs

@@ -0,0 +1,30 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModMutipleContentViewModel : BindableBase, INavigationAware
+    {
+        public HomePagePrinterModMutipleContentViewModel()
+        {
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 27 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContentViewModel.cs

@@ -0,0 +1,27 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModPosterContentViewModel : BindableBase, INavigationAware
+    {
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 29 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs

@@ -0,0 +1,29 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterModSizeContentViewModel : BindableBase, INavigationAware
+    {
+        public HomePagePrinterModSizeContentViewModel()
+        {
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 35 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialogViewModel.cs

@@ -0,0 +1,35 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterPageSetDialogViewModel : BindableBase, IDialogAware
+    {
+        public HomePagePrinterPageSetDialogViewModel()
+        {
+
+        }
+
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+
+        }
+    }
+}

+ 461 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePageSplitDialogViewModel.cs

@@ -0,0 +1,461 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using PDF_Office.Helper;
+using System.Diagnostics;
+using PDF_Office.CustomControl;
+using PDF_Office.Model.HomePageToolsDialogs;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs
+{
+    public class HomePageSplitDialogViewModel : BindableBase, IDialogAware
+    {
+        #region 参数和属性
+        public CPDFDocument document;
+
+        private CPDFViewer currentViewer;
+
+        private HomePageSplitDialogModel splitModel = new HomePageSplitDialogModel();
+
+        private string savefilepath { get; set; }
+
+        private string savefilename { get; set; }
+
+        private string pageRangeText = "0";
+        public string PageRangeText { set; get; } = "0";
+        
+        public string PageRangeSelectIndex { set; get; } = "0";
+
+        private string averagePagesIsCheck = "True";
+        public string AveragePagesIsCheck
+        {
+            get { return averagePagesIsCheck; }
+            set
+            {
+                SetProperty(ref averagePagesIsCheck, value);
+            }
+        }
+
+        private string averageFilesIsCheck = "False";
+        public string AverageFilesIsCheck
+        {
+            get { return averageFilesIsCheck; }
+            set
+            {
+                SetProperty(ref averageFilesIsCheck, value);
+            }
+        }
+
+        private string customPageRangeIsCheck = "False";
+        public string CustomPageRangeIsCheck
+        {
+            get { return customPageRangeIsCheck; }
+            set
+            {
+                SetProperty(ref customPageRangeIsCheck, value);
+            }
+        }
+
+        private string averagePagesIsEnabled = "True";
+        public string AveragePagesIsEnabled
+        {
+            get { return averagePagesIsEnabled; }
+            set
+            {
+                SetProperty(ref averagePagesIsEnabled, value);
+            }
+        }
+
+        private string averageFilesIsEnabled = "False";
+        public string AverageFilesIsEnabled
+        {
+            get { return averageFilesIsEnabled; }
+            set
+            {
+                SetProperty(ref averageFilesIsEnabled, value);
+            }
+        }
+
+        private string customPageRangeIsEnabled = "False";
+        public string CustomPageRangeIsEnabled
+        {
+            get { return customPageRangeIsEnabled; }
+            set
+            {
+                SetProperty(ref customPageRangeIsEnabled, value);
+            }
+        }
+
+        public string AveragePagesText { set; get; } = "";
+
+        public string AverageFilesText { set; get; } = "";
+        
+
+        private string filePathName = "";
+        public string FilePathName
+        {
+            get { return filePathName; }
+            set
+            {
+                SetProperty(ref filePathName, value);
+            }
+        }
+
+        public string FileNameLabelText{ set; get; } = "part";
+        
+
+        public string FileNameDeimiterText{ set; get; } = "-";
+        
+
+        public string FrontFileIsCheck { set; get; } = "True";
+       
+        public string FileNameLabelIsCheck { set; get; } = "True";
+
+        public string FileNameDeimiterIsCheck { set; get; } = "True";
+
+        private string fileNameLabelIsEnabled = "False";
+        public string FileNameLabelIsEnabled
+        {
+            get { return fileNameLabelIsEnabled; }
+            set
+            {
+                SetProperty(ref fileNameLabelIsEnabled, value);
+            }
+        }
+
+        private string fileNameDeimiterIsEnabled = "False";
+        public string FileNameDeimiterIsEnabled
+        {
+            get { return fileNameDeimiterIsEnabled; }
+            set
+            {
+                SetProperty(ref fileNameDeimiterIsEnabled, value);
+            }
+        }
+        #endregion
+
+        #region 委托声明
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand SplitCommand { get; set; }
+
+        public DelegateCommand AveragePagesCommand { get; set; }
+
+        public DelegateCommand AverageFilesCommand { get; set; }
+
+        public DelegateCommand CustomPageRangeCommand { get; set; }
+
+        public DelegateCommand FrontFileNameCommand { get; set; }
+
+        public DelegateCommand FileNameLabelCommand { get; set; }
+
+        public DelegateCommand FileNameDeimiterCommand { get; set; }
+
+        public DelegateCommand FileNameDeimiterChangeCommand { get; set; }
+
+        public DelegateCommand FileNameLabelChangeCommand { get; set; }
+        #endregion
+
+        public HomePageSplitDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(cancel);
+            SplitCommand = new DelegateCommand(split);
+            AveragePagesCommand = new DelegateCommand(averagePages);
+            AverageFilesCommand = new DelegateCommand(averageFiles);
+            CustomPageRangeCommand = new DelegateCommand(customPageRange);
+            FrontFileNameCommand = new DelegateCommand(frontFileName);
+            FileNameLabelCommand = new DelegateCommand(fileNameLabel);
+            FileNameDeimiterCommand = new DelegateCommand(fileNameDeimiter);
+            FileNameDeimiterChangeCommand = new DelegateCommand(fileNameDeimiter);
+            FileNameLabelChangeCommand = new DelegateCommand(fileNameLabel);
+
+
+        }
+        #region 逻辑函数
+        private void FileNameIsCheck()
+        {
+
+            if (FileNameDeimiterIsCheck == "True")
+            {
+                splitModel.FileNameDeimiter = FileNameDeimiterText;
+            }
+            else
+            {
+                splitModel.FileNameDeimiter = "";
+            }
+
+            if (FileNameDeimiterIsCheck == "True")
+            {
+                splitModel.FileNameDeimiter = FileNameDeimiterText;
+            }
+            else
+            {
+                splitModel.FileNameDeimiter = "";
+            }
+            if (FileNameLabelIsCheck == "True")
+            {
+                splitModel.FrontFileName = true;
+                splitModel.FileName = (savefilepath + currentViewer.Document.FileName + splitModel.FileNameDeimiter + splitModel.FileNameLabel);
+            }
+            else
+            {
+                splitModel.FrontFileName = false;
+                splitModel.FileName = (savefilepath + splitModel.FileNameLabel + splitModel.FileNameDeimiter + currentViewer.Document.FileName);
+            }
+        }
+
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void split()
+        {
+            HomePageEditHelper.GetPagerange(PageRangeSelectIndex, currentViewer, ref splitModel.PageRange, PageRangeText);
+            FileNameIsCheck();
+            char[] enumerationSeparator = new char[] { ',' };
+            char[] rangeSeparator = new char[] { '-' };
+            if (!CommonHelper.GetPagesInRange(ref splitModel.PageParm, splitModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
+            { //TODO
+                Trace.WriteLine("输入不对");
+                MessageBoxEx.Show("输入不对");
+                return;
+            }
+            Trace.WriteLine("splitModel.PageRange: " + splitModel.PageRange + "-----");
+            if (splitModel.Mode == HomePageSplitDialogModel.SplitMode.AveragePages)
+            {
+                if (AveragePagesText != "")
+                {
+                    splitModel.GetModeCount = int.Parse(AveragePagesText);
+                }
+                int averagepagesremainder = 0;
+                var averagepagesdocs = HomePageEditHelper.AverageSplitPages(currentViewer.Document.PageCount, splitModel.GetModeCount, ref averagepagesremainder);
+                int averagepagesdoc;
+                for (averagepagesdoc = 1; averagepagesdoc < averagepagesdocs; averagepagesdoc++)
+                {
+                    CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                    extractdoc.ImportPages(currentViewer.Document, (1 + splitModel.GetModeCount * (averagepagesdoc - 1)).ToString() + "-" + (splitModel.GetModeCount * averagepagesdoc).ToString());
+
+                    extractdoc.WriteToFilePath(splitModel.FileName + averagepagesdoc.ToString() + ".pdf");
+
+                    extractdoc.Release();
+                }
+                if (averagepagesdoc == averagepagesdocs)
+                {
+                    CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                    extractdoc.ImportPages(currentViewer.Document, (1 + splitModel.GetModeCount * (averagepagesdoc - 1)).ToString() + "-" + currentViewer.Document.PageCount.ToString());
+                    extractdoc.WriteToFilePath(splitModel.FileName + averagepagesdoc.ToString() + ".pdf");
+                }
+            }
+            if (splitModel.Mode == HomePageSplitDialogModel.SplitMode.AverageFiles)
+            {
+                if (AverageFilesText != "")
+                {
+                    splitModel.GetModeCount = int.Parse(AverageFilesText);
+                }
+                int averagefilesremainder = 0;
+                var averagefilespages = HomePageEditHelper.AverageSplitDocs(currentViewer.Document.PageCount, splitModel.GetModeCount, ref averagefilesremainder);
+                int averagefilesdoc;
+                if (splitModel.GetModeCount > currentViewer.Document.PageCount)
+                {
+                    splitModel.GetModeCount = 10;
+                }
+                for (averagefilesdoc = 1; averagefilesdoc <= splitModel.GetModeCount; averagefilesdoc++)
+                {
+                    CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                    if (averagefilesremainder > 0)
+                    {
+                        extractdoc.ImportPages(currentViewer.Document, (1 + (averagefilespages + 1) * (averagefilesdoc - 1)).ToString() + "-" + ((averagefilespages + 1) * averagefilesdoc).ToString());
+                        extractdoc.WriteToFilePath(splitModel.FileName + averagefilesdoc.ToString() + ".pdf");
+                        averagefilesremainder--;
+                    }
+                    else
+                    {
+                        extractdoc.ImportPages(currentViewer.Document, (averagefilespages * averagefilesremainder + averagefilesremainder + 1 + averagefilespages * (averagefilesdoc - 1)).ToString() + "-" + (averagefilespages * averagefilesremainder + averagefilesremainder + (averagefilespages * averagefilesdoc)).ToString());
+                        extractdoc.WriteToFilePath(splitModel.FileName + averagefilesdoc.ToString() + ".pdf");
+                    }
+                    extractdoc.Release();
+                }
+            }
+            if (splitModel.Mode == HomePageSplitDialogModel.SplitMode.CustomPageRange)
+            {
+                CPDFDocument extractdoc = CPDFDocument.CreateDocument();
+                extractdoc.ImportPages(currentViewer.Document, splitModel.PageRange);
+                extractdoc.WriteToFilePath(splitModel.FileName + "1" + ".pdf");
+                if (splitModel.PageRange != "1-" + currentViewer.Document.PageCount.ToString())
+                {
+                    currentViewer.Document.RemovePages(splitModel.PageParm.ToArray());
+                    currentViewer.Document.WriteToFilePath(splitModel.FileName + "2" + ".pdf");
+                }
+            }
+            System.Diagnostics.Process.Start("Explorer", "/select," + currentViewer.Document.FilePath);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
+        }
+
+        private void averagePages()
+        {
+            CustomPageRangeIsCheck = "False";
+            AverageFilesIsCheck = "False";
+            AveragePagesIsCheck = "True";
+
+            CustomPageRangeIsEnabled = "False";
+            AverageFilesIsEnabled = "False";
+            AveragePagesIsEnabled = "True";
+            splitModel.Mode = HomePageSplitDialogModel.SplitMode.AveragePages;
+        }
+
+        private void averageFiles()
+        {
+            CustomPageRangeIsCheck = "False";
+            AverageFilesIsCheck = "True";
+            AveragePagesIsCheck = "False";
+
+            CustomPageRangeIsEnabled = "False";
+            AverageFilesIsEnabled = "True";
+            AveragePagesIsEnabled = "False";
+            splitModel.Mode = HomePageSplitDialogModel.SplitMode.AverageFiles;
+        }
+
+        private void customPageRange()
+        {
+            CustomPageRangeIsCheck = "True";
+            AverageFilesIsCheck = "False";
+            AveragePagesIsCheck = "False";
+
+            CustomPageRangeIsEnabled = "True";
+            AverageFilesIsEnabled = "False";
+            AveragePagesIsEnabled = "False";
+            splitModel.Mode = HomePageSplitDialogModel.SplitMode.CustomPageRange;
+
+        }
+
+        private void frontFileName()
+        {
+            if (FileNameLabelIsCheck == "False")
+            {
+                FileNameLabelText = "";
+            }
+            if (FileNameDeimiterIsCheck == "False")
+            { FileNameDeimiterText = ""; }
+            if (FrontFileIsCheck == "True")
+            {
+                FilePathName = savefilename + FileNameDeimiterText + FileNameLabelText;
+                splitModel.FrontFileName = true;
+            }
+            else
+            {
+                splitModel.FrontFileName = false;
+                FilePathName = FileNameLabelText + FileNameDeimiterText + savefilename;
+            }
+
+        }
+
+        private void fileNameLabel()
+        {
+            if (FileNameDeimiterIsCheck == "False")
+            {
+                FileNameDeimiterText = "";
+            }
+            if (FileNameLabelIsCheck == "True")
+            {
+                FileNameLabelIsEnabled = "True";
+                if (FrontFileIsCheck == "True")
+                {
+                    FilePathName = savefilename + FileNameDeimiterText + FileNameLabelText;
+                    splitModel.FrontFileName = true;
+                }
+                else
+                {
+                    splitModel.FrontFileName = false;
+                    FilePathName = FileNameLabelText + FileNameDeimiterText + savefilename;
+                }
+            }
+            else
+            {
+                FileNameLabelIsEnabled = "False";
+
+                if (FrontFileIsCheck == "True")
+                {
+                    FilePathName = savefilename + FileNameDeimiterText;
+                    splitModel.FrontFileName = true;
+                }
+                else
+                {
+                    splitModel.FrontFileName = false;
+                    FilePathName = FileNameDeimiterText + savefilename;
+                }
+            }
+
+        }
+
+        private void fileNameDeimiter()
+        {
+
+            if (FileNameLabelIsCheck == "False")
+            {
+                FileNameLabelText = "";
+            }
+            if (FileNameDeimiterIsCheck == "True")
+            {
+                FileNameDeimiterIsEnabled = "True";
+                if (FrontFileIsCheck == "True")
+                {
+                    FilePathName = savefilename + FileNameDeimiterText + FileNameLabelText;
+                }
+                else
+                {
+                    FilePathName = FileNameLabelText + FileNameDeimiterText + savefilename;
+                }
+            }
+            else
+            {
+                FileNameDeimiterIsEnabled = "False";
+                if (FrontFileIsCheck == "True")
+                {
+                    FilePathName = savefilename + FileNameLabelText;
+                }
+                else
+                {
+                    FilePathName = FileNameLabelText + savefilename;
+                }
+            }
+        }
+        #endregion
+
+        #region 构架行为
+        public string Title => "";
+
+        public event Action<IDialogResult> RequestClose;
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            CPDFViewer viewer = null;
+            string filepath = "";
+            parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out viewer);
+            parameters.TryGetValue<string>(ParameterNames.FilePath, out filepath);
+            if (viewer != null && viewer.Document != null)
+            {
+                currentViewer = viewer;
+                document = viewer.Document;
+                savefilename = currentViewer.Document.FileName;
+                FilePathName = savefilename + "-" + "part" + ".pdf";
+                savefilepath = filepath.Replace(savefilename + ".pdf", "");
+            }
+        }
+        #endregion
+    }
+}

+ 94 - 55
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -1,55 +1,94 @@
-using PDF_Office.Model.PDFTool;
-using PDF_Office.Views.HomePanel.PDFTools;
-using Prism.Commands;
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.HomePanel
-{
-    public class HomeGuidContentViewModel:BindableBase
-    {
-        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
-        public HomeGuidContentViewModel()
-        {
-            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
-        }
-
-        public void QuickTools_Click(ToolItem toolItem)
-        {
-            switch (toolItem.Tag)
-            {
-                case PDFToolType.Split:
-                    Split_Click();
-                    break;
-
-                case PDFToolType.Extract:
-                    break;
-
-                case PDFToolType.Insert:
-                    break;
-
-                case PDFToolType.Compress:
-                    break;
-
-                case PDFToolType.Merge:
-                    break;
-
-                case PDFToolType.Print:
-                    break;
-
-                case PDFToolType.Security:
-                    break;
-            }
-        }
-
-        private void Split_Click()
-        {
-
-        }
-
-    }
-}
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Model;
+using PDF_Office.Model.PDFTool;
+using PDF_Office.Views.HomePanel.PDFTools;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml.Linq;
+
+namespace PDF_Office.ViewModels.HomePanel
+{
+    public class HomeGuidContentViewModel : BindableBase
+    {
+        public IDialogService dialogs;
+        public DelegateCommand<ToolItem> QuickToolsCommand { get; set; }
+        public HomeGuidContentViewModel(IDialogService dialogService)
+        {
+            QuickToolsCommand = new DelegateCommand<ToolItem>(QuickTools_Click);
+            dialogs = dialogService;
+        }
+
+        public void QuickTools_Click(ToolItem toolItem)
+        {
+            /*
+             *设置这个对话框的起始保存路径
+             */
+            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
+            dlg.Multiselect = false;
+            dlg.Filter = "PDF|*.pdf;*.PDF;";
+            if (toolItem.Tag == PDFToolType.Merge)
+            {
+                dlg.Multiselect = true;
+                dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;*webp;";
+            }
+            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                CPDFViewer viewer = new CPDFViewer();
+                viewer.InitDocument(dlg.FileName);
+                switch (toolItem.Tag)
+                {
+                    case PDFToolType.Split:
+                        DialogParameters splitvalue = new DialogParameters();
+                        splitvalue.Add(ParameterNames.PDFViewer, viewer);
+                        splitvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
+                        break;
+
+                    case PDFToolType.Extract:
+                        DialogParameters extractvalue = new DialogParameters();
+                        extractvalue.Add(ParameterNames.PDFViewer, viewer);
+                        extractvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
+                        break;
+
+                    case PDFToolType.Insert:
+                        DialogParameters insertvalue = new DialogParameters();
+                        insertvalue.Add(ParameterNames.PDFViewer, viewer);
+                        insertvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
+                        break;
+
+                    case PDFToolType.Compress:
+                        break;
+
+                    case PDFToolType.Merge:
+                        DialogParameters picturetopdf = new DialogParameters();
+                        picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
+                        dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
+                        break;
+
+                    case PDFToolType.Print:
+                        DialogParameters printvalue = new DialogParameters();
+                        printvalue.Add(ParameterNames.PDFViewer, viewer); ;
+                        printvalue.Add(ParameterNames.FilePath, dlg.FileName);
+                        dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
+                        break;
+
+                    case PDFToolType.Security:
+                        break;
+                }
+
+            }
+        }
+
+    }
+}

+ 0 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -286,7 +286,6 @@ namespace PDF_Office.ViewModels
                     }
                     previousBar = currentBar;
                 }
-
             }
         }
 

+ 0 - 9
PDF Office/Views/Dialog/CompressWindow.xaml

@@ -1,9 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.Dialog.CompressDialog"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True">
-    <Grid>
-        <TextBlock Text="Hello"></TextBlock>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/Dialog/CompressWindow.xaml.cs

@@ -1,15 +0,0 @@
-using System.Windows.Controls;
-
-namespace PDF_Office.Views.Dialog
-{
-    /// <summary>
-    /// Interaction logic for CompressWindow
-    /// </summary>
-    public partial class CompressDialog : UserControl
-    {
-        public CompressDialog()
-        {
-            InitializeComponent();
-        }
-    }
-}

+ 70 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageExtractDialog.xaml

@@ -0,0 +1,70 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageExtractDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              d:DesignHeight="404"
+             d:DesignWidth="490"
+             mc:Ignorable="d">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="63"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Text="提取" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="291">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="1*"/>
+                    <ColumnDefinition Width="1*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="ExtractPreview" Loaded="PageTurningPreview_Loaded" ></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="5*"/>
+                        <RowDefinition Height="5*"/>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Vertical" Margin="0,40,0,0">
+                            <TextBlock Text="页面范围" FontWeight="ExtraBlack" Width="56" Height="22" HorizontalAlignment="Left"/>
+                            <cus:WritableComboBox Width="208" Height="32" HorizontalAlignment="Left" Margin="0,20,0,0" Text="{Binding PageRangeText,Mode=TwoWay}" SelectedIndex="{Binding PageRangeSelectIndex,Mode=TwoWay}"></cus:WritableComboBox>
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="页面范围" FontWeight="ExtraBlack" Width="56" Height="22" HorizontalAlignment="Left"/>
+                            <CheckBox Margin="0,20,0,0" Command="{Binding ExtractToSingleFileCommand}" IsChecked="{Binding ExtractToSingleFileIsCheck}">
+                                <TextBlock Text="每个页面作为单独页面"></TextBlock>
+                            </CheckBox>
+                            <CheckBox Margin="0,20,0,0" Command="{Binding DeleteAfterExtractCommand}" IsChecked="{Binding DeleteAfterExtractIsCheck}">
+                                <TextBlock Text="提取后删除页面"></TextBlock>
+                            </CheckBox>
+                        </StackPanel>
+                    </Grid>
+                </Grid>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="2">
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="0,0,124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding ExtractCommand}"
+                    Content="提取" />
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+        </Grid>
+    </Grid>
+</UserControl>

+ 37 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageExtractDialog.xaml.cs

@@ -0,0 +1,37 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
+using System;
+using System.Collections.Generic;
+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;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs
+{
+    /// <summary>
+    /// MainPageExtractDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class HomePageExtractDialog : UserControl
+    {
+        public HomePageExtractDialog()
+        {
+            InitializeComponent();
+        }
+
+        private void PageTurningPreview_Loaded(object sender, RoutedEventArgs e)
+        {
+            ExtractPreview.document = ((HomePageExtractDialogViewModel)this.DataContext).document;
+            ExtractPreview.AwaitRenderBitmap(ExtractPreview.document);
+            ExtractPreview.PageIndex.Text = ExtractPreview.document.PageCount.ToString();
+
+        }
+    }
+}

+ 86 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageInsertDialog.xaml

@@ -0,0 +1,86 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageInsertDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="441"
+             d:DesignWidth="600"
+             mc:Ignorable="d">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="48"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="64"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Text="插入" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="329">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="3*"/>
+                    <ColumnDefinition Width="4*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <cus:PageTurningPreview x:Name="InsertPreview" Loaded="PageTurningPreview_Loaded"></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1" Margin="7,27,13,40">
+                    <Grid.RowDefinitions>
+                        <RowDefinition></RowDefinition>
+                        <RowDefinition></RowDefinition>
+                        <RowDefinition></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <StackPanel Grid.Row="0" Orientation="Vertical">
+                        <TextBlock Text="插入文件"></TextBlock>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBox Height="32" Width="198" Margin="0,0,4,0" VerticalContentAlignment="Center" Text="{Binding SelectFilePath}" Padding="16,0,6,0"></TextBox>
+                            <Button Height="32" Width="56" Content="选择" Command="{Binding SelectFileCommand}"></Button>
+                        </StackPanel>
+                    </StackPanel>
+                    <Grid Grid.Row="1"></Grid>
+                    <StackPanel Grid.Row="1" Orientation="Vertical">
+                        <TextBlock Text="插入位置" Height="22" Width="56" HorizontalAlignment="Left"></TextBlock>
+                        <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
+                            <RadioButton x:Name="FirstIsCheckRadioButton"  Margin="0,0,64,0" IsChecked="{Binding FirstIsCheck}" Command="{Binding FirstPageCommand}">
+                                <TextBlock Text="第一页" Margin="12,0,0,0"></TextBlock>
+                            </RadioButton>
+                            <RadioButton x:Name="LastIsCheckRadioButton" IsChecked="{Binding LastIsCheck}" Command="{Binding LastPageCommand}">
+                                <TextBlock Text="最后一页" Margin="12,0,0,0"></TextBlock>
+                            </RadioButton>
+                        </StackPanel>
+                    </StackPanel>
+                    <StackPanel Grid.Row="2" Orientation="Vertical">
+                        <StackPanel Orientation="Horizontal">
+                            <RadioButton x:Name="CustomIsCheckRadioButton" VerticalAlignment="Center" IsChecked="{Binding CustomIsCheck}" Command="{Binding CustomPageCommand}"></RadioButton>
+                            <TextBlock Text="页面" VerticalAlignment="Center"  Margin="12,0,0,0"></TextBlock>
+                            <TextBox Name="PageInsertIndexTextBox" Height="32" Width="100" Text="{Binding PageInsertIndex}" InputMethod.IsInputMethodEnabled="False"  PreviewTextInput="CountTextBox_PreviewTextInput" IsEnabled="{Binding CustomIsEnabled}" TextChanged="PageInsertIndexTextBox_TextChanged"></TextBox>
+                            <TextBlock Text="/" VerticalAlignment="Center"></TextBlock>
+                            <TextBlock Name="PageCountText" Text="{Binding PageNumber}" VerticalAlignment="Center"></TextBlock>
+                        </StackPanel>
+                        <ComboBox Margin="28,7,13,0" SelectedIndex="{Binding PageLocation}">
+                            <ComboBoxItem Content="之后"></ComboBoxItem>
+                            <ComboBoxItem Content="之前"></ComboBoxItem>
+                        </ComboBox>
+                    </StackPanel>
+                </Grid>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="2">
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding InsertCommand}"
+                    Content="插入" />
+        </Grid>
+    </Grid>
+</UserControl>

+ 59 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageInsertDialog.xaml.cs

@@ -0,0 +1,59 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
+using System;
+using System.Collections.Generic;
+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_Office.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)
+            {
+                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;
+            InsertPreview.AwaitRenderBitmap(InsertPreview.document);
+            InsertPreview.PageIndex.Text = InsertPreview.document.PageCount.ToString();
+        }
+    }
+}

+ 156 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml

@@ -0,0 +1,156 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePictureToPDFDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:prism="http://prismlibrary.com/" 
+             xmlns:homepagetoolsdialogs="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs" 
+             d:DataContext="{d:DesignInstance Type=homepagetoolsdialogs:HomePagePictureToPDFDialogViewModel}"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+             d:DesignHeight="554"
+             d:DesignWidth="892"
+             mc:Ignorable="d">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <convert:UnVisivleConvert x:Key="unVisibleConvert"/>
+        </ResourceDictionary>
+    </UserControl.Resources>
+
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="632"/>
+            <ColumnDefinition Width="260"/>
+        </Grid.ColumnDefinitions>
+        <Grid Grid.Column="0">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="482"/>
+                <RowDefinition Height="72"/>
+            </Grid.RowDefinitions>
+            <Button Name="BtnBlank" Grid.Row="0" Background="Green" Height="400" Width="400" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
+            </Button>
+            <ListView x:Name="listView" DataContext="{Binding ImagesDataTable}" Grid.Row="0" Background="White"  ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" Visibility="{Binding ElementName=BtnBlank, Path=Visibility, Converter={StaticResource unVisibleConvert}}">
+                <ListView.ContextMenu>
+                    <ContextMenu  StaysOpen="True" >
+                        <MenuItem Header="打开文件" Name="OpenFileMenuItem"  Click="OpenFileMenuItem_Click"/>
+                        <MenuItem Header="移除" Name="RemoveFileMenuItem" Click="RemoveFileMenuItem_Click"/>
+                    </ContextMenu>
+                </ListView.ContextMenu>
+                <ListView.View>
+                    <GridView>
+                        <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}"/>
+                        <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
+                        <GridViewColumn Header="状态" Width="80" >
+                            <GridViewColumn.CellTemplate>
+                                <DataTemplate>
+                                    <TextBlock Text="{Binding FileState}" TextDecorations="Underline" Foreground="Black"/>
+                                </DataTemplate>
+                            </GridViewColumn.CellTemplate>
+                        </GridViewColumn>
+                    </GridView>
+                </ListView.View>
+                <ListView.ItemContainerStyle>
+                    <Style TargetType="ListViewItem">
+                        <Setter Property="Height" Value="42"/>
+                        <Style.Triggers>
+                            <Trigger Property="ListView.AlternationIndex" Value="1">
+                                <Setter Property="Background" Value="LightGray"/>
+                            </Trigger>
+                        </Style.Triggers>
+                    </Style>
+                </ListView.ItemContainerStyle>
+            </ListView>
+            <Grid Grid.Row="1">
+                <Button x:Name="MenuBtn"  Width="113"
+                    Height="40"
+                    Margin="25,0,0,0"
+                    HorizontalAlignment="Left" Click="Menu_Click">
+                    <StackPanel Orientation="Horizontal" >
+                        <Border HorizontalAlignment="Right">
+                            <TextBlock Text="添加文件" FontSize="18" Foreground="Black"></TextBlock>
+                        </Border>
+                        <Border  Margin="12,0,0,0">
+                            <Path  VerticalAlignment="Center" HorizontalAlignment="Right" Stroke="Black"  Data="M0 0L8 4 L16 0" Height="10" Stretch="Fill" />
+                        </Border>
+                    </StackPanel>
+                </Button>
+                <Popup x:Name="menuPop1" StaysOpen="False"  AllowsTransparency="True" PlacementTarget="{Binding ElementName=MenuBtn}">
+                    <Grid Height="auto" Width="auto" HorizontalAlignment="Left">
+                        <Border BorderThickness="0" CornerRadius="3" Background="White" Margin="3">
+                            <Border.Effect>
+                                <DropShadowEffect ShadowDepth="0" Color="#FFB6B6B6"/>
+                            </Border.Effect>
+                            <StackPanel Margin="0">
+                                <MenuItem x:Name="添加文件" Header="添加文件" Command="{Binding ADDPictureCommand}"></MenuItem>
+                                <MenuItem x:Name="添加文件夹" Header="添加文件夹" Command="{Binding ADDPictureFilesCommand}"></MenuItem>
+                            </StackPanel>
+                        </Border>
+                    </Grid>
+                </Popup>
+
+                <Button
+                    Width="40"
+                    Height="40"
+                    Margin="0,0,90,0"
+                    HorizontalAlignment="Right">
+
+                </Button>
+                <Button
+                    Width="40"
+                    Height="40"
+                    Margin="25,0"
+                    HorizontalAlignment="Right"
+                    IsEnabled="{Binding RemoveIsEnable}"
+                    Command="{Binding RemovePictureFileCommand}">
+
+                </Button>
+            </Grid>
+        </Grid>
+        <Grid Grid.Column="1" Background="WhiteSmoke">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="2*"/>
+                <RowDefinition Height="72"/>
+            </Grid.RowDefinitions>
+            <Grid Grid.Row="0">
+                <StackPanel Margin="15,23,0,0">
+                    <TextBlock Text="导出"/>
+                    <StackPanel Margin="0,8,0,0">
+                        <RadioButton Name="NewFilesRadioButtom" Click="RadioButton_Click" IsChecked="True">
+                            <TextBlock Text="新建文档"/>
+                        </RadioButton>
+                        <RadioButton Name="OneNewFileNameRadioButtom" Margin="0,8,0,0" Click="RadioButton_Click">
+                            <TextBlock Text="合并为同一份PDF文档"/>
+                        </RadioButton>
+                        <RadioButton Name="SelectFileNameRadioButton" Margin="0,8,0,0" Click="RadioButton_Click">
+                            <TextBlock Text="插入现有PDF文档"/>
+                        </RadioButton>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,4,0,0">
+                        <TextBox IsEnabled="False" Text="{Binding SelectFileName}" VerticalContentAlignment="Center" Height="32" Width="190"/>
+                        <Button Width="32" Command="{Binding SelectFileCommand}" IsEnabled="{Binding ElementName=SelectFileNameRadioButton,Path=IsChecked}">
+
+                        </Button>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="1">
+                <StackPanel Margin="15,0,0,0">
+                    <TextBlock Text="OCR"/>
+                    <CheckBox Name="NeedOCRCheckBox" Margin="0,7,0,0">
+                        <TextBlock Text="在需要时识别文本"/>
+                    </CheckBox>
+                    <ComboBox Height="28.55" Width="228" HorizontalAlignment="Left" Margin="0,4,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}"></ComboBox>
+                    <CheckBox  Margin="0,16,0,0" IsEnabled="{Binding ElementName=NeedOCRCheckBox,Path=IsChecked}">
+                        <TextBlock Text="识别为TXT"/>
+                    </CheckBox>
+                </StackPanel>
+            </Grid>
+            <Grid Grid.Row="2">
+                <Button Height="40" Width="228" Background="Black" Command="{Binding ToPDFCommand}">
+                    <TextBlock Text="导出文档" FontSize="18" Foreground="White"/>
+                </Button>
+            </Grid>
+        </Grid>
+    </Grid>
+</UserControl>

+ 90 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml.cs

@@ -0,0 +1,90 @@
+using DryIoc;
+using ImTools;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs;
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Xml.Linq;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs
+{
+    /// <summary>
+    /// Interaction logic for HomePagePictureToPDFDialogs
+    /// </summary>
+    public partial class HomePagePictureToPDFDialog : UserControl
+    {
+        public HomePagePictureToPDFDialog()
+        {
+            InitializeComponent();
+        }
+
+        private void Menu_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            menuPop1.IsOpen = true;
+        }
+
+        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            IList list = listView.SelectedItems;
+            var lists = listView.Items;
+            System.Data.DataRowView a;
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Clear();
+            foreach (var item in list)
+            {
+                a = (System.Data.DataRowView)item;
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Add(lists.IndexOf(a));
+            }
+            if (((HomePagePictureToPDFDialogViewModel)this.DataContext).fileNamesView.Count > 0)
+            {
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "True";
+            }
+            else
+            {
+                ((HomePagePictureToPDFDialogViewModel)this.DataContext).RemoveIsEnable = "False";
+            }
+
+        }
+
+        private void RemoveFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).removepicturefile();
+        }
+
+        private void OpenFileMenuItem_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            ((HomePagePictureToPDFDialogViewModel)this.DataContext).openfiledialog();
+        }
+
+        private void RadioButton_Click(object sender, System.Windows.RoutedEventArgs e)
+        {
+            var radiobutton = sender as RadioButton;
+            switch (radiobutton.Name.ToString())
+            {
+                case "NewFilesRadioButtom":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.NewFiles;
+                    }
+                    break;
+                case "OneNewFileNameRadioButtom":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.OneNewFile;
+                    }
+                    break;
+                case "SelectFileNameRadioButton":
+                    {
+                        ((HomePagePictureToPDFDialogViewModel)this.DataContext).pictureToPDFModel.Mode = HomePagePictureToPDFDialogModel.ToPDFFileMode.SelectFileName;
+                    }
+                    break;
+                default:
+                    break;
+
+            }
+        }
+
+       
+    }
+}

+ 139 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml

@@ -0,0 +1,139 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialog"
+           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True" 
+              d:DesignHeight="650"
+             d:DesignWidth="903"
+             mc:Ignorable="d">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="63"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Text="打印" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="537">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="2*"/>
+                    <ColumnDefinition Width="4*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0">
+                    <Border Height="430" Width="269"  Background="LightGray" HorizontalAlignment="Center" VerticalAlignment="Center">
+                        <Viewbox Width="210" Height="297" Margin="0,36,0,0">
+                            <Image  Name="Image"></Image>
+                        </Viewbox>
+                    </Border>
+                    <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">
+                        <Button Name="PrePage"   Width="20" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                            <TextBlock Text="&lt;" VerticalAlignment="Center"></TextBlock>
+                        </Button>
+                        <TextBox x:Name="CurrentPage" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="1"  ></TextBox>
+                        <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"></TextBlock>
+                        <TextBlock x:Name="PageIndex"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
+                        <Button Name="NextPage"  Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                            <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
+                        </Button>
+                    </StackPanel>
+                </Grid>
+                <Grid Grid.Column="1">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="1.2*"/>
+                        <RowDefinition Height="0.9*"/>
+                        <RowDefinition Height="2*"/>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Vertical">
+                            <StackPanel Orientation="Horizontal" Margin="0,60,0,0">
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="打印机: " Height="20" Width="56" ></TextBlock>
+                                    <ComboBox Width="277" Height="32" Margin="8,0,0,0" ItemsSource="{Binding PrinterNameList}" SelectedIndex="0"></ComboBox>
+                                </StackPanel>
+                                <Button Content="页面设置" Height="32" Width="91" Margin="31,0,0,0"/>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,19,0,0">
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="预置: " Height="20" Width="42"></TextBlock>
+                                    <ComboBox Width="139" Height="32" Margin="22,0,0,0"></ComboBox>
+                                </StackPanel>
+                                <StackPanel Orientation="Horizontal" Margin="28,0,0,0">
+                                    <TextBlock Height="20" Width="42" Text="份数: "></TextBlock>
+                                    <cus:NumericUpDown Height="32" Width="76" Margin="15,0,0,0" ></cus:NumericUpDown>
+                                </StackPanel>
+                                <CheckBox VerticalAlignment="Center" Margin="27,0,0,0">
+                                    <TextBlock Text="黑白色"/>
+                                </CheckBox>
+                                <CheckBox VerticalAlignment="Center" Margin="27,0,0,0">
+                                    <TextBlock Text="双面打印"/>
+                                </CheckBox>
+                            </StackPanel>
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="打印设置" FontWeight="ExtraBlack"/>
+                            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="页面范围: " Height="20" Width="70"></TextBlock>
+                                    <cus:WritableComboBox Width="190" Height="32" Margin="10,0,0,0"></cus:WritableComboBox>
+                                </StackPanel>
+                                <StackPanel Orientation="Horizontal" Margin="35,0,0,0">
+                                    <TextBlock Text="打印方向: " Height="20" Width="70"></TextBlock>
+                                    <ComboBox Width="190" Height="32" Margin="10,0,0,0" ItemsSource="{Binding PrintDirectionList}" SelectedIndex="0"></ComboBox>
+                                </StackPanel>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="打印内容: " Height="20" Width="70"></TextBlock>
+                                    <ComboBox Width="190" Height="32" Margin="10,0,0,0" ItemsSource="{Binding PrintContentList}" SelectedIndex="0"></ComboBox>
+                                </StackPanel>
+                                <CheckBox  Margin="35,0,0,0" VerticalAlignment="Center">
+                                    <TextBlock Text="逆页序打印"/>
+                                </CheckBox>
+                            </StackPanel>
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="2">
+                        <StackPanel Height="auto" Orientation="Vertical">
+                            <StackPanel Orientation="Horizontal">
+                                <TextBlock Text="调整页面大小和处理页面" FontWeight="ExtraBlack"/>
+                                <Button  Content="?" FontSize="6" Width="16" Height="16" Margin="7,0,0,0"></Button>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                                <Button Name="ModSize" Background="WhiteSmoke" Width="126" Height="32" Margin="8,0,25,0" Command="{Binding DelegateChangePrintModCommand}" CommandParameter="{Binding ElementName=ModSize}">
+                                    <Border>
+                                        <TextBlock Text="大小"></TextBlock>
+                                    </Border>
+                                </Button>
+                                <Button Name="ModPoster" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,25,0" Command="{Binding DelegateChangePrintModCommand}" CommandParameter="{Binding ElementName=ModPoster}">
+                                    <Border>
+                                        <TextBlock Text="海报"></TextBlock>
+                                    </Border>
+                                </Button>
+                                <Button Name="ModMutiple" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,25,0" Command="{Binding DelegateChangePrintModCommand}" CommandParameter="{Binding ElementName=ModMutiple}">
+                                    <Border>
+                                        <TextBlock Text="多页"></TextBlock>
+                                    </Border>
+                                </Button>
+                                <Button Name="ModBooklet" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,10,0" Command="{Binding DelegateChangePrintModCommand}" CommandParameter="{Binding ElementName=ModBooklet}">
+                                    <Border>
+                                        <TextBlock Text="小册子"></TextBlock>
+                                    </Border>
+                                </Button>
+                            </StackPanel>
+                            <StackPanel>
+                                <Grid>
+                                    <ContentControl Height="180" Margin="12" x:Name="PrintMod" prism:RegionManager.RegionName="{Binding PrintModRegionName}"   Visibility="{Binding PrintModVisible}"/>
+                                </Grid>
+                            </StackPanel>
+                        </StackPanel>
+                    </Grid>
+                </Grid>
+            </Grid>
+        </Border>
+    </Grid>
+</UserControl>

+ 24 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml.cs

@@ -0,0 +1,24 @@
+using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using Prism.Ioc;
+using Prism.Regions;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for PrinterDialog
+    /// </summary>
+    public partial class HomePagePrinterDialog : UserControl
+    {
+        private IContainerProvider containerProvider;
+        public HomePagePrinterDialog(IContainerProvider containerProvider)
+        {
+            InitializeComponent();
+            this.containerProvider = containerProvider;
+            var regionManager = containerProvider.Resolve<IRegionManager>();
+            RegionManager.SetRegionManager(this, regionManager);
+            RegionManager.UpdateRegions();
+        }
+    }
+}

+ 37 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml

@@ -0,0 +1,37 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModBookletContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d"
+             d:DesignHeight="180"
+             d:DesignWidth="600">
+    <Grid Height="160"  VerticalAlignment="Top">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="1*"></RowDefinition>
+            <RowDefinition Height="1*"></RowDefinition>
+            <RowDefinition Height="1*"></RowDefinition>
+            <RowDefinition Height="1*"></RowDefinition>
+        </Grid.RowDefinitions>
+        <StackPanel Grid.Row="0" Orientation="Horizontal">
+            <TextBlock Text="小册子子集:" VerticalAlignment="Center" Margin="0,0,47,0"></TextBlock>
+            <ComboBox Height="32" Width="265"></ComboBox>
+        </StackPanel>
+        <StackPanel Grid.Row="1" Orientation="Horizontal">
+            <TextBlock Text="页面,从:" VerticalAlignment="Center" Margin="0,0,58,0"></TextBlock>
+            <TextBox Height="32" Width="50"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center"></TextBox>
+            <TextBlock Text="至" VerticalAlignment="Center" Margin="10,0,5,0"></TextBlock>
+            <TextBox Height="32" Width="50" ></TextBox>
+        </StackPanel>
+        <StackPanel Grid.Row="2" Orientation="Horizontal">
+            <TextBlock Text="装订:" VerticalAlignment="Center" Margin="0,0,84,0"></TextBlock>
+            <ComboBox Height="32" Width="265"></ComboBox>
+        </StackPanel>
+        <StackPanel Grid.Row="3" Orientation="Horizontal">
+            <CheckBox VerticalAlignment="Center"></CheckBox>
+            <TextBlock Text="自动旋转每张纸中的页面" VerticalAlignment="Center" Margin="11,0,0,0"></TextBlock>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContent.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for HomePagePrinterModBookletContent
+    /// </summary>
+    public partial class HomePagePrinterModBookletContent : UserControl
+    {
+        public HomePagePrinterModBookletContent()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 34 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContent.xaml

@@ -0,0 +1,34 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModMutipleContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d"
+             d:DesignHeight="180"
+             d:DesignWidth="600">
+    <Grid Height="120"  VerticalAlignment="Top">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="1*"></RowDefinition>
+            <RowDefinition Height="1*"></RowDefinition>
+            <RowDefinition Height="1*"></RowDefinition>
+        </Grid.RowDefinitions>
+        <StackPanel Grid.Row="0" Orientation="Horizontal">
+            <TextBlock Text="每张纸显示的页数:" VerticalAlignment="Center" Margin="0,0,5,0"></TextBlock>
+            <cus:WritableComboBox Height="32" Width="113"></cus:WritableComboBox>
+            <TextBox Height="32" Width="53" Margin="16,0,11,0"></TextBox>
+            <TextBlock Text="X" VerticalAlignment="Center"></TextBlock>
+            <TextBox Height="32" Width="53"  Margin="11,0,0,0"></TextBox>
+        </StackPanel>
+        <StackPanel Grid.Row="1" Orientation="Horizontal">
+            <TextBlock Text="页面顺序:" VerticalAlignment="Center" Margin="0,0,61,0"></TextBlock>
+            <ComboBox Height="32" Width="265"></ComboBox>
+        </StackPanel>
+        <StackPanel Grid.Row="2" Orientation="Horizontal">
+            <CheckBox VerticalAlignment="Center"></CheckBox>
+            <TextBlock VerticalAlignment="Center" Margin="11" Text="自动旋转每张纸中的页面"></TextBlock>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMutipleContent.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for HomePagePrinterModMutipleContent
+    /// </summary>
+    public partial class HomePagePrinterModMutipleContent : UserControl
+    {
+        public HomePagePrinterModMutipleContent()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 63 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml

@@ -0,0 +1,63 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModPosterContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d"
+             d:DesignHeight="180"
+             d:DesignWidth="600"
+             prism:ViewModelLocator.AutoWireViewModel="True">
+    <Grid Height="160"  VerticalAlignment="Top">
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0" HorizontalAlignment="Left"  Width="600">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="1*"></ColumnDefinition>
+                <ColumnDefinition Width="1*"></ColumnDefinition>
+            </Grid.ColumnDefinitions>
+            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+                <RadioButton Name="Tile" Content="平铺"></RadioButton>
+                <RadioButton Name="Split" Content="拆分"></RadioButton>
+            </StackPanel>
+            <Grid Grid.Column="1">
+                <StackPanel Orientation="Horizontal" Visibility="Collapsed">
+                    <TextBlock Text="平铺百分比:" VerticalAlignment="Center"></TextBlock>
+                    <TextBox Height="32" Width="52"></TextBox>
+                    <TextBlock Text="%" VerticalAlignment="Center"></TextBlock>
+                </StackPanel>
+                <StackPanel Orientation="Horizontal" Margin="-150,0,0,0" Visibility="Visible">
+                    <TextBlock Text="每张纸显示的页数:" VerticalAlignment="Center" ></TextBlock>
+                    <ComboBox Height="32" Width="113" Margin="0,0,16,0"></ComboBox>
+                    <TextBox Height="32" Width="52" Margin="0,0,16,0"></TextBox>
+                    <TextBlock Text="x" VerticalAlignment="Center" Margin="0,0,16,0"></TextBlock>
+                    <TextBox  Height="32" Width="52"></TextBox>
+                </StackPanel>
+            </Grid>
+        </Grid>
+        <Grid Grid.Row="1">
+            <StackPanel Orientation="Horizontal" >
+                <TextBlock Text="重叠:" VerticalAlignment="Center"></TextBlock>
+                <TextBox Height="32" Width="52"></TextBox>
+                <TextBlock Text="mm" VerticalAlignment="Center"></TextBlock>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Row="2">
+            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+                <CheckBox Margin="0,0,11,0"></CheckBox>
+                <TextBlock Text="剪切标记"></TextBlock>
+            </StackPanel>
+        </Grid>
+        <Grid Grid.Row="3" VerticalAlignment="Center">
+            <StackPanel Orientation="Horizontal">
+                <CheckBox Margin="0,0,11,0" VerticalAlignment="Center"></CheckBox>
+                <TextBlock Text="标签" VerticalAlignment="Center" Margin="0,0,8,0"></TextBlock>
+                <TextBox Height="32" Width="361"></TextBox>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModPosterContent.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for HomePagePrinterModPosterContent
+    /// </summary>
+    public partial class HomePagePrinterModPosterContent : UserControl
+    {
+        public HomePagePrinterModPosterContent()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 35 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContent.xaml

@@ -0,0 +1,35 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModSizeContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d"
+             d:DesignHeight="180"
+             d:DesignWidth="300">
+    <Grid Height="120"  VerticalAlignment="Top">
+        <Grid.RowDefinitions>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+            <RowDefinition></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <RadioButton VerticalAlignment="Center">
+                <TextBlock Text="自动适应"></TextBlock>
+            </RadioButton>
+        </Grid>
+        <Grid Grid.Row="1">
+            <RadioButton VerticalAlignment="Center">
+                <TextBlock Text="实际大小"></TextBlock>
+            </RadioButton>
+        </Grid>
+        <Grid Grid.Row="2">
+            <RadioButton VerticalAlignment="Center">
+                <TextBlock Text="自定义显示比例"></TextBlock>
+            </RadioButton>
+            <cus:NumericUpDown Width="73" Height="32" Margin="15,0,0,2"></cus:NumericUpDown>
+        </Grid>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContent.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for HomePagePrinterModSizeContent
+    /// </summary>
+    public partial class HomePagePrinterModSizeContent : UserControl
+    {
+        public HomePagePrinterModSizeContent()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 58 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml

@@ -0,0 +1,58 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterPageSetDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             d:DesignHeight="347"
+             d:DesignWidth="371"
+             mc:Ignorable="d">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="48"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="64"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Text="提取" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="235">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="1*"></RowDefinition>
+                    <RowDefinition Height="2*"></RowDefinition>
+                </Grid.RowDefinitions>
+                <StackPanel Grid.Row="0">
+                    <TextBlock Text="纸张" FontWeight="ExtraBlack" Width="56" Height="22" HorizontalAlignment="Left"/>
+                    <StackPanel Orientation="Horizontal">
+                        <TextBlock Text="大小: " VerticalAlignment="Center"></TextBlock>
+                        <ComboBox Width="281" Height="32" Margin="16,0,0,0"></ComboBox>
+                    </StackPanel>
+                </StackPanel>
+                <StackPanel Grid.Row="1" Margin="0,20,0,0">
+                    <TextBlock Text="页边距" FontWeight="ExtraBlack" Width="56" Height="22" HorizontalAlignment="Left"/>
+                    <StackPanel Orientation="Horizontal">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="上: " VerticalAlignment="Center"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0"></cus:NumericUpDown>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
+                            <TextBlock Text="下: " VerticalAlignment="Center" ></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0"></cus:NumericUpDown>
+                        </StackPanel>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="左: " VerticalAlignment="Center"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0"></cus:NumericUpDown>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
+                            <TextBlock Text="右: " VerticalAlignment="Center"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0"></cus:NumericUpDown>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+        </Border>
+    </Grid>
+</UserControl>

+ 15 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml.cs

@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    /// <summary>
+    /// Interaction logic for MainPagePrinterPageSetDialog
+    /// </summary>
+    public partial class HomePagePrinterPageSetDialog : UserControl
+    {
+        public HomePagePrinterPageSetDialog()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 95 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageSplitDialog.xaml

@@ -0,0 +1,95 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageSplitDialog"
+   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+             xmlns:prism="http://prismlibrary.com/"             
+             prism:ViewModelLocator.AutoWireViewModel="True"
+              d:DesignHeight="521"
+             d:DesignWidth="583"
+             mc:Ignorable="d">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="48"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="64"></RowDefinition>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Row="0" Text="拆分" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="409">
+            <Grid >
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="3*"/>
+                    <ColumnDefinition Width="4*"/>
+                </Grid.ColumnDefinitions>
+                <Grid Grid.Column="0" VerticalAlignment="Top">
+                    <cus:PageTurningPreview x:Name="SplitPreview" Loaded="PageTurningPreview_Loaded" ></cus:PageTurningPreview>
+                </Grid>
+                <Grid Grid.Column="1" Margin="7,40,10,40">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="4*"></RowDefinition>
+                        <RowDefinition Height="4*"></RowDefinition>
+                    </Grid.RowDefinitions>
+                    <Grid Grid.Row="0">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="拆分方式" Height="22" Width="56" HorizontalAlignment="Left" Margin="0,0,0,17"></TextBlock>
+                            <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
+                                <RadioButton VerticalAlignment="Center" IsChecked="{Binding AveragePagesIsCheck}" Command="{Binding AveragePagesCommand}"></RadioButton>
+                                <TextBlock Text="平均每"  VerticalAlignment="Center"></TextBlock>
+                                <cus:NumericUpDown Height="32" Width="110" Text="{Binding AveragePagesText,Mode=TwoWay}" IsEnabled="{Binding AveragePagesIsEnabled}"></cus:NumericUpDown>
+                                <TextBlock Text="页拆分为一个文件"  VerticalAlignment="Center"></TextBlock>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
+                                <RadioButton VerticalAlignment="Center" IsChecked="{Binding AverageFilesIsCheck}"  Command="{Binding AverageFilesCommand}"></RadioButton>
+                                <TextBlock Text="平均拆分为"  VerticalAlignment="Center"></TextBlock>
+                                <cus:NumericUpDown Height="32" Width="110" Text="{Binding AverageFilesText,Mode=TwoWay}" IsEnabled="{Binding AverageFilesIsEnabled}"></cus:NumericUpDown>
+                                <TextBlock Text="个PDF文件"></TextBlock>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal">
+                                <RadioButton VerticalAlignment="Center" IsChecked="{Binding CustomPageRangeIsCheck}" Command="{Binding CustomPageRangeCommand}"></RadioButton>
+                                <TextBlock Text="按特定页面拆分" VerticalAlignment="Center"></TextBlock>
+                                <cus:WritableComboBox  Height="32" Width="183" Text="{Binding PageRangeText, Mode=TwoWay}" IsEnabled="{Binding CustomPageRangeIsEnabled}" SelectedIndex="{Binding PageRangeSelectIndex, Mode=TwoWay}"/>
+                            </StackPanel>
+                        </StackPanel>
+                    </Grid>
+                    <Grid Grid.Row="1">
+                        <StackPanel Orientation="Vertical">
+                            <TextBlock Text="文档命名" Height="22" Width="56" HorizontalAlignment="Left"></TextBlock>
+                            <TextBlock Height="32" Width="303" Margin="0,0,0,6" Text="{Binding FilePathName}"></TextBlock>
+                            <StackPanel Orientation="Horizontal" Margin="0,0,0,13">
+                                <CheckBox Margin="0,0,11,0" Command="{Binding FrontFileNameCommand}" IsChecked="{Binding FrontFileIsCheck}"></CheckBox>
+                                <TextBlock Text="将原始文档名前置"></TextBlock>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal" Margin="0,0,0,8">
+                                <CheckBox VerticalAlignment="Center" Margin="0,0,11,0" Command="{Binding FileNameLabelCommand}" IsChecked="{Binding FileNameLabelIsCheck}"></CheckBox>
+                                <TextBlock Text="标签" VerticalAlignment="Center" Margin="0,0,30,0"></TextBlock>
+                                <TextBox x:Name="FileNameLabelTextBox" Height="32" Width="110" Text="{Binding FileNameLabelText}" TextChanged="TextBox_TextChanged" IsEnabled="{Binding FileNameLabelIsEnabled}"></TextBox>
+                            </StackPanel>
+                            <StackPanel Orientation="Horizontal">
+                                <CheckBox VerticalAlignment="Center" Margin="0,0,11,0"  Command="{Binding FileNameDeimiterCommand}" IsChecked="{Binding FileNameDeimiterIsCheck}"></CheckBox>
+                                <TextBlock Text="分隔符" VerticalAlignment="Center" Margin="0,0,18,0"></TextBlock>
+                                <TextBox x:Name="FileNameDeimiterTextBox"  Height="32" Width="110" Text="{Binding FileNameDeimiterText}" TextChanged="TextBox_TextChanged" IsEnabled="{Binding FileNameDeimiterIsEnabled}"></TextBox>
+                            </StackPanel>
+                        </StackPanel>
+                    </Grid>
+                </Grid>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="2">
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="16,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+            <Button
+                    Width="98"
+                    Height="32"
+                    Margin="124,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding SplitCommand}"
+                    Content="拆分" />
+        </Grid>
+    </Grid>
+</UserControl>

+ 62 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePageSplitDialog.xaml.cs

@@ -0,0 +1,62 @@
+using PDF_Office.CustomControl;
+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.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
+{
+    /// <summary>
+    /// MainPageSplitDialog.xaml 的交互逻辑
+    /// </summary>
+    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;
+            SplitPreview.AwaitRenderBitmap(SplitPreview.document);
+            SplitPreview.PageIndex.Text = SplitPreview.document.PageCount.ToString();
+        }
+    }
+}

+ 1 - 1
PDF Office/Views/Dialog/PageEditDialogs/InsertDialog.xaml

@@ -72,7 +72,7 @@
                 </StackPanel>
             </Grid>
         </cus:DialogContent.Content>
-        <cus:DialogContent.BottmBar>
+        <cus:DialogContent.BottmBar >
             <Grid>
                 <Button
                     Width="98"

+ 0 - 27
PDF Office/Views/Dialog/PrinterDialog.xaml

@@ -1,27 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.Dialog.PrinterDialog"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-             xmlns:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True" 
-              d:DesignHeight="650"
-             d:DesignWidth="893"
-             mc:Ignorable="d">
-    <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="50"></RowDefinition>
-            <RowDefinition Height="*"></RowDefinition>
-            <RowDefinition Height="63"></RowDefinition>
-        </Grid.RowDefinitions>
-        <TextBlock Grid.Row="0" Text="打印" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
-        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,1,0,1" VerticalAlignment="Center" Height="537">
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="2*"/>
-                    <ColumnDefinition Width="4*"/>
-                </Grid.ColumnDefinitions>
-            </Grid>
-        </Border>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/Dialog/PrinterDialog.xaml.cs

@@ -1,15 +0,0 @@
-using System.Windows.Controls;
-
-namespace PDF_Office.Views.Dialog
-{
-    /// <summary>
-    /// Interaction logic for PrinterDialog
-    /// </summary>
-    public partial class PrinterDialog : UserControl
-    {
-        public PrinterDialog()
-        {
-            InitializeComponent();
-        }
-    }
-}

PDF Office/Views/Dialog/PageEditDialogs/SplitDialog.xaml → PDF Office/Views/Dialog/ToolsDialogs/CompressDialogs/SplitDialog.xaml


PDF Office/Views/Dialog/PageEditDialogs/SplitDialog.xaml.cs → PDF Office/Views/Dialog/ToolsDialogs/CompressDialogs/SplitDialog.xaml.cs


+ 1 - 1
PDF Office/Views/MainContent.xaml

@@ -18,6 +18,6 @@
         </i:EventTrigger>
     </i:Interaction.Triggers>-->
     <Grid>
-        <ContentControl Name="ContentMain" prism:RegionManager.RegionName="{Binding MainContentRegionName}" />
+        <ContentControl Name="ContentMain" prism:RegionManager.RegionName="{Binding MainContentRegionName}" Margin="-64,-10,64,10" />
     </Grid>
 </UserControl>

+ 5 - 4
PDF Office/Views/MainWindow.xaml

@@ -127,11 +127,12 @@
         <Grid>
             <Grid.RowDefinitions>
                 <RowDefinition Height="40" />
-                <RowDefinition Height="*" />
+                <RowDefinition Height="65*" />
+                <RowDefinition Height="121*"/>
             </Grid.RowDefinitions>
             <dragablz:TabablzControl
                 Name="TabablzControl"
-                Grid.RowSpan="2"
+                Grid.RowSpan="3"
                 BorderThickness="0"
                 ItemContainerStyle="{StaticResource DragablzItemStyle}"
                 SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
@@ -161,9 +162,9 @@
             </dragablz:TabablzControl>
             <!--  标题栏右侧栏,关闭按钮,会员,试用等  -->
             <StackPanel
-                HorizontalAlignment="Right"
+                HorizontalAlignment="Left"
                 Orientation="Horizontal"
-                WindowChrome.IsHitTestVisibleInChrome="True">
+                WindowChrome.IsHitTestVisibleInChrome="True" Margin="1160,0,0,0">
                 <Button
                     Name="BtnMiniSize"
                     Width="40"

+ 0 - 2
PDF Office/Views/Tools/ToolsBarContent.xaml

@@ -148,8 +148,6 @@
                     </StackPanel>
                 </Button>
             </WrapPanel>
-
         </Border>
-
     </Grid>
 </UserControl>