Browse Source

标记密文- 补充 页码指示符

ZhouJieSheng 2 years ago
parent
commit
8c281e9ada

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

@@ -95,6 +95,9 @@ namespace PDF_Office
             if (Settings.Default.RecentOpenFiles == null)
                 Settings.Default.RecentOpenFiles = new RecentOpenFiles();
 
+            if (Settings.Default.RedactionsSettings == null)
+                Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
+
             if (Settings.Default.AppProperties == null)
                 Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
 
@@ -243,7 +246,6 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<HeaderFooterCreateContent>();
             containerRegistry.RegisterForNavigation<HeaderFooterDocumentContent>();
             containerRegistry.RegisterForNavigation<RedactionContent>();
-            containerRegistry.RegisterForNavigation<RedactionDocumentContent>();
             //填写与签名
             containerRegistry.RegisterForNavigation<FillAndSignContent>();
             containerRegistry.RegisterForNavigation<DateFillProperty>();

+ 14 - 0
PDF Office/CustomControl/TextBoxEx.cs

@@ -125,5 +125,19 @@ namespace PDF_Office.CustomControl
         // Using a DependencyProperty as the backing store for TipText.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TipTextProperty =
             DependencyProperty.Register("TipText", typeof(string), typeof(TextBoxEx), new PropertyMetadata(""));
+
+
+
+        public bool ShowClose
+        {
+            get { return (bool)GetValue(ShowCloseProperty); }
+            set { SetValue(ShowCloseProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for ShowClose.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty ShowCloseProperty =
+            DependencyProperty.Register("ShowClose", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
+
+
     }
 }

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

@@ -44,6 +44,16 @@ namespace PDF_Office.Model
         /// </summary>
         public static string PageList = "PageList";
 
+        /// <summary>
+        /// 页面总数
+        /// </summary>
+        public static string PageCount = "PageCount";
+
+        /// <summary>
+        /// 当前页
+        /// </summary>
+        public static string CurrentPageIndex = "CurrentPageIndex";
+
         /// <summary>
         /// 书签
         /// </summary>

+ 7 - 8
PDF Office/PDF Office.csproj

@@ -260,6 +260,9 @@
     <Compile Include="CustomControl\PageTurningPreview.xaml.cs">
       <DependentUpon>PageTurningPreview.xaml</DependentUpon>
     </Compile>
+    <Compile Include="CustomControl\PaginationControl.xaml.cs">
+      <DependentUpon>PaginationControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="CustomControl\PathButton.cs" />
     <Compile Include="CustomControl\PathRadioButton.cs" />
     <Compile Include="CustomControl\SystemControl\CustomCommandAction .cs" />
@@ -439,7 +442,6 @@
     <Compile Include="ViewModels\EditTools\HeaderFooter\HeaderFooterDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\HeaderFooter\HeaderFooterTemplateListContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionContentViewModel.cs" />
-    <Compile Include="ViewModels\EditTools\Redaction\RedactionDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\Form\ButtonPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\CheckBoxPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\ComboxPropertyViewModel.cs" />
@@ -774,9 +776,6 @@
     <Compile Include="Views\EditTools\Redaction\RedactionContent.xaml.cs">
       <DependentUpon>RedactionContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\EditTools\Redaction\RedactionDocumentContent.xaml.cs">
-      <DependentUpon>RedactionDocumentContent.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Views\EditTools\Bates\BatesContent.xaml.cs">
       <DependentUpon>BatesContent.xaml</DependentUpon>
     </Compile>
@@ -1070,6 +1069,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="CustomControl\PaginationControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="CustomControl\TextBoxWithTip.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1458,10 +1461,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\EditTools\Redaction\RedactionDocumentContent.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Views\FillAndSign\FillAndSignContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 11 - 0
PDF Office/Properties/Settings.Designer.cs

@@ -191,5 +191,16 @@ namespace PDF_Office.Properties {
                 this["SignatureList"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.RedactionSettings RedactionsSettings {
+            get {
+                return ((global::PDFSettings.RedactionSettings)(this["RedactionsSettings"]));
+            }
+            set {
+                this["RedactionsSettings"] = value;
+            }
+        }
     }
 }

+ 3 - 0
PDF Office/Properties/Settings.settings

@@ -47,5 +47,8 @@
     <Setting Name="SignatureList" Type="PDFSettings.SignatureList" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="RedactionsSettings" Type="PDFSettings.RedactionSettings" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

+ 4 - 0
PDF Office/Themes/Generic.xaml

@@ -130,6 +130,10 @@
                             <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
                             <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
                         </Trigger>
+                        <Trigger Property="ShowClose" Value="False">
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_ContentHost" Property="Margin" Value="4,5" />
+                        </Trigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Text" Value="" />

+ 194 - 21
PDF Office/ViewModels/EditTools/Redaction/RedactionContentViewModel.cs

@@ -1,8 +1,13 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl;
 using PDF_Office.EventAggregators;
 using PDF_Office.Model;
+using PDF_Office.Properties;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -28,6 +33,8 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         private ViewContentViewModel viewContentViewModel;
 
+        private RedactionAnnotArgs redactionArgs = new RedactionAnnotArgs();
+
         public string RedactionDocumentRegionName { get; set; }
         public string RedactionBottomBarRegionName { get; set; }
 
@@ -43,6 +50,38 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         public DelegateCommand PageRedactionCommand { get; set; }
 
+        private int currentPage = 0;
+
+        /// <summary>
+        /// 是否因为本身传递值  防止循环调用
+        /// </summary>
+        private bool isFromSelf = false;
+
+        public int CurrentPage
+        {
+            get { return currentPage; }
+            set
+            {
+                SetProperty(ref currentPage, value);
+                if(value>=1&&value<=PDFViewer.Document.PageCount&&!isFromSelf)
+                {
+                    PDFViewer.GoToPage(value-1);
+                }
+            }
+        }
+
+        private int pageCount = 0;
+
+        public int PageCount
+        {
+            get { return pageCount; }
+            set
+            {
+                SetProperty(ref pageCount, value);
+            }
+        }
+
+
         public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,IDialogService dialogService)
         {
             this.redactionRegion = regionManager;
@@ -82,18 +121,140 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         private void pageMark()
         {
-            dialogs.ShowDialog(DialogNames.PageMarkDialog);
+            DialogParameters valuePairs = new DialogParameters();
+            valuePairs.Add(ParameterNames.PageCount,PDFViewer.Document.PageCount);
+            valuePairs.Add(ParameterNames.CurrentPageIndex,PDFViewer.CurrentIndex);
+            dialogs.ShowDialog(DialogNames.PageMarkDialog,valuePairs,e=> { 
+                if(e.Result == ButtonResult.OK)
+                {
+                    var pagelist = e.Parameters.GetValue<List<int>>(ParameterNames.PageList);
+                    addMarkToPages(pagelist);
+                }
+            });
         }
 
+        private void addMarkToPages(List<int> list)
+        {
+            foreach (var page in list)
+            {
+
+                //根据页面大小,创建标记密文注释
+                CPDFPage docPage = PDFViewer.Document.PageAtIndex(page);
+
+                CPDFRedactAnnotation redactionAnnot = docPage.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_REDACT) as CPDFRedactAnnotation;
+                if (redactionAnnot == null)
+                {
+                    //TODO 操作失败
+                    return;
+                }
+
+                redactionAnnot.SetQuardRects(new List<CRect>() { new CRect(0, (float)docPage.PageSize.Height, (float)docPage.PageSize.Width,0)});
+
+                if (redactionArgs == null)
+                    return;
+
+                byte[] lineColor = { redactionArgs.LineColor.R, redactionArgs.LineColor.G, redactionArgs.LineColor.B };
+                redactionAnnot.SetOutlineColor(lineColor);
+
+                if (redactionArgs.BgColor != Colors.Transparent)
+                {
+                    byte[] bgColor = { redactionArgs.BgColor.R, redactionArgs.BgColor.G, redactionArgs.BgColor.B };
+                    redactionAnnot.SetFillColor(bgColor);
+                }
+                else
+                {
+                    // redactionAnnot.ClearBgColor();
+                }
+
+                CTextAttribute textAttr = new CTextAttribute();
+                byte[] fontColor = { redactionArgs.FontColor.R, redactionArgs.FontColor.G, redactionArgs.FontColor.B };
+                textAttr.FontColor = fontColor;
+                textAttr.FontSize = (float)redactionArgs.FontSize;
+                redactionAnnot.SetTextAttribute(textAttr);
+                switch (redactionArgs.Align)
+                {
+                    case TextAlignment.Left:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
+                        break;
+                    case TextAlignment.Center:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_CENTER);
+                        break;
+                    case TextAlignment.Right:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT);
+                        break;
+                    default:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
+                        break;
+                }
+
+                //byte transparency = (byte)Math.Round(redactionArgs.Transparency * 255);
+                //redactionAnnot.SetTransparency(transparency);
+                redactionAnnot.SetBorderWidth(1);
+                //redactionAnnot.SetRect(new CRect(Left, Bottom, Right, Top));
+
+                //redactionAnnot.SetCreationDate(Helpers.GetCurrentPdfTime());
+                if (string.IsNullOrEmpty(Settings.Default.AppProperties.Description.Author))
+                {
+                    redactionAnnot.SetAuthor(Settings.Default.AppProperties.Description.Author);
+                }
+
+                if (redactionArgs.Content != null && redactionArgs.Content != string.Empty)
+                {
+                    redactionAnnot.SetOverlayText(redactionArgs.Content);
+                }
+
+                if (redactionAnnot.GetIsLocked() != redactionArgs.Locked)
+                {
+                    redactionAnnot.SetIsLocked(redactionArgs.Locked);
+                }
+
+                redactionAnnot.UpdateAp();
+                redactionAnnot.ReleaseAnnot();
+            }
+        }
+
+
 
         public void CloseEditTool()
         {
-            PDFViewer.SetMouseMode(MouseModes.Default);
-            redactionRegion.Regions[RegionNames.ViwerRegionName].Remove(PDFViewer);
-            redactionRegion.Regions[RedactionDocumentRegionName].Remove(PDFViewer);
-            this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel });
+            bool isClose = true;
+            if (CheckHasRedactionAnnote())
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("", "There are unapplied redactions in this file. Exit will not save redaction.", "Cancel", "Exit");
+                if (alertsMessage.result != ContentResult.Ok)
+                {
+                    isClose = false;
+                }
+            }
+
+            if(isClose)
+            {
+                PDFViewer.SetMouseMode(MouseModes.Default);
+                redactionRegion.Regions[RegionNames.ViwerRegionName].Remove(PDFViewer);
+                redactionRegion.Regions[RedactionDocumentRegionName].Remove(PDFViewer);
+                this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel });
+            }
         }
 
+        /// <summary>
+        /// 检查是否有未应用的标记密文
+        /// </summary>
+        private bool CheckHasRedactionAnnote()
+        {
+            for (int i = 0; i < PDFViewer.Document.PageCount; i++)
+            {
+                var items = PDFViewer.GetAnnotCommentList(i, PDFViewer.Document);
+                for (int j = 0; j < items.Count; j++)
+                {
+                    if (items[j].EventType == AnnotArgsType.AnnotRedaction)
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
         #region Navigation
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -109,27 +270,28 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            PDFViewer.InfoChanged += PDFViewer_InfoChanged;
+            CurrentPage = PDFViewer.CurrentIndex + 1;
+            PageCount = PDFViewer.Document.PageCount;
             if (!redactionRegion.Regions[RedactionDocumentRegionName].Views.Contains(PDFViewer))
             {
-                RedactionAnnotArgs redactionArgs = new RedactionAnnotArgs();
+                redactionArgs = new RedactionAnnotArgs();
                 AnnotHandlerEventArgs annotArgs = null;
-                redactionArgs.LineColor = ((SolidColorBrush)Brushes.Black).Color;
-                redactionArgs.BgColor = ((SolidColorBrush)Brushes.Black).Color;
-                redactionArgs.FontColor = ((SolidColorBrush)Brushes.Red).Color;
-                //redactionArgs.LineColor = Settings.Default.RedactionsSettings.LineColor;
-                //redactionArgs.BgColor = Settings.Default.RedactionsSettings.BgColor;
-                //redactionArgs.FontColor = Settings.Default.RedactionsSettings.FontColor;
-                //redactionArgs.Align = Settings.Default.RedactionsSettings.Align;
-                //redactionArgs.FontSize = Settings.Default.RedactionsSettings.FontSize;
-                //redactionArgs.Content = Settings.Default.RedactionsSettings.Content;
-                //if (!Settings.Default.RedactionsSettings.isUseText)
-                //{
-                //    redactionArgs.Content = "";
-                //}
+                redactionArgs.LineColor = Settings.Default.RedactionsSettings.LineColor;
+                redactionArgs.BgColor = Settings.Default.RedactionsSettings.BgColor;
+                redactionArgs.FontColor = Settings.Default.RedactionsSettings.FontColor;
+                redactionArgs.Align = Settings.Default.RedactionsSettings.Align;
+                redactionArgs.FontSize = Settings.Default.RedactionsSettings.FontSize;
+                redactionArgs.Content = Settings.Default.RedactionsSettings.Content;
+                if (!Settings.Default.RedactionsSettings.isUseText)
+                {
+                    redactionArgs.Content = "";
+                }
                 annotArgs = redactionArgs;
                 if (annotArgs != null)
                 {
-                    //annotArgs.Author = Settings.Default.AppProperties.Description.Author;
+                    //设置注释作者
+                    annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
                 }
@@ -137,6 +299,17 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
             }
   
         }
+
+        private void PDFViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
+        {
+            isFromSelf = true;
+           if(e.Key=="PageNum")
+            {
+                var data = e.Value as RenderData;
+                CurrentPage = data.PageIndex;
+            }
+            isFromSelf = false;
+        }
         #endregion
     }
 }

+ 0 - 90
PDF Office/ViewModels/EditTools/Redaction/RedactionDocumentContentViewModel.cs

@@ -1,90 +0,0 @@
-using ComPDFKit.PDFDocument;
-using ComPDFKitViewer;
-using ComPDFKitViewer.PdfViewer;
-using PDF_Office.Helper;
-using PDF_Office.Model;
-using PDF_Office.Model.EditTools.Background;
-using Prism.Mvvm;
-using Prism.Regions;
-using System;
-using System.Collections.Generic;
-using System.Drawing.Printing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media.Imaging;
-
-namespace PDF_Office.ViewModels.EditTools.Redaction
-{
-    public class RedactionDocumentContentViewModel : BindableBase, INavigationAware
-    {
-        private CPDFViewer pdfViewer;
-        public IRegionManager regionManager;
-        public CPDFViewer PDFViewer;
-        public CPDFDocument Document;
-
-        public string ViewerRegionName { get; set; }
-
-        private int _currentPageIndex;
-        public int CurrentPageIndex
-        {
-            get { return _currentPageIndex; }
-            set
-            {
-                SetProperty(ref _currentPageIndex, PDFViewer.CurrentIndex);
-            }
-        }
-
-        private int _pageSize;
-        public int PageRangeNumber
-        {
-            get { return _pageSize; }
-            set { SetProperty(ref _pageSize, value); }
-        }
-
-        public RedactionDocumentContentViewModel(IRegionManager regionManager)
-        {
-            this.regionManager = regionManager;
-            PageRangeNumber = PDFViewer.Document.PageCount;
-            ViewerRegionName = RegionNames.BackgroundViewerRegionName;
-        }
-
-        private void CurrentViewer_CustomDrawHandler(object sender, CustomDrawData e)
-        {
-        }
-
-        private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
-        {
-        }
-
-        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);
-            if (pdfViewer != null)
-            {
-                if (!regionManager.Regions[ViewerRegionName].Views.Contains(PDFViewer))
-                {
-                    PDFViewer = new CPDFViewer();
-                    PDFViewer.InitDocument(pdfViewer.Document);
-                    Document = PDFViewer.Document;
-                    PDFViewer.CustomDrawHandler += CurrentViewer_CustomDrawHandler;
-                    PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-                    regionManager.AddToRegion(ViewerRegionName, PDFViewer);
-                    PDFViewer.SetAnnotInteraction(!PDFViewer.GetAnnotInteraction());
-                    PDFViewer.Load();
-                    PDFViewer.ChangeViewMode(ViewMode.SingleContinuous);
-                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                }
-            }
-        }
-    }
-}

+ 22 - 3
PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml

@@ -7,8 +7,10 @@
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.Redaction"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:redaction="clr-namespace:PDF_Office.ViewModels.Dialog.Redaction"
     Width="432"
     Height="296"
+    d:DataContext="{d:DesignInstance Type=redaction:PageMarkDialogViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
@@ -20,29 +22,39 @@
             <RadioButton
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Current"
                 Content="Mark current page"
                 IsChecked="True" />
             <RadioButton
                 Height="22"
                 Margin="0,8"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="All"
                 Content="Mark all page" />
             <RadioButton
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Odd"
                 Content="Mark odd page" />
             <RadioButton
                 Height="22"
                 Margin="0,8"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Even"
                 Content="Mark even page" />
             <RadioButton
                 Name="RbtnCustomPage"
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Custom"
                 Content="Mark specific page range" />
             <StackPanel
-                Margin="0,8"
+                Margin="0,6,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Center"
                 Orientation="Horizontal">
@@ -51,11 +63,16 @@
                     Height="32"
                     CornerRadius="4"
                     IsEnabled="{Binding ElementName=RbtnCustomPage, Path=IsChecked}"
-                    PlaceholderText="e.g. 1,3-5,10" />
+                    PlaceholderText="e.g. 1,3-5,10"
+                    PreviewKeyDown="TextBoxEx_PreviewKeyDown"
+                    Text="{Binding CustomPage, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
                 <TextBlock
+                    Name="TBPageCount"
                     Margin="8,0,0,0"
                     VerticalAlignment="Center"
-                    Text="/" />
+                    FocusVisualStyle="{x:Null}"
+                    Focusable="True"
+                    Text="{Binding PageCount}" />
             </StackPanel>
         </StackPanel>
         <cus:DialogContent.BottmBar>
@@ -67,12 +84,14 @@
                     <Button
                         Width="80"
                         Height="32"
+                        Command="{Binding OkCommand}"
                         Content="Apply"
                         Style="{StaticResource Btn.cta}" />
                     <Button
                         Width="80"
                         Height="32"
                         Margin="16,0,0,0"
+                        Command="{Binding CancelCommand}"
                         Content="Cancel"
                         Style="{StaticResource btn.sec}" />
                 </StackPanel>

+ 8 - 0
PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml.cs

@@ -24,5 +24,13 @@ namespace PDF_Office.Views.Dialog.Redaction
         {
             InitializeComponent();
         }
+
+        private void TextBoxEx_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if(e.Key == Key.Enter)
+            {
+                TBPageCount.Focus();
+            }
+        }
     }
 }

+ 9 - 2
PDF Office/Views/EditTools/Redaction/RedactionContent.xaml

@@ -2,6 +2,7 @@
     x:Class="PDF_Office.Views.EditTools.Redaction.RedactionContent"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
@@ -79,15 +80,15 @@
                     Height="24"
                     Margin="8,0"
                     Padding="8,0"
-                    Content="应用密文"
                     Command="{Binding ApplyCommmand}"
+                    Content="应用密文"
                     Style="{StaticResource Btn.cta}" />
                 <Button
                     Height="24"
                     Margin="8,0"
                     Padding="8,0"
-                    Content="擦除密文"
                     Command="{Binding RemoveCommand}"
+                    Content="擦除密文"
                     Style="{StaticResource Btn.cta}" />
                 <Button
                     Width="auto"
@@ -103,6 +104,12 @@
             <Grid>
                 <ContentControl prism:RegionManager.RegionName="{Binding RedactionDocumentRegionName}" />
             </Grid>
+            <cus:PaginationControl
+                Margin="24,24"
+                HorizontalAlignment="Left"
+                VerticalAlignment="Bottom"
+                CurrentPage="{Binding CurrentPage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                PageCount="{Binding PageCount}" />
         </Grid>
     </Grid>
 </UserControl>

+ 0 - 21
PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml

@@ -1,21 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.EditTools.Redaction.RedactionDocumentContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/" xmlns:redaction="clr-namespace:PDF_Office.ViewModels.EditTools.Redaction" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             prism:ViewModelLocator.AutoWireViewModel="True">
-    <Grid Height="720" Width="1280">
-        <Border CornerRadius="4" Background="#323232"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="41,0,0,25" Height="53" Width="93"  Panel.ZIndex="1" >
-            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
-                <TextBlock Text="{Binding CurrentPageIndex, Mode=TwoWay}" Foreground="White" FontSize="20"></TextBlock>
-                <TextBlock Text="/" Foreground="White" FontSize="20"></TextBlock>
-                <TextBlock  Text="{Binding PageRangeNumber, Mode=TwoWay}" FontSize="20"  Foreground="White"></TextBlock>
-            </StackPanel>
-        </Border>
-        <Grid Height="676" Width="1220" VerticalAlignment="Bottom" HorizontalAlignment="Right"> 
-            <ContentControl
-                x:Name="PDFViewerContent"
-                HorizontalAlignment="Stretch"
-                prism:RegionManager.RegionName="{Binding ViewerRegionName}" />
-        </Grid>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml.cs

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

+ 3 - 1
PDF Office/Views/ViewContent.xaml

@@ -278,7 +278,9 @@
             <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
                 Grid.Column="1"
-                Width="0"
+                Width="3"
+                Background="Transparent"
+                Cursor="SizeWE"
                 FocusVisualStyle="{x:Null}"
                 ResizeBehavior="PreviousAndNext"
                 ShowsPreview="True" />