liuaoran 2 سال پیش
والد
کامیت
feb40999b9
25فایلهای تغییر یافته به همراه1285 افزوده شده و 2704 حذف شده
  1. 2 2
      PDF Office/App.xaml.cs
  2. 19 5
      PDF Office/CustomControl/WritableComboBox.xaml.cs
  3. 21 0
      PDF Office/EventAggregators/SendPrintInfoEvent.cs
  4. 56 39
      PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogModel.cs
  5. 86 86
      PDF Office/Model/DialogNames.cs
  6. 6 0
      PDF Office/Model/ParameterNames.cs
  7. 18 8
      PDF Office/PDF Office.csproj
  8. 1 0
      PDF Office/Styles/CheckBoxStyle.xaml
  9. 0 1
      PDF Office/Styles/RadioButtonStyle.xaml
  10. 353 1918
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs
  11. 189 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContentViewModel.cs
  12. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModBookletContentViewModel.cs
  13. 1 1
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMultipleContentViewModel.cs
  14. 4 2
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs
  15. 0 245
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialogViewModel.cs
  16. 236 0
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPaperSettingsDialogViewModel.cs
  17. 0 14
      PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/ModInfoSendEvent.cs
  18. 136 144
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml
  19. 0 141
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml.cs
  20. 43 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContent.xaml
  21. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContent.xaml.cs
  22. 0 71
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml
  23. 0 26
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPageSetDialog.xaml.cs
  24. 83 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPaperSettingsDialog.xaml
  25. 15 0
      PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPaperSettingsDialog.xaml.cs

+ 2 - 2
PDF Office/App.xaml.cs

@@ -139,7 +139,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<ThemesContent>();
             containerRegistry.RegisterForNavigation<ReadModeContent>();
 
-
+            containerRegistry.RegisterForNavigation<HomePagePrinterDocumentContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModMultipleContent>();
@@ -211,7 +211,7 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<HomePageInsertDialog>(DialogNames.HomePageInsertDialog);
             containerRegistry.RegisterDialog<HomePageSplitDialog>(DialogNames.HomePageSplitDialog);
             containerRegistry.RegisterDialog<HomePagePrinterDialog>(DialogNames.HomePagePrinterDialog);
-            containerRegistry.RegisterDialog<HomePagePrinterPageSetDialog>(DialogNames.HomePagePrinterPageSetDialog);
+            containerRegistry.RegisterDialog<HomePagePrinterPaperSettingsDialog>(DialogNames.HomePagePrinterPaperSettingsDialog);
             containerRegistry.RegisterDialog<HomePagePictureToPDFDialog>(DialogNames.HomePagePictureToPDFDialog);
             containerRegistry.RegisterDialog<HomePageBatchProcessingDialog>(DialogNames.HomePageBatchProcessingDialog);
             containerRegistry.RegisterDialog<ConverterCSVDialog>(DialogNames.ConverterCSVDialog);

+ 19 - 5
PDF Office/CustomControl/WritableComboBox.xaml.cs

@@ -39,14 +39,17 @@ namespace PDF_Office.CustomControl
         public Visibility IsAllPageVisible
         {
             get { return (Visibility)GetValue(IsAllPageVisibleProperty); }
-            set { SetValue(IsAllPageVisibleProperty, value); 
+            set
+            {
+                SetValue(IsAllPageVisibleProperty, value);
             }
         }
 
         // Using a DependencyProperty as the backing store for IsAllPageVisible.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty IsAllPageVisibleProperty =
-            DependencyProperty.Register("IsAllPageVisible", typeof(Visibility), typeof(WritableComboBox), new PropertyMetadata(Visibility.Visible,(d,e)=> {
-                if((Visibility)e.NewValue!=Visibility.Visible)
+            DependencyProperty.Register("IsAllPageVisible", typeof(Visibility), typeof(WritableComboBox), new PropertyMetadata(Visibility.Visible, (d, e) =>
+            {
+                if ((Visibility)e.NewValue != Visibility.Visible)
                 {
 
                     (d as WritableComboBox).SetIndexByVisiblity((Visibility)e.NewValue);
@@ -89,6 +92,15 @@ namespace PDF_Office.CustomControl
 
             DependencyProperty.Register("Text", typeof(string), typeof(WritableComboBox), new PropertyMetadata(""));
 
+        public ItemCollection Items
+        {
+            get { return (ItemCollection)GetValue(ItemsProperty); }
+            set { SetValue(ItemsProperty, value); }
+        }
+         
+        public static readonly DependencyProperty ItemsProperty =
+
+    DependencyProperty.Register("Items", typeof(ItemCollection), typeof(WritableComboBox), new PropertyMetadata());
         /// <summary>
         /// 把子控件的事件传递出去,方便绑定
         /// </summary>
@@ -105,6 +117,8 @@ namespace PDF_Office.CustomControl
         public WritableComboBox()
         {
             InitializeComponent();
+
+           this.Items = this.writableComboBox.Items;
         }
 
 
@@ -136,7 +150,7 @@ namespace PDF_Office.CustomControl
             }
             this.SelectedIndex = this.writableComboBox.SelectedIndex.ToString();
 
-            SelectionChanged?.Invoke(sender,e);
+            SelectionChanged?.Invoke(sender, e);
         }
 
         private void writableTextBox_TextChange(object sender, TextChangedEventArgs e)
@@ -148,7 +162,7 @@ namespace PDF_Office.CustomControl
             else { Text = ""; }
 
 
-            TextChanged?.Invoke(sender,e);
+            TextChanged?.Invoke(sender, e);
         }
     }
 }

+ 21 - 0
PDF Office/EventAggregators/SendPrintInfoEvent.cs

@@ -0,0 +1,21 @@
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using PDFSettings;
+using Prism.Events;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.EventAggregators
+{
+    public class SendPrintSettingsInfoEvent:PubSubEvent<PrintSettingsInfo>
+    {
+    }
+
+    public class SendPrintSettingsModInfoEvent:PubSubEvent<PrintModInfo>
+    {
+
+    }
+}

+ 56 - 39
PDF Office/Model/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogModel.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Drawing.Printing;
 using System.Linq;
 using System.Numerics;
+using System.Printing;
 using System.Runtime.Remoting.Channels;
 using System.Text;
 using System.Threading.Tasks;
@@ -12,44 +13,58 @@ 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; }
+        /// <summary>
+        /// 灰度
+        /// </summary>
+        public bool IsGrayscale { get; set; }
+        /// <summary>
+        /// 纸张尺寸
+        /// </summary>
+        public PageMediaSize PageMediaSize;
+        /// <summary>
+        /// 页码范围
+        /// </summary>
+        public EnumPageRange EnumPageRange = EnumPageRange.StatusAllRange;
+        /// <summary>
+        /// 逆页序
+        /// </summary>
         public bool IsIndexReverse { get; set; }
-        public EnumPrintOrientation EnumPrintOrientation { get; set; }
-        public bool PrintWithAnnot { get; set; }
-        public bool PrintWithForm { get; set; }
+        /// <summary>
+        /// 打印方向
+        /// </summary>
+        public EnumPrintOrientation EnumPrintOrientation = EnumPrintOrientation.StatusLandscape;
+        /// <summary>
+        /// 带Annot
+        /// </summary>
+        public bool IsPrintWithAnnot { get; set; }
+        /// <summary>
+        /// 带Form
+        /// </summary>
+        public bool IsPrintWithForm { get; set; }
+        /// <summary>
+        /// Copies
+        /// </summary>
         public int Copies { get; set; }
+        /// <summary>
+        /// 打印机名称
+        /// </summary>
         public string PrinterName { get; set; }
-        public string CustomizeRange { get; set; }
-        public PrintMod printMod { get; set; }
+        /// <summary>
+        /// 自定义打印页码范围
+        /// </summary>
+        public List<int> CustomRange { get; set; }
+        /// <summary>
+        /// 打印Mod
+        /// </summary>
+        public PrintModInfo printModInfo  = new PrintModInfo();
+
+        public List<int> Margin = new List<int>();
     }
 
     public class HomePagePrinterDialogModel
     {
-      
-    }
-
-    public enum EnumPaperSize
-    { 
-        StatusA3,
-        StatusA4,
-        StatusA5,
-        StatusB5,
-        StatusNo10Envelope,
-        StatusChoukei3Envelope,
-        StatusDLEnvelope,
-        StatusJISB5,
-        StatusROC16K,
-        StatusExtraLargeBA3,
-        StatusTabloid,
-        StatusExraLargeTabloid,
-        StatusAmericanLegal,
-        StatusAmericanLetter,
-        StatusCustomized
-    }
 
+    } 
 
 
     public enum EnumSizeType
@@ -62,7 +77,6 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
     public enum EnumPageRange
     {
         StatusAllRange,
-        StatusCurrentRange,
         StatusOddRange,
         StatusEvenRange,
         StatusCustomizedRange
@@ -70,8 +84,8 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
 
     public enum EnumPrintOrientation
     {
-        StatusLandscape,
-        StatusPortrait
+        StatusPortrait,
+        StatusLandscape
     }
 
     public enum EnumPrintContent
@@ -126,18 +140,21 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
         StatusRight,
     }
 
-    public abstract class PrintMod { }
+    public class PrintModInfo
+    {
+        public EnumPrintMod EnumPrintMod = EnumPrintMod.StatusSize;
+    }
 
-    public class SizeInfo : PrintMod
+    public class SizeInfo : PrintModInfo
     {
         public EnumSizeType EnumSizeType { get; set; }
         public int DisplayRatio { get; set; }
     }
 
 
-    public class PosterInfo : PrintMod
+    public class PosterInfo : PrintModInfo
     {
-        public EnumPosterMod EnumPosterMod; 
+        public EnumPosterMod EnumPosterMod;
         public bool HasCutMarks { get; set; }
         public bool HasLabel { get; set; }
         public double OverLap { get; set; }
@@ -156,7 +173,7 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
         public int HeightPartNumber { get; set; }
     }
 
-    public class MultipleInfo : PrintMod
+    public class MultipleInfo : PrintModInfo
     {
         public EnumPageOrder EnumPageOrder { set; get; }
         public EnumDisplayPageNumber EnumDisplayPageNumber { get; set; }
@@ -165,7 +182,7 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
         public bool IsAutoRotate { get; set; }
     }
 
-    public class BookletInfo : PrintMod
+    public class BookletInfo : PrintModInfo
     {
         public EnumBookletSubset EnumBookletSubset { get; set; }
         public EnumBookletBinding EnumBookletBinding { get; set; }

+ 86 - 86
PDF Office/Model/DialogNames.cs

@@ -1,93 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.Model
-{
-    /// <summary>
-    /// 记录弹窗的名称
-    /// </summary>
-    public static class DialogNames
-    {
-        /// <summary>
-        /// 文档解密弹窗 需要传参PDFDocument对象
-        /// </summary>
-        public static string VerifyPassWordDialog = "PassWordDialog";
-
-        /// <summary>
-        /// 全屏模式弹窗
-        /// </summary>
-        public static string FullScreenDialog = "FullScreenDialog";
-
-        /// <summary>
-        /// 压缩弹窗
-        /// </summary>
-        public static string CompressDialog = "CompressDialog";
-
-        /// <summary>
-        /// 解压缩弹窗
-        /// </summary>
-        public static string SetPasswordDialog = "SetPasswordDialog";
-
-        /// <summary>
-        /// 解压缩弹窗
-        /// </summary>
-        public static string CheckPasswordDialog = "CheckPasswordDialog";
-
-        /// <summary>
-        /// 删除安全性设置
-        /// </summary>
-        public static string DeleteSafetySettingsDialog = "DeleteSafetySettingsDialog";
-
-        /// <summary>
-        /// 进度条
-        /// </summary>
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model
+{
+    /// <summary>
+    /// 记录弹窗的名称
+    /// </summary>
+    public static class DialogNames
+    {
+        /// <summary>
+        /// 文档解密弹窗 需要传参PDFDocument对象
+        /// </summary>
+        public static string VerifyPassWordDialog = "PassWordDialog";
+
+        /// <summary>
+        /// 全屏模式弹窗
+        /// </summary>
+        public static string FullScreenDialog = "FullScreenDialog";
+
+        /// <summary>
+        /// 压缩弹窗
+        /// </summary>
+        public static string CompressDialog = "CompressDialog";
+
+        /// <summary>
+        /// 解压缩弹窗
+        /// </summary>
+        public static string SetPasswordDialog = "SetPasswordDialog";
+
+        /// <summary>
+        /// 解压缩弹窗
+        /// </summary>
+        public static string CheckPasswordDialog = "CheckPasswordDialog";
+
+        /// <summary>
+        /// 删除安全性设置
+        /// </summary>
+        public static string DeleteSafetySettingsDialog = "DeleteSafetySettingsDialog";
+
+        /// <summary>
+        /// 进度条
+        /// </summary>
         public static string CompressProgressBarDialog = "CompressProgressBarDialog";
 
-        /// <summary>
-        /// 页面编辑- 提取弹窗
-        /// </summary>
-        public static string ExtractDialog = "ExtractDialog";
-
-        /// <summary>
-        /// 页面编辑-拆分弹窗
-        /// </summary>
-        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>
+        /// <summary>
+        /// 页面编辑- 提取弹窗
+        /// </summary>
+        public static string ExtractDialog = "ExtractDialog";
+
+        /// <summary>
+        /// 页面编辑-拆分弹窗
+        /// </summary>
+        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>
+        ///打印弹窗-打印页面设置
+        /// </summary>
+        public static string HomePagePrinterPaperSettingsDialog = "HomePagePrinterPaperSettingsDialog";
 
-        ///<summary>
-        ///主页工具-图片转PDF弹窗
+        ///<summary>
+        ///主页工具-图片转PDF弹窗
         /// </summary>
         public static string HomePagePictureToPDFDialog = "HomePagePictureToPDFDialog";
 
@@ -115,5 +115,5 @@ namespace PDF_Office.Model
         ///转档进度条弹窗
         /// </summary>
         public static string ConverterProgressBarDialog = "ConverterProgressBarDialog";
-    }
+    }
 }

+ 6 - 0
PDF Office/Model/ParameterNames.cs

@@ -70,5 +70,11 @@ namespace PDF_Office.Model
         /// 用于转换数据模型
         /// </summary>
         public static string ConverterTypeModel = "ConverterTypeModel";
+
+        /// <summary>
+        /// 打印
+        /// </summary>
+        public static string PrintQueue = "PrintQueue";
+        public static string PrintSettingsInfo = "PrintSettingsInfo";
     }
 }

+ 18 - 8
PDF Office/PDF Office.csproj

@@ -129,6 +129,7 @@
     <Reference Include="Prism.Wpf, Version=8.1.97.5141, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
       <HintPath>packages\Prism.Wpf.8.1.97\lib\net461\Prism.Wpf.dll</HintPath>
     </Reference>
+    <Reference Include="ReachFramework" />
     <Reference Include="SQLitePCLRaw.batteries_v2, Version=2.0.2.669, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
       <HintPath>packages\SQLitePCLRaw.bundle_green.2.0.2\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath>
     </Reference>
@@ -157,6 +158,7 @@
     <Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
     </Reference>
+    <Reference Include="System.Printing" />
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
@@ -230,6 +232,7 @@
     <Compile Include="EventAggregators\EditToolsEvent.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="EventAggregators\SendPrintInfoEvent.cs" />
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\EditToolsHelper.cs" />
     <Compile Include="Helper\AdvancedInvokeCommandAction.cs" />
@@ -303,6 +306,8 @@
       <AutoGen>True</AutoGen>
     </Compile>
     <Compile Include="Settings.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDocumentContentViewModel.cs" />
+    <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPaperSettingsDialogViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Bates\BatesContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Bates\BatesCreateContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Bates\BatesDocumentContentViewModel.cs" />
@@ -351,8 +356,6 @@
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModMultipleContentViewModel.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\HomePagePrinter\ModInfoSendEvent.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageSplitDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\PageEditDialogs\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\PageEditDialogs\InsertDialogViewModel.cs" />
@@ -486,6 +489,9 @@
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePictureToPDFDialog.xaml.cs">
       <DependentUpon>HomePagePictureToPDFDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDocumentContent.xaml.cs">
+      <DependentUpon>HomePagePrinterDocumentContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterModBookletContent.xaml.cs">
       <DependentUpon>HomePagePrinterModBookletContent.xaml</DependentUpon>
     </Compile>
@@ -498,8 +504,8 @@
     <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 Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPaperSettingsDialog.xaml.cs">
+      <DependentUpon>HomePagePrinterPaperSettingsDialog.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\Dialog\HomePageToolsDialogs\HomePageSplitDialog.xaml.cs">
       <DependentUpon>HomePageSplitDialog.xaml</DependentUpon>
@@ -903,6 +909,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterDocumentContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\Dialog\HomePageToolsDialogs\HomePagePrinter\HomePagePrinterPaperSettingsDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\Dialog\PageEditDialogs\SplitDialog.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1031,10 +1045,6 @@
       <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>

+ 1 - 0
PDF Office/Styles/CheckBoxStyle.xaml

@@ -105,6 +105,7 @@
             </Trigger>
         </ControlTemplate.Triggers>
     </ControlTemplate>
+    
     <Style x:Key="EditToolsCheckBoxStyle" TargetType="{x:Type CheckBox}">
         <Setter Property="SnapsToDevicePixels" Value="true" />
         <Setter Property="OverridesDefaultStyle" Value="False" />

+ 0 - 1
PDF Office/Styles/RadioButtonStyle.xaml

@@ -252,7 +252,6 @@
                         </Trigger>
                         <Trigger Property="IsChecked" Value="{x:Null}">
                             <Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
-
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 353 - 1918
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs


+ 189 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContentViewModel.cs

@@ -0,0 +1,189 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.EventAggregators;
+using PDF_Office.Model;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterDocumentContentViewModel : BindableBase, INavigationAware
+    {
+        private CPDFViewer PDFViewer;
+        public PrintSettingsInfo PrintSettingsInfo;
+        public IEventAggregator printDocumentEvent;
+        private string _paperWidth;
+        public string PaperWidth
+        {
+            get => _paperWidth;
+            set => SetProperty(ref _paperWidth, value);
+        }
+
+        private string _paperHeight;
+        public string PaperHeight
+        {
+            get => _paperHeight;
+            set => SetProperty(ref _paperHeight, value);
+        }
+
+        private string _viewBoxWidth;
+        public string ViewBoxWidth
+        {
+            get => _viewBoxWidth;
+            set => SetProperty(ref _viewBoxWidth, value);
+        }
+
+        private string _viewBoxHeight;
+        public string ViewBoxHeight
+        {
+            get => _viewBoxHeight;
+            set => SetProperty(ref _viewBoxHeight, value);
+        }
+
+        /// <summary>
+        /// 打印的总页数
+        /// </summary>
+        private int _printedPageCount;
+        public int PrintedPageCount
+        {
+            get => _printedPageCount;
+            set => SetProperty(ref _printedPageCount, value);
+        }
+
+        public HomePagePrinterDocumentContentViewModel(IEventAggregator eventAggregator)
+        {
+            this.printDocumentEvent = eventAggregator;
+            printDocumentEvent.GetEvent<SendPrintSettingsInfoEvent>().Subscribe(RecvPrintSettingsInfo);
+        }
+
+        public void RecvPrintSettingsInfo(PrintSettingsInfo printSettingsInfo)
+        {
+            if (PDFViewer != null && printSettingsInfo != null)
+            {
+                SetPreview();
+                CaculatePrintedPageCount();
+            }
+        }
+
+        public void SetViewBox()
+        {
+            if (float.Parse(PaperHeight) / float.Parse(PaperWidth) >= (306.0 / 224.0))
+            {
+                ViewBoxHeight = "306";
+                ViewBoxWidth = (float.Parse(PaperWidth) / float.Parse(PaperHeight) * 306).ToString();
+            }
+            else
+            {
+                ViewBoxWidth = "224";
+                ViewBoxHeight = (float.Parse(PaperHeight) / float.Parse(PaperWidth) * 224).ToString();
+            }
+        }
+
+        public void SetPreview()
+        {
+            if (PrintSettingsInfo.printModInfo.EnumPrintMod != EnumPrintMod.StatusPoster)
+            {
+                if (PrintSettingsInfo.EnumPrintOrientation == EnumPrintOrientation.StatusPortrait)
+                {
+                    PaperWidth = String.Format("{0:F1}", (PrintSettingsInfo.PageMediaSize.Width) / 96 * 25.4);
+                    PaperHeight = String.Format("{0:F1}", (PrintSettingsInfo.PageMediaSize.Height) / 96 * 25.4);
+                }
+                else
+                {
+                    PaperHeight = String.Format("{0:F1}", (PrintSettingsInfo.PageMediaSize.Width) / 96 * 25.4);
+                    PaperWidth = String.Format("{0:F1}", (PrintSettingsInfo.PageMediaSize.Height) / 96 * 25.4);
+                }
+                SetViewBox();
+            }
+            else
+            {
+            }
+        }
+
+        public void CaculatePrintedPageCount()
+        {
+            PrintedPageCount = PDFViewer.Document.PageCount;
+            if (PrintSettingsInfo.EnumPageRange == EnumPageRange.StatusOddRange)
+            {
+                if (PrintedPageCount % 2 == 0)
+                {
+                    PrintedPageCount = PrintedPageCount / 2;
+                }
+                else
+                {
+                    PrintedPageCount = PrintedPageCount / 2 + 1;
+                }
+            }
+            else if (PrintSettingsInfo.EnumPageRange == EnumPageRange.StatusEvenRange)
+            {
+                if (PrintedPageCount % 2 == 0)
+                {
+                    PrintedPageCount = PrintedPageCount / 2;
+                }
+                else
+                {
+                    PrintedPageCount = PrintedPageCount / 2;
+                }
+            }
+            else if (PrintSettingsInfo.EnumPageRange == EnumPageRange.StatusCustomizedRange)
+            {
+                PrintedPageCount = PrintSettingsInfo.CustomRange.Count;
+            }
+            if (PrintSettingsInfo.printModInfo.EnumPrintMod == EnumPrintMod.StatusMultiple)
+            {
+                MultipleInfo multipleInfo = (MultipleInfo)PrintSettingsInfo.printModInfo;
+                if (PrintedPageCount % (multipleInfo.HorizontalPageNumber * multipleInfo.VerticalPageNumber) != 0)
+                {
+                    PrintedPageCount = PrintedPageCount / (multipleInfo.HorizontalPageNumber * multipleInfo.VerticalPageNumber) + 1;
+                }
+                else
+                {
+                    PrintedPageCount = PrintedPageCount / (multipleInfo.HorizontalPageNumber * multipleInfo.VerticalPageNumber);
+                }
+            }
+            else if (PrintSettingsInfo.printModInfo.EnumPrintMod == EnumPrintMod.StatusBooklet)
+            {
+                BookletInfo bookletInfo = (BookletInfo)PrintSettingsInfo.printModInfo;
+                if (PrintedPageCount == 1)
+                {
+                    PrintedPageCount = 1;
+                }
+                else
+                {
+                    PrintedPageCount = (bookletInfo.EndPaperIndex - bookletInfo.BeginPaperIndex) * 2;
+                    //PrintedPageCount = (PrintedPageCount%4 == 0)?(PrintedPageCount/2):((PrintedPageCount / 4) + 1) * 2;
+                    if (bookletInfo.EnumBookletSubset == EnumBookletSubset.StatusFrontSideOnly  || 
+                        bookletInfo.EnumBookletSubset == EnumBookletSubset.StatusBackSideOnly)
+                    {
+                        PrintedPageCount /= 2;
+                    }
+                }
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<PrintSettingsInfo>(ParameterNames.PrintSettingsInfo, out PrintSettingsInfo);
+            if (PDFViewer != null && PrintSettingsInfo != null)
+            {
+                SetPreview();
+                CaculatePrintedPageCount();
+            }
+        }
+    }
+}

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

@@ -175,7 +175,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
             if (BookletInfo != null)
             {
-                this.eventAggregator.GetEvent<ModInfoSendEvent>().Publish(BookletInfo);
+                //this.eventAggregator.GetEvent<ModInfoSendEvent>().Publish(BookletInfo);
             }
         }
 

+ 1 - 1
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModMultipleContentViewModel.cs

@@ -131,7 +131,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
             if (MultipleInfo != null)
             {
-                this.eventAggregator.GetEvent<ModInfoSendEvent>().Publish(MultipleInfo);
+               // this.eventAggregator.GetEvent<ModInfoSendEvent>().Publish(MultipleInfo);
             }
         }
 

+ 4 - 2
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContentViewModel.cs

@@ -1,4 +1,5 @@
-using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
+using PDF_Office.EventAggregators;
+using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -69,6 +70,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
             this.eventAggregator = eventAggregator;
             SizeInfo = new SizeInfo();
+            SizeInfo.EnumPrintMod = EnumPrintMod.StatusSize;
             SetStatusAdaptiveCommand = new DelegateCommand(SetStatusAdaptive);
             SetStatusActuralCommand = new DelegateCommand(SetStatusActural);
             SetStatusCustomizedCommand = new DelegateCommand(SetStatusCustomized);
@@ -79,7 +81,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
             if(SizeInfo!= null)
             {
-                this.eventAggregator.GetEvent<ModInfoSendEvent>().Publish(SizeInfo);
+               this.eventAggregator.GetEvent<SendPrintSettingsModInfoEvent>().Publish(SizeInfo);
             }
         }
 

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

@@ -1,245 +0,0 @@
-using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
-using Prism.Commands;
-using Prism.Mvvm;
-using Prism.Services.Dialogs;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
-{
-    public class HomePagePrinterPageSetDialogViewModel : BindableBase, IDialogAware
-    {
-        private int _paperSizeIndex;
-        public int PaperSizeIndex
-        {
-            get { return _paperSizeIndex; }
-            set { _paperSizeIndex = value; }
-        }
-
-        private int _paperSizeWidth;
-        public int PaperSizeWidth
-        {
-            get { return _paperSizeWidth; }
-            set
-            {
-                SetProperty(ref _paperSizeWidth, value);
-            }
-        }
-
-        private int _paperSizeHeight;
-        public int PaperSizeHeight
-        {
-            get { return _paperSizeHeight; }
-            set
-            {
-                SetProperty(ref _paperSizeHeight, value);
-            }
-        }
-
-        private List<string> _paperSizeNameList;
-        public List<string> PaperSizeNameList
-        {
-            get { return _paperSizeNameList; }
-            set { _paperSizeNameList = value; }
-        }
-
-        public Dictionary<EnumPaperSize, string> GetPaperSizeNameFromEnumPaperSize;
-
-        private int _leftMargin;
-        public int LeftMargin
-        {
-            get { return _leftMargin; }
-            set { _leftMargin = value; }
-        }
-
-        private int _rightMargin;
-        public int RightMargin
-        {
-            get { return _rightMargin; }
-            set { _rightMargin = value; }
-        }
-
-        private int _bottomMargin;
-        public int BottomMargin
-        {
-            get { return _bottomMargin; }
-            set { _bottomMargin = value; }
-        }
-
-        private int _topMargin;
-        public int TopMargin
-        {
-            get { return _topMargin; }
-            set { _topMargin = value; }
-        }
-
-        private int[] _paperMargin;
-        public int[] PaperMargin
-        {
-            get { return _paperMargin; }
-            set { _paperMargin = value; }
-        }
-
-        private Visibility _isPageSizeStackPanelsVisible = Visibility.Hidden;
-        public Visibility IsPageSizeStackPanelsVisible
-        {
-            get { return _isPageSizeStackPanelsVisible; }
-            set { SetProperty(ref _isPageSizeStackPanelsVisible, value); }
-        }
-
-        public DelegateCommand SetPaperSizeCommand { get; set; }
-        public DelegateCommand ConfirmSetPageSizeCommand { get; set; }
-        public DelegateCommand CancelSetPageSizeCommand { get; set; }
-
-        public HomePagePrinterPageSetDialogViewModel()
-        {
-            HomePagePrinterDialogModel homePagePrinterDialogModel = new HomePagePrinterDialogModel();
-            SetPaperSizeCommand = new DelegateCommand(SetPaperSize);
-            ConfirmSetPageSizeCommand = new DelegateCommand(ConfirmSetPageSize);
-            CancelSetPageSizeCommand = new DelegateCommand(CancelSetPageSize);
-
-            GetPaperSizeNameFromEnumPaperSize = new Dictionary<EnumPaperSize, string> { };
-            InitGetPaperSizeNameFromEnumPaperSize(ref GetPaperSizeNameFromEnumPaperSize);
-            InitPaperSizeList();
-        }
-
-        public void InitGetPaperSizeNameFromEnumPaperSize(ref Dictionary<EnumPaperSize, string> Dictionary)
-        {
-            GetPaperSizeNameFromEnumPaperSize.Clear();
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusA3, "A3");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusA4, "A4");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusA5, "A5");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusB5, "B5");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusNo10Envelope, "10号信封");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusChoukei3Envelope, "Choukei 3信封");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusDLEnvelope, "DL信封");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusJISB5, "JIS B5");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusROC16K, "ROC 16K");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusExtraLargeBA3, "超大型B/A3型");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusTabloid, "小报用纸");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusExraLargeTabloid, "小报用纸(特大)");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusAmericanLegal, "美国法定用纸");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusAmericanLetter, "美国信纸");
-            GetPaperSizeNameFromEnumPaperSize.Add(EnumPaperSize.StatusCustomized, "自定义");
-        }
-
-        public void InitPaperSizeList()
-        {
-            PaperSizeNameList = new List<string>();
-            for (int temp = 0; temp < GetPaperSizeNameFromEnumPaperSize.Count; temp++)
-            {
-                PaperSizeNameList.Add(GetPaperSizeNameFromEnumPaperSize[(EnumPaperSize)temp]);
-            }
-        }
-
-        public void SetPaperSize()
-        {
-            IsPageSizeStackPanelsVisible = Visibility.Hidden;
-            switch (PaperSizeIndex)
-            {
-                case (int)EnumPaperSize.StatusA3:
-                    PaperSizeWidth = 297;
-                    PaperSizeHeight = 420;
-                    break;
-                case (int)EnumPaperSize.StatusA4:
-                    PaperSizeWidth = 210;
-                    PaperSizeHeight = 297;
-                    break;
-                case (int)EnumPaperSize.StatusA5:
-                    PaperSizeWidth = 148;
-                    PaperSizeHeight = 210;
-                    break;
-                case (int)EnumPaperSize.StatusB5:
-                    PaperSizeWidth = 176;
-                    PaperSizeHeight = 250;
-                    break;
-                case (int)EnumPaperSize.StatusNo10Envelope:
-                    PaperSizeWidth = 458;
-                    PaperSizeHeight = 324;
-                    break;
-                case (int)EnumPaperSize.StatusChoukei3Envelope:
-                    PaperSizeWidth = 120;
-                    PaperSizeHeight = 235;
-                    break;
-                case (int)EnumPaperSize.StatusDLEnvelope:
-                    PaperSizeWidth = 220;
-                    PaperSizeHeight = 110;
-                    break;
-                case (int)EnumPaperSize.StatusJISB5:
-                    PaperSizeWidth = 176;
-                    PaperSizeHeight = 276;
-                    break;
-                case (int)EnumPaperSize.StatusROC16K:
-                    PaperSizeWidth = 197;
-                    PaperSizeHeight = 273;
-                    break;
-                case (int)EnumPaperSize.StatusExtraLargeBA3:
-                    PaperSizeWidth = 330;
-                    PaperSizeHeight = 483;
-                    break;
-                case (int)EnumPaperSize.StatusTabloid:
-                    PaperSizeWidth = 431;
-                    PaperSizeHeight = 279;
-                    break;
-                case (int)EnumPaperSize.StatusExraLargeTabloid:
-                    PaperSizeWidth = 305;
-                    PaperSizeHeight = 457;
-                    break;
-                case (int)EnumPaperSize.StatusAmericanLegal:
-                    PaperSizeWidth = 216;
-                    PaperSizeHeight = 356;
-                    break;
-                case (int)EnumPaperSize.StatusAmericanLetter:
-                    PaperSizeWidth = 216;
-                    PaperSizeHeight = 279;
-                    break;
-                case (int)EnumPaperSize.StatusCustomized:
-                    IsPageSizeStackPanelsVisible = Visibility.Visible;
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        public void ConfirmSetPageSize()
-        {
-            var dialogResult = new DialogResult(ButtonResult.OK);
-            dialogResult.Parameters.Add("LeftMargin", LeftMargin);
-            dialogResult.Parameters.Add("TopMargin", TopMargin);
-            dialogResult.Parameters.Add("RightMargin", RightMargin);
-            dialogResult.Parameters.Add("BottomMargin", BottomMargin);
-            dialogResult.Parameters.Add("PaperWidth", PaperSizeWidth);
-            dialogResult.Parameters.Add("PaperHeight", PaperSizeHeight);
-            dialogResult.Parameters.Add("PaperSizeIndex", PaperSizeIndex);
-            RequestClose.Invoke(dialogResult);
-        }
-
-        public void CancelSetPageSize()
-        {
-            var dialogResult = new DialogResult(ButtonResult.Cancel);
-            RequestClose.Invoke(dialogResult);
-        }
-
-        public event Action<IDialogResult> RequestClose;
-
-        public string Title => "";
-
-
-        public bool CanCloseDialog()
-        {
-            return true;
-        }
-
-        public void OnDialogClosed()
-        {
-
-        }
-
-        public void OnDialogOpened(IDialogParameters parameters)
-        {
-        }
-    }
-}

+ 236 - 0
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPaperSettingsDialogViewModel.cs

@@ -0,0 +1,236 @@
+using Microsoft.Xaml.Behaviors;
+using PDF_Office.Model;
+using PDF_Office.CustomControl;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Printing;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
+{
+    public class HomePagePrinterPaperSettingsDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => "PaperSettings";
+        public event Action<IDialogResult> RequestClose;
+
+        private PrintQueue printQueue;
+
+        private Visibility _isPageSizeStackPanelsVisible = Visibility.Hidden;
+        public Visibility IsPageSizeStackPanelsVisible
+        {
+            get { return _isPageSizeStackPanelsVisible; }
+            set { SetProperty(ref _isPageSizeStackPanelsVisible, value); }
+        }
+
+        /// <summary>
+        /// 是否自定义纸张
+        /// </summary>
+        private bool _isCustomSize;
+        public bool IsCustomSize
+        {
+            get => _isCustomSize;
+            set
+            {
+                if (value)
+                {
+                    IsPageSizeStackPanelsVisible = Visibility.Visible;
+                }
+                else
+                {
+                    IsPageSizeStackPanelsVisible = Visibility.Hidden;
+                }
+                _isCustomSize = value;
+            }
+        }
+
+        private int? _customPaperSizeWidth;
+        /// <summary>
+        /// 自定义页面尺寸:宽度
+        /// </summary>
+        public int? CustomPaperSizeWidth
+        {
+            get => _customPaperSizeWidth;
+            set => _customPaperSizeWidth = value;
+        }
+
+        private int? _customPaperSizeHeight;
+        /// <summary>
+        /// 自定义页面尺寸:高度
+        /// </summary>
+        public int? CustomPaperSizeHeight
+        {
+            get => _customPaperSizeHeight;
+            set => _customPaperSizeHeight = value;
+        }
+
+        /// <summary>
+        /// 当前选中的纸张尺寸
+        /// </summary>
+        public PageMediaSize currentPageMediaSize;
+
+        /// <summary>
+        /// 打印机支持的纸张
+        /// </summary>
+        public List<PageMediaSize> PageMediaSizeList = new List<PageMediaSize>();
+
+        /// <summary>
+        /// 纸张大小列表
+        /// </summary>
+        private List<string> _pageMediaSizeNameList = new List<string>();
+        public List<string> PageMediaSizeNameList
+        {
+            get => _pageMediaSizeNameList;
+            set => _pageMediaSizeNameList = value;
+        }
+
+        private List<int> _margin = new List<int>();
+        public List<int> Margin
+        {
+            get => _margin;
+            set => _margin = value;
+        }
+
+        private int _pageMediaSizeIndex = 0;
+        public int PageMediaSizeIndex
+        {
+            get=> _pageMediaSizeIndex;
+            set => SetProperty(ref _pageMediaSizeIndex, value);
+        }
+
+        /// <summary>
+        /// 页边距
+        /// </summary>
+        private int _marginTop;
+        public int MarginTop
+        {
+            get => _marginTop;
+            set => SetProperty(ref _marginTop, value);
+        }
+
+        private int _marginBottom;
+        public int MarginBottom
+        {
+            get => _marginBottom;
+            set => SetProperty(ref _marginBottom, value);
+        }
+
+        private int _marginLeft;
+        public int MarginLeft
+        {
+            get => _marginLeft; 
+            set => SetProperty(ref _marginLeft, value);
+        }
+
+        private int _marginRight;
+        public int MarginRight
+        {
+            get => _marginRight;
+            set => SetProperty(ref _marginRight, value);
+        }
+
+        public DelegateCommand CancelCommand { get; set; }
+        public DelegateCommand<object> SetPaperSizeCommand { get; set; }
+        public DelegateCommand ConfirmPaperSettingsCommand { get; set; }
+
+        HomePagePrinterPaperSettingsDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(Cancel);
+            SetPaperSizeCommand = new DelegateCommand<object>(SetPaperSize);
+            ConfirmPaperSettingsCommand = new DelegateCommand(ConfirmPaperSettings);
+        }
+
+        private void InitPaperSizeList()
+        {
+            PageMediaSizeList.Clear();
+            PageMediaSizeNameList.Clear();
+            foreach (PageMediaSize size in printQueue.GetPrintCapabilities().PageMediaSizeCapability)
+            {
+                if (size == null || size.PageMediaSizeName == null)
+                {
+                    continue;
+                }
+                PageMediaSizeList.Add(size);
+                PageMediaSizeNameList.Add(size.PageMediaSizeName.ToString());
+            }
+            PageMediaSizeNameList.Add("自定义");
+            if (PageMediaSizeNameList.Contains("ISOA4"))
+            {
+                PageMediaSizeIndex = PageMediaSizeNameList.IndexOf("ISOA4");
+            }
+            else
+            {
+                PageMediaSizeIndex = 0;
+            }
+            currentPageMediaSize = PageMediaSizeList[PageMediaSizeIndex];
+        }
+
+        public void SetPaperSize(object e)
+        {
+            var cmb = e as ComboBox;
+            if (cmb.SelectedIndex < PageMediaSizeNameList.Count - 1)
+            {
+                IsCustomSize = false;
+                currentPageMediaSize = PageMediaSizeList[PageMediaSizeNameList.IndexOf(cmb.SelectedItem.ToString())];
+            }
+            else
+            {
+                IsCustomSize = true;
+            }
+        }
+
+        public void ConfirmPaperSettings ()
+        {
+            if (IsCustomSize)
+            {
+                if (CustomPaperSizeHeight!=null&&CustomPaperSizeWidth!=null)
+                {
+                    currentPageMediaSize = new PageMediaSize((double)CustomPaperSizeWidth, (double)CustomPaperSizeHeight);
+                }
+                else
+                {
+                    MessageBoxEx.Show("纸张尺寸缺失");
+                    return;
+                }
+            }
+            Margin.Add(MarginLeft);
+            Margin.Add(MarginTop);
+            Margin.Add(MarginRight);
+            Margin.Add(MarginBottom);
+            var dialogResult = new DialogResult(ButtonResult.OK);
+            dialogResult.Parameters.Add("PageMediaSize", currentPageMediaSize);
+            dialogResult.Parameters.Add("MarginLeft", MarginLeft);
+            dialogResult.Parameters.Add("MarginTop", MarginTop);
+            dialogResult.Parameters.Add("MarginRight", MarginRight);
+            dialogResult.Parameters.Add("MarginBottom", MarginBottom);
+            RequestClose.Invoke(dialogResult);
+        }
+
+        public void Cancel()
+        {
+            var dialogResult = new DialogResult(ButtonResult.Cancel);
+            RequestClose.Invoke(dialogResult);
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            parameters.TryGetValue<PrintQueue>(ParameterNames.PrintQueue, out printQueue);
+            InitPaperSizeList();
+        }
+    }
+}

+ 0 - 14
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/ModInfoSendEvent.cs

@@ -1,14 +0,0 @@
-using PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter;
-using Prism.Events;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
-{
-    internal class ModInfoSendEvent : PubSubEvent<PrintMod>
-    {
-    }
-}

+ 136 - 144
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialog.xaml

@@ -1,178 +1,170 @@
 <UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDialog"
-           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             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:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
-             xmlns:cus="clr-namespace:PDF_Office.CustomControl"
-             xmlns:prism="http://prismlibrary.com/"
-             xmlns:homepageprinter="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter"
-             d:DataContext="{d:DesignInstance Type=homepageprinter:HomePagePrinterDialogViewModel}"
-             prism:ViewModelLocator.AutoWireViewModel="True" 
-              d:DesignHeight="650"
-             d:DesignWidth="903"
-             mc:Ignorable="d" 
-             >
+             xmlns:prism="http://prismlibrary.com/" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:homepageprinter="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:DataContext="{d:DesignInstance Type=homepageprinter:HomePagePrinterDialogViewModel}"
+             prism:ViewModelLocator.AutoWireViewModel="True" >
+    <UserControl.Resources>
+        <ResourceDictionary >
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="../../../../Styles/RadioButtonStyle.xaml"></ResourceDictionary>
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="{x:Type Window}">
+            <Setter Property="Title" Value="{Binding Title}" />
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="WindowStyle" Value="None" />
+            <Setter Property="MaxHeight"  Value="650"></Setter>
+            <Setter Property="MaxWidth" Value="893"></Setter>
+            <Setter Property="MinHeight" Value="650"></Setter>
+            <Setter Property="MinWidth" Value="893"></Setter>
+        </Style>
+    </prism:Dialog.WindowStyle>
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="50"></RowDefinition>
-            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="547"></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 Name="Title" Background="Transparent">
+            <TextBlock Text="打印" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        </Grid>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,0.5,0,0.5" VerticalAlignment="Center">
             <Grid>
                 <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="2*"/>
-                    <ColumnDefinition Width="4*"/>
+                    <ColumnDefinition Width="295"></ColumnDefinition>
+                    <ColumnDefinition Width="615"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
-                <Grid Grid.Column="0">
-                    <Border Height="430" Width="269"  Background="LightGray" HorizontalAlignment="Center" VerticalAlignment="Center">
-                        <Grid>
-                            <Grid.RowDefinitions>
-                                <RowDefinition Height="36"></RowDefinition>
-                                <RowDefinition></RowDefinition>
-                            </Grid.RowDefinitions>
-                            <Grid>
-                                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
-                                    <TextBlock Text="大小:"></TextBlock>
-                                    <TextBlock Text="{Binding PaperWidth}"></TextBlock>
-                                    <TextBlock Text="*"></TextBlock>
-                                    <TextBlock Text="{Binding PaperHeight}"></TextBlock>
-                                    <TextBlock Text="mm"></TextBlock>
-                                </StackPanel>
-                            </Grid>
-                            <Grid Grid.Row="1"   Width="{Binding ViewBoxWidth}" Height="{Binding ViewBoxHeight}">
-                                <Grid.RenderTransform>
-                                    <RotateTransform Angle="{Binding RotateAngle}" CenterX="{Binding RotateCenterX}" CenterY="{Binding RotateCenterY}"></RotateTransform>
-                                </Grid.RenderTransform>
-                                <Border Background="White" CornerRadius="1"   Width="{Binding CanvasWidth, Mode=OneWay}" Height="{Binding CanvasHeight,Mode=OneWay}" >
-                                    <Viewbox  Width="{Binding ViewBoxWidth}" Height="{Binding ViewBoxHeight}" Margin="{Binding ViewBoxMargin}">
-                                        <Image  Name="Image" Source="{Binding BitmapSource}"></Image>
-                                    </Viewbox>
-                                </Border>
-                            </Grid>
-                        </Grid>
-                            
-                    </Border>
-                    <StackPanel Orientation="Horizontal"  Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom">
-                        <Button Name="PrePageBtn"   Width="20" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsEnabled="{Binding IsEnableForGetPreviousPage}" Click="PrePageBtn_Click">
-                            <TextBlock Text="&lt;" VerticalAlignment="Center"></TextBlock>
-                        </Button>
-                        <TextBox x:Name="CurrentPageIndexTextBox" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" Text="{Binding CurrentListIndexString, Mode=OneWay}"  input:InputMethod.IsInputMethodEnabled="False"  PreviewTextInput="CurrentPageIndexTextBox_PreviewTextInput" KeyDown="CurrentPageIndexTextBox_KeyDown" ></TextBox>
-                        <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"></TextBlock>
-                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Text="{Binding MaxPageNumber}"></TextBlock>
-                        <Button Name="NextPageBtn"  Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsEnabled="{Binding IsEnableForGetNextPage }" Click="NextPageBtn_Click">
-                            <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
-                        </Button>
-                    </StackPanel>
+                <Grid Grid.Column="0" Margin="9, 14,17,0">
+                    <ContentControl prism:RegionManager.RegionName="{Binding HomePagePrinterDocumentRegionName}"   Visibility="Visible"/>
                 </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">
+                    <Grid>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="318"></RowDefinition>
+                            <RowDefinition Height="219"></RowDefinition>
+                        </Grid.RowDefinitions>
+                        <Grid Grid.Row="0" Margin="0,30,0,0" >
+                            <Grid.RowDefinitions>
+                                <RowDefinition  Height="84"></RowDefinition>
+                                <RowDefinition Height="123"></RowDefinition>
+                                <RowDefinition Height="81"></RowDefinition>
+                            </Grid.RowDefinitions>
+                            <StackPanel Grid.Row="0" Orientation="Vertical">
                                 <StackPanel Orientation="Horizontal">
                                     <TextBlock Text="打印机: " Height="20" Width="56" ></TextBlock>
-                                    <ComboBox Width="277" Height="32" Margin="8,0,0,0" ItemsSource="{Binding PrinterNameList}" SelectedIndex="{Binding PrinterIndex}"></ComboBox>
+                                    <ComboBox Name="PrinterNameComboBox" Width="277" Height="32" Margin="8,0,0,0"  ItemsSource="{Binding PrinterNameList}" SelectedIndex="{Binding PrinterSelectedIndex}">
+                                        <i:Interaction.Triggers>
+                                            <i:EventTrigger EventName="SelectionChanged">
+                                                <i:InvokeCommandAction Command="{Binding SelectPrinterCommand}" CommandParameter="{Binding ElementName=PrinterNameComboBox}"/>
+                                            </i:EventTrigger>
+                                            <i:EventTrigger EventName="LostFocus">
+                                                
+                                            </i:EventTrigger>
+                                        </i:Interaction.Triggers>
+                                    </ComboBox>
+                                    <Button Content="页面设置" Height="32" Width="91" Margin="31,0,0,0" Command="{Binding SetPaperCommand}"/>
                                 </StackPanel>
-                                <Button Content="页面设置" Height="32" Width="91" Margin="31,0,0,0" Command="{Binding SetPaperSizeCommand}"/>
-                            </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 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 Name="GrayscaleChk" VerticalAlignment="Center" Margin="27,0,0,0" Command="{Binding SetGrayscaleCommand}" CommandParameter="{Binding ElementName=GrayscaleChk}">
+                                        <TextBlock Text="黑白色 "/>
+                                    </CheckBox>
+                                    <CheckBox Name="BothSidesChk" VerticalAlignment="Center" Margin="27,0,0,0" Command="{Binding SetBothSidesCommand}" CommandParameter="{Binding ElementName=BothSidesChk}">
+                                        <TextBlock Text="双面打印"/>
+                                    </CheckBox>
                                 </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" IsChecked="{Binding IsBlackAndWhite}" Command="{Binding SetIsBlackAndWhiteCommand}">
-                                    <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 x:Name="PageRangeComboBox" Width="190" Height="32" Margin="10,0,0,0" Loaded="PageRangeComboBox_Loaded" Text="{Binding CustomPageRange}" IsCurrentPage="{Binding IsCurrentPage}" SelectedIndex="{Binding PageRangeIndex, Mode=TwoWay}"></cus:WritableComboBox>
+                            <StackPanel Grid.Row="1" Orientation="Vertical" Margin="0,20,0,0">
+                                <TextBlock Text="打印设置" FontWeight="ExtraBlack"/>
+                                <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                                    <StackPanel Orientation="Horizontal">
+                                        <TextBlock Text="页面范围: " Height="20" Width="70"></TextBlock>
+                                        <cus:WritableComboBox  x:Name="PageRangeComboBox" Width="190" Height="32" Margin="10,0,0,0">
+                                            <i:Interaction.Triggers>
+                                                <i:EventTrigger EventName="SelectionChanged">
+                                                    <i:InvokeCommandAction Command="{Binding SetPageRangeSelectionIndexCommand}" CommandParameter="{Binding ElementName=PageRangeComboBox}"></i:InvokeCommandAction>
+                                                </i:EventTrigger>
+                                                <i:KeyTrigger FiredOn="KeyDown" Key="Return">
+                                                    <i:InvokeCommandAction Command="{Binding SetCustomPageRangeCommand}" CommandParameter="{Binding ElementName=PageRangeComboBox}"></i:InvokeCommandAction>
+                                                </i:KeyTrigger>
+                                                <i:EventTrigger EventName="LostFocus">
+                                                    <!--<i:InvokeCommandAction Command="{Binding SetCustomPageRangeCommand}" CommandParameter="{Binding ElementName=PageRangeComboBox}"></i:InvokeCommandAction>-->
+                                                </i:EventTrigger>
+                                            </i:Interaction.Triggers>
+                                        </cus:WritableComboBox>
+                                    </StackPanel>
+                                    <StackPanel Orientation="Horizontal" Margin="35,0,0,0">
+                                        <TextBlock Text="打印方向: " Height="20" Width="70"></TextBlock>
+                                        <ComboBox Name="PrintOrientationCbx" Width="190" Height="32" Margin="10,0,0,0"  ItemsSource="{Binding PrintOrientationList}" SelectedIndex="{Binding PrintOrientationIndex}">
+                                            <i:Interaction.Triggers>
+                                                <i:EventTrigger EventName="SelectionChanged">
+                                                    <i:InvokeCommandAction Command="{Binding SetPrintOritationCommand}" CommandParameter="{Binding ElementName=Pr}"></i:InvokeCommandAction>
+                                                </i:EventTrigger>
+                                            </i:Interaction.Triggers>
+                                        </ComboBox>
+                                    </StackPanel>
                                 </StackPanel>
-                                <StackPanel Orientation="Horizontal" Margin="35,0,0,0">
-                                    <TextBlock Text="打印方向: " Height="20" Width="70"></TextBlock>
-                                    <ComboBox Name="PrintOrientationComboBox" Width="190" Height="32" Margin="10,0,0,0" ItemsSource="{Binding PrintOrientationList}" SelectedIndex="{Binding PrintOrientationIndex, Mode=TwoWay}" SelectionChanged="PrintOrientationComboBox_SelectionChanged"></ComboBox>
+                                <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="{Binding PrintContentIndex}"></ComboBox>
+                                    </StackPanel>
+                                    <CheckBox x:Name="ReversePageCheckBox"  Margin="35,0,0,0" VerticalAlignment="Center">
+                                        <TextBlock Text="逆页序打印"/>
+                                    </CheckBox>
                                 </StackPanel>
                             </StackPanel>
-                            <StackPanel Orientation="Horizontal" Margin="0,12,0,0">
+                            <StackPanel Grid.Row="2" Orientation="Vertical" Margin="0,20,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="{Binding PrintContentIndex}" SelectionChanged="ComboBox_SelectionChanged"></ComboBox>
+                                    <TextBlock Text="调整页面大小和处理页面" FontWeight="ExtraBlack"/>
+                                    <Button  Content="?" FontSize="6" Width="16" Height="16" Margin="7,0,0,0"></Button>
                                 </StackPanel>
-                                <CheckBox x:Name="ReversePageCheckBox"  Margin="35,0,0,0" VerticalAlignment="Center" IsChecked="{Binding IsPageIndexReverse}" Command="{Binding SetIsPageIndexReverseCommand}" Click="ReversePageCheckBox_Click">
-                                    <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 x:Name="ModSize" Background="WhiteSmoke" Width="126" Height="32" IsEnabled="{Binding IsEnableForModSize, Mode=OneWay}" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModSize}">
-                                    <Border>
-                                        <TextBlock Text="大小"/>
-                                    </Border>
-                                </Button>
-                                <!--Button Name="ModPoster" Background="WhiteSmoke" Width="126" Height="32" Margin="25,0,25,0" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModPoster}"-->
-                                    <Button Name="ModPoster" Background="WhiteSmoke" Width="126" Height="32" Margin="25,0,25,0" IsEnabled="{Binding IsEnableForModPoster, Mode=OneWay}">
+                                <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
+                                    <RadioButton Style="{StaticResource ListModeRadioBtnStyle}"  x:Name="ModSizeRdo" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModSizeRdo}" Background="WhiteSmoke" Width="126" Height="32" IsChecked="True">
                                         <Border>
-                                        <TextBlock Text="海报"></TextBlock>
-                                    </Border>
-                                </Button>
-                                <Button Name="ModMultiple" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,25,0" IsEnabled="{Binding IsEnableForModMultiple, Mode=OneWay}" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModMultiple}">
-                                    <Border>
-                                        <TextBlock Text="多页"></TextBlock>
-                                    </Border>
-                                </Button>
-                                <Button Name="ModBooklet" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,10,0" IsEnabled="{Binding IsEnableForModBooklet, Mode=OneWay}" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModBooklet}">
-                                    <Border>
-                                        <TextBlock Text="小册子"></TextBlock>
-                                    </Border>
-                                </Button>
-
-                            </StackPanel>
-                            <StackPanel>
-                                <Grid>
-                                    <Grid.RowDefinitions>
-                                        <RowDefinition Height="47*"/>
-                                        <RowDefinition Height="4*"/>
-                                    </Grid.RowDefinitions>
-                                    <ContentControl Height="180" Margin="12,12,12,12" x:Name="PrintMod" prism:RegionManager.RegionName="{Binding PrintModRegionName}"   Visibility="{Binding PrintModVisible}" Grid.RowSpan="2"/>
-                                </Grid>
+                                            <TextBlock Text="大小"/>
+                                        </Border>
+                                    </RadioButton>
+                                    <!--Button Name="ModPoster" Background="WhiteSmoke" Width="126" Height="32" Margin="25,0,25,0" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModPoster}"-->
+                                    <RadioButton Style="{StaticResource ListModeRadioBtnStyle}" Name="ModPosterRdo" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModPosterRdo}" Background="WhiteSmoke" Width="126" Height="32" Margin="25,0,25,0">
+                                        <Border>
+                                            <TextBlock Text="海报"></TextBlock>
+                                        </Border>
+                                    </RadioButton>
+                                    <RadioButton  Style="{StaticResource ListModeRadioBtnStyle}" Name="ModMultipleRdo" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModMultipleRdo}" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,25,0">
+                                        <Border>
+                                            <TextBlock Text="多页"></TextBlock>
+                                        </Border>
+                                    </RadioButton>
+                                    <RadioButton  Style="{StaticResource ListModeRadioBtnStyle}" Name="ModBookletRdo" Command="{Binding ChangePrintModCommand}" CommandParameter="{Binding ElementName=ModBookletRdo}" Background="WhiteSmoke" Width="126" Height="32" Margin="0,0,10,0">
+                                        <Border>
+                                            <TextBlock Text="小册子"></TextBlock>
+                                        </Border>
+                                    </RadioButton>
+                                </StackPanel>
                             </StackPanel>
-                        </StackPanel>
+                        </Grid>
+                        <Grid Grid.Row="1">
+                            <ContentControl prism:RegionManager.RegionName="{Binding HomePagePrinterModRegionName}"   Visibility="Visible"/>
+                        </Grid>
                     </Grid>
                 </Grid>
             </Grid>
         </Border>
         <Grid Grid.Row="2">
             <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="15,0,0,0">
-                <Button Width="98" Height="32" Content="取消"   Margin="0,0,10,0"></Button>
+                <Button Width="98" Height="32" Content="取消"   Margin="0,0,10,0" Command="{Binding CancelCommand}"></Button>
                 <Button Width="98" Height="32"  Content="打印" Margin="0,0,16,0" Command="{Binding ConfirmPrintCommand}"></Button>
             </StackPanel>
         </Grid>
     </Grid>
-</UserControl>
+</UserControl>

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

@@ -17,15 +17,7 @@ namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
     {
         private IContainerProvider containerProvider;
 
-        private Regex regexForPageIndex = new Regex(@"^[0-9]\d*$");
-        private Regex regexForZeroIndex = new Regex(@"^[0]\d*$");
 
-        private int _currentPreviewPageIndex;
-        public int CurrentPreviewPageIndex
-        {
-            get { return _currentPreviewPageIndex; }
-            set { _currentPreviewPageIndex = value; }
-        }
 
         public HomePagePrinterDialog(IContainerProvider containerProvider)
         {
@@ -36,138 +28,5 @@ namespace PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter
             RegionManager.UpdateRegions();
         }
 
-        private void PageRangeComboBox_Loaded(object sender, RoutedEventArgs e)
-        {
-            PageRangeComboBox.CurrentPage = true;
-            if (PageRangeComboBox.CurrentPage)
-            {
-                ComboBoxItem comboBoxItem = new ComboBoxItem();
-                comboBoxItem.Content = "当前页面";
-                PageRangeComboBox.writableComboBox.Items.Insert(1, comboBoxItem);
-            }
-            PageRangeComboBox.writableComboBox.SelectionChanged += WritableComboBox_SelectionChanged;
-        }
-
-        private void WritableComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            ((HomePagePrinterDialogViewModel)this.DataContext).SetPageRangeCommand.Execute();
-            this.CurrentPageIndexTextBox.Text = "1";
-            CurrentPreviewPageIndex= 0;
-        }
-
-        private void PrintOrientationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            ((HomePagePrinterDialogViewModel)this.DataContext).SetPrintOrientationCommand.Execute();
-        }
-
-        private void CurrentPageIndexTextBox_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
-        {
-            Regex re = new Regex("[^0-9]+");
-            e.Handled = re.IsMatch(e.Text);
-        }
-
-        private void CurrentPageIndexTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
-        {
-            if (((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber != null)
-            {
-                if (e.Key == System.Windows.Input.Key.Enter && this.CurrentPageIndexTextBox.Text != (CurrentPreviewPageIndex + 1).ToString())
-                {
-                    var CurrentPageTextBox = sender as System.Windows.Controls.TextBox;
-
-                    //非子集、空集、边界值
-                    if (!regexForPageIndex.IsMatch(CurrentPageTextBox.Text) || CurrentPageTextBox.Text == "" || regexForZeroIndex.IsMatch(CurrentPageTextBox.Text))
-                    {
-                        CurrentPreviewPageIndex = 1;
-                        CurrentPageTextBox.Text = CurrentPreviewPageIndex.ToString();
-                    }
-
-                    if (int.Parse(CurrentPageTextBox.Text) > int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber))
-                    {
-                        CurrentPreviewPageIndex = int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber);
-                        CurrentPageTextBox.Text = ((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber;
-                    }
-
-                    CurrentPreviewPageIndex = int.Parse(CurrentPageIndexTextBox.Text);
-                    CurrentPreviewPageIndex = CurrentPreviewPageIndex - 1;
-                    ((HomePagePrinterDialogViewModel)this.DataContext).CurrentListIndexString = (CurrentPreviewPageIndex).ToString();
-                    ((HomePagePrinterDialogViewModel)this.DataContext).GetPagePreviewWhenIndexChangedCommand.Execute();
-                }
-            }
-        }
-
-        private void PrePageBtn_Click(object sender, RoutedEventArgs e)
-        {
-            CurrentPreviewPageIndex--;
-            this.CurrentPageIndexTextBox.Text = (CurrentPreviewPageIndex + 1).ToString();
-           ((HomePagePrinterDialogViewModel)this.DataContext).CurrentListIndexString = CurrentPreviewPageIndex.ToString();
-            ((HomePagePrinterDialogViewModel)this.DataContext).GetPagePreviewWhenIndexChangedCommand.Execute();
-        }
-
-        private void NextPageBtn_Click(object sender, RoutedEventArgs e)
-        {
-            CurrentPreviewPageIndex++;
-            this.CurrentPageIndexTextBox.Text = (CurrentPreviewPageIndex + 1).ToString();
-            ((HomePagePrinterDialogViewModel)this.DataContext).CurrentListIndexString = CurrentPreviewPageIndex.ToString();
-            ((HomePagePrinterDialogViewModel)this.DataContext).GetPagePreviewWhenIndexChangedCommand.Execute();
-        }
-
-        //private void CurrentPageIndexTextBox_TextChanged(object sender, TextChangedEventArgs e)
-        //{
-        //    if (((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber != null)
-        //    {
-        //        if (this.CurrentPageIndexTextBox.Text != "")
-        //        {
-        //            var CurrentPageTextBox = sender as System.Windows.Controls.TextBox;
-        //            if (regexForPageIndex.IsMatch(CurrentPageTextBox.Text))
-        //            {
-        //                if (int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber) > 2)
-        //                {
-        //                    if (int.Parse(CurrentPageTextBox.Text) > 1 && int.Parse(CurrentPageTextBox.Text) < int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber))
-        //                    {
-        //                        PrePageBtn.IsEnabled = true;
-        //                        NextPageBtn.IsEnabled = true;
-        //                    }
-        //                    else if (int.Parse(CurrentPageTextBox.Text) <= 1 && int.Parse(CurrentPageTextBox.Text) < int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber))
-        //                    {
-        //                        PrePageBtn.IsEnabled = false;
-        //                        NextPageBtn.IsEnabled = true;
-        //                    }
-        //                    else if (int.Parse(CurrentPageTextBox.Text) > 1 && int.Parse(CurrentPageTextBox.Text) >= int.Parse(((HomePagePrinterDialogViewModel)this.DataContext).MaxPageNumber))
-        //                    {
-        //                        PrePageBtn.IsEnabled = true;
-        //                        NextPageBtn.IsEnabled = false;
-        //                    }
-        //                }
-        //                else
-        //                {
-        //                    PrePageBtn.IsEnabled = false;
-        //                    NextPageBtn.IsEnabled = false;
-        //                }
-        //            }
-        //            else
-        //            {
-        //                this.PrePageBtn.IsEnabled = false;
-        //                this.NextPageBtn.IsEnabled = false;
-        //            }
-        //        }
-        //        else
-        //        {
-        //            this.PrePageBtn.IsEnabled = false;
-        //            this.NextPageBtn.IsEnabled = false;
-        //        }
-        //    }
-
-        //}
-
-        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            ((HomePagePrinterDialogViewModel)this.DataContext).SetPrintContentCommand.Execute();
-        }
-
-        private void ReversePageCheckBox_Click(object sender, RoutedEventArgs e)
-        {
-            this.CurrentPageIndexTextBox.Text = "1";
-            CurrentPreviewPageIndex = 0;
-        }
     }
 }

+ 43 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContent.xaml

@@ -0,0 +1,43 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterDocumentContent"
+             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  Height="468" Width="269">
+        <Border Height="430" Width="269"  Background="LightGray" HorizontalAlignment="Center" VerticalAlignment="Top">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="37"></RowDefinition>
+                    <RowDefinition></RowDefinition>
+                </Grid.RowDefinitions>
+                <Grid Grid.Row="0">
+                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom" Orientation="Horizontal">
+                        <TextBlock Text="大小:"></TextBlock>
+                        <TextBlock Text="{Binding PaperWidth}"></TextBlock>
+                        <TextBlock Text="*"></TextBlock>
+                        <TextBlock Text="{Binding PaperHeight}"></TextBlock>
+                        <TextBlock Text="mm"></TextBlock>
+                    </StackPanel>
+                </Grid>
+                <Border Grid.Row="1" Width="{Binding ViewBoxWidth}" Height="{Binding ViewBoxHeight}" BorderThickness="1" BorderBrush="Black" CornerRadius="2">
+                    <Grid Background="White">
+                        <Viewbox>
+                            <Image  Name="Image" Source="{Binding BitmapSource}"></Image>
+                        </Viewbox>
+                    </Grid>
+                </Border>
+            </Grid>
+        </Border>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" >
+            <Button Name="PrePageBtn"   Width="20" Height="20" HorizontalAlignment="Left" FontSize="16" Background="WhiteSmoke" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
+                <TextBlock Text="&lt;" VerticalAlignment="Center"></TextBlock>
+            </Button>
+            <TextBox x:Name="CurrentPageIndexTextBox" Width="30" Height="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="10,0,5,0" ></TextBox>
+            <TextBlock  Text="of"  HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0"></TextBlock>
+            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Text="{Binding PrintedPageCount}"></TextBlock>
+            <Button Name="NextPageBtn"  Width="20" Height="20" HorizontalAlignment="Left" FontSize="16"  Background="WhiteSmoke"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
+                <TextBlock Text=">" VerticalAlignment="Center"></TextBlock>
+            </Button>
+        </StackPanel>
+    </Grid>
+</UserControl>

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

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

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

@@ -1,71 +0,0 @@
-<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/" xmlns:homepageprinter="clr-namespace:PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter" d:DataContext="{d:DesignInstance Type=homepageprinter:HomePagePrinterPageSetDialogViewModel}"
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             d:DesignHeight="380"
-             d:DesignWidth="371"
-             mc:Ignorable="d">
-    <Grid Height="380" Width="371" Margin="16,0,16,0">
-        <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="1*"></RowDefinition>
-                </Grid.RowDefinitions>
-                <StackPanel Grid.Row="0">
-                    <TextBlock Text="纸张" FontWeight="ExtraBlack" Width="56" Height="22" HorizontalAlignment="Left"/>
-                    <StackPanel Orientation="Horizontal">
-                        <TextBlock Text="大小: " VerticalAlignment="Center" Width="42"></TextBlock>
-                        <ComboBox Width="281" Height="32" Margin="16,0,0,0" ItemsSource="{Binding PaperSizeNameList}" SelectedIndex="{Binding PaperSizeIndex}" SelectionChanged="ComboBox_SelectionChanged"></ComboBox>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal" Margin="0,9,0,0" Visibility="{Binding IsPageSizeStackPanelsVisible, Mode=OneWay}">
-                        <TextBox Margin="58,0,0,0" Height="32" Width="52" VerticalContentAlignment="Center" TextChanged="TextBox_TextChanged" Text="{Binding PaperSizeWidth, Mode=TwoWay}"></TextBox>
-                        <TextBlock Text="X" Width=" 9" Margin="11,0,11,0"  VerticalAlignment="Center"></TextBlock>
-                        <TextBox Margin="0,0,0,0" Height="32" Width="52" VerticalContentAlignment="Center" Text="{Binding PaperSizeHeight, Mode=TwoWay}"></TextBox>
-                        <TextBlock Text="mm" Margin="11,0,11,0"  VerticalAlignment="Center"></TextBlock>
-                    </StackPanel>
-                </StackPanel>
-                <StackPanel Grid.Row="1" Margin="0,0,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" Text="{Binding TopMargin, Mode=TwoWay}" Height="32" Width=" 66"></cus:NumericUpDown>
-                        </StackPanel>
-                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
-                            <TextBlock Text="下: " VerticalAlignment="Center" ></TextBlock>
-                            <cus:NumericUpDown Margin="30,0,0,0" Text="{Binding BottomMargin, Mode=TwoWay}"  Height="32" Width=" 66"></cus:NumericUpDown>
-                        </StackPanel>
-                    </StackPanel>
-                    <StackPanel Orientation="Horizontal" Margin="0,14,0,0">
-                        <StackPanel Orientation="Horizontal">
-                            <TextBlock Text="左: " VerticalAlignment="Center"></TextBlock>
-                            <cus:NumericUpDown Margin="30,0,0,0" Text="{Binding LeftMargin, Mode=TwoWay}"  Height="32" Width=" 66"></cus:NumericUpDown>
-                        </StackPanel>
-                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
-                            <TextBlock Text="右: " VerticalAlignment="Center"></TextBlock>
-                            <cus:NumericUpDown Margin="30,0,0,0" Text="{Binding RightMargin, Mode=TwoWay}"  Height="32" Width=" 66"></cus:NumericUpDown>
-                        </StackPanel>
-                    </StackPanel>
-                </StackPanel>
-            </Grid>
-        </Border>
-        <Grid Grid.Row="2">
-            <StackPanel Orientation="Horizontal" Margin="0,16,32,16" HorizontalAlignment="Right">
-                <Button Content="取消" Height="32" Width="98" Margin="0,0,10,0" Command="{Binding CancelSetPageSizeCommand}"></Button>
-                <Button Content="确认"  Height="32" Width="98" Command="{Binding ConfirmSetPageSizeCommand}"></Button>
-            </StackPanel>
-
-        </Grid>
-    </Grid>
-</UserControl>

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

@@ -1,26 +0,0 @@
-using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter;
-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();
-        }
-
-        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            ((HomePagePrinterPageSetDialogViewModel)this.DataContext).SetPaperSizeCommand.Execute();
-        }
-
-        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
-        {
-
-        }
-    }
-}

+ 83 - 0
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterPaperSettingsDialog.xaml

@@ -0,0 +1,83 @@
+<UserControl x:Class="PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterPaperSettingsDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:prism="http://prismlibrary.com/" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+             prism:ViewModelLocator.AutoWireViewModel="True">
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="{x:Type Window}">
+            <Setter Property="Title" Value="{Binding Title}" />
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="WindowStyle" Value="None" />
+            <Setter Property="MaxHeight"  Value="371"></Setter>
+            <Setter Property="MaxWidth" Value="380"></Setter>
+            <Setter Property="MinHeight" Value="371"></Setter>
+            <Setter Property="MinWidth" Value="380"></Setter>
+        </Style>
+    </prism:Dialog.WindowStyle>
+    <Grid Height="371" Width="380">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="50"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <RowDefinition Height="64"></RowDefinition>
+        </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <TextBlock Text="页面设置" FontSize="20" FontWeight="ExtraBlack" VerticalAlignment="Center" HorizontalAlignment="Left"  Margin="20,0,0,0" Height="28" Width="120"/>
+        </Grid>
+        <Border Grid.Row="1" BorderBrush="Gray" BorderThickness="0,0.5,0,0.5" VerticalAlignment="Center" >
+            <Grid Grid.Row="1"  Height="268" Margin="16,0,0,0">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="137"></RowDefinition>
+                    <RowDefinition Height="131"></RowDefinition>
+                </Grid.RowDefinitions>
+                <StackPanel Grid.Row="0" Margin="0,16,0,0">
+                    <TextBlock Text="纸张" FontWeight="ExtraBlack" Width="56" Height="22" FontSize="14" HorizontalAlignment="Left"/>
+                    <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
+                        <TextBlock Text="大小: " VerticalAlignment="Center" FontSize="14" Width="42"></TextBlock>
+                        <ComboBox Name="PageMediaSizeNameCmb" Width="281" Height="32" Margin="16,0,0,0" ItemsSource="{Binding PageMediaSizeNameList}" SelectedIndex="{Binding PageMediaSizeIndex}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding SetPaperSizeCommand}" CommandParameter="{Binding ElementName=PageMediaSizeNameCmb}"></i:InvokeCommandAction>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ComboBox>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,9,0,0"  Visibility="{Binding IsPageSizeStackPanelsVisible, Mode=OneWay}">
+                        <TextBox Margin="58,0,0,0" Height="32" Width="52" VerticalContentAlignment="Center" Text="{Binding CustomPaperSizeWidth}"></TextBox>
+                        <TextBlock Text="X" Width=" 9" Margin="11,0,11,0"  VerticalAlignment="Center"></TextBlock>
+                        <TextBox Margin="0,0,0,0" Height="32" Width="52" VerticalContentAlignment="Center"  Text="{Binding CustomPaperSizeHeight}"></TextBox>
+                        <TextBlock Text="mm" Margin="11,0,11,0"  VerticalAlignment="Center"></TextBlock>
+                    </StackPanel>
+                </StackPanel>
+                <StackPanel Grid.Row="1" Margin="0,0,0,0">
+                    <TextBlock Text="页边距" FontWeight="ExtraBlack" Height="22" FontSize="14" HorizontalAlignment="Left"/>
+                    <StackPanel Orientation="Horizontal" Margin="0,11,0,0">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="上: " VerticalAlignment="Center"  FontSize="14"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0" Height="32" Width=" 66" Text="{Binding MarginTop, Mode=TwoWay}"></cus:NumericUpDown>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
+                            <TextBlock Text="下: " VerticalAlignment="Center"  FontSize="14"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0" Height="32" Width=" 66"  Text="{Binding MarginBottom, Mode=TwoWay}"></cus:NumericUpDown>
+                        </StackPanel>
+                    </StackPanel>
+                    <StackPanel Orientation="Horizontal" Margin="0,14,0,0">
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="左: " VerticalAlignment="Center"  FontSize="14"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0"  Height="32" Width=" 66"  Text="{Binding MarginLeft, Mode=TwoWay}"></cus:NumericUpDown>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal" Margin="71,0,0,0">
+                            <TextBlock Text="右: " VerticalAlignment="Center"  FontSize="14"></TextBlock>
+                            <cus:NumericUpDown Margin="30,0,0,0" Height="32" Width=" 66"  Text="{Binding MarginRight, Mode=TwoWay}"></cus:NumericUpDown>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+            </Grid>
+        </Border>
+        <Grid Grid.Row="2">
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                <Button Width="98" Height="32" Content="取消"   Margin="0,0,0,0" Command="{Binding CancelCommand}"></Button>
+                <Button Width="98" Height="32"  Content="确认" Margin="10,0,16,0" Command="{Binding ConfirmPaperSettingsCommand}"></Button>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

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

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