Prechádzať zdrojové kódy

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

OYXH\oyxh 2 rokov pred
rodič
commit
b6aeb660a3

BIN
PDF Office/ComPDFKit.Viewer.dll


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

@@ -86,6 +86,11 @@ namespace PDF_Office.Model.Dialog.HomePageToolsDialogs.HomePagePrinter
         /// </summary>
         /// </summary>
         public bool needRerendering = true;
         public bool needRerendering = true;
 
 
+        /// <summary>
+        /// 解决一直获取纸张信息引发卡顿的问题
+        /// </summary>
+        public bool IsPaperSizeChanged = false;
+
         public PrintSettingsInfo()
         public PrintSettingsInfo()
         {
         {
             PrintDocument.DefaultPageSettings.Landscape = false;
             PrintDocument.DefaultPageSettings.Landscape = false;

+ 4 - 13
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -66,6 +66,8 @@ namespace PDF_Office.ViewModels.BOTA
 
 
         private CPDFViewer PDFViewer;
         private CPDFViewer PDFViewer;
 
 
+        private ViewContentViewModel viewContentViewModel;
+
         private string CurrentSearchText = "";
         private string CurrentSearchText = "";
 
 
         private ObservableCollection<string> myVar;
         private ObservableCollection<string> myVar;
@@ -79,13 +81,6 @@ namespace PDF_Office.ViewModels.BOTA
             }
             }
         }
         }
 
 
-
-        /// <summary>
-        /// 历史记录数组
-        /// </summary>
-        List<string> HistorySearchText = new List<string>();
-        const int MaxHistoryCount = 10;
-
         private bool caseInsensitive = true;
         private bool caseInsensitive = true;
 
 
         public bool CaseInsensitive
         public bool CaseInsensitive
@@ -182,11 +177,6 @@ namespace PDF_Office.ViewModels.BOTA
                 textSearch.SearchText(Text, C_Search_Options.Search_Case_Sensitive);
                 textSearch.SearchText(Text, C_Search_Options.Search_Case_Sensitive);
             }
             }
             CurrentSearchText = Text;
             CurrentSearchText = Text;
-            if (HistorySearchText.Count >= MaxHistoryCount)
-            {
-                HistorySearchText.RemoveAt(0);
-            }
-            HistorySearchText.Add(CurrentSearchText);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -275,7 +265,7 @@ namespace PDF_Office.ViewModels.BOTA
         private void clean()
         private void clean()
         {
         {
             SearchItemList.Clear();
             SearchItemList.Clear();
-            HistorySearchText.Clear();
+            viewContentViewModel.OpenBOTA = false;
         }
         }
 
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -295,6 +285,7 @@ namespace PDF_Office.ViewModels.BOTA
             {
             {
                 textSearch.TextSearchDocument = PDFViewer.Document;
                 textSearch.TextSearchDocument = PDFViewer.Document;
             }
             }
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
         }
         }
     }
     }
 }
 }

+ 4 - 27
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDialogViewModel.cs

@@ -393,14 +393,13 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         /// </summary>
         /// </summary>
         public void SetPaper()
         public void SetPaper()
         {
         {
-            if (true)
-            {
                 PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
                 PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
                 pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
                 pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
                 pageSetupDialog.Document.DefaultPageSettings.Margins = new Margins((int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Left * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Right * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Top * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Bottom * 2.54));
                 pageSetupDialog.Document.DefaultPageSettings.Margins = new Margins((int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Left * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Right * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Top * 2.54), (int)(PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins.Bottom * 2.54));
 
 
                 if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                 {
+                    PrintSettingsInfo.IsPaperSizeChanged= true;
                     PrintSettingsInfo.PrintDocument.DefaultPageSettings = pageSetupDialog.PageSettings;
                     PrintSettingsInfo.PrintDocument.DefaultPageSettings = pageSetupDialog.PageSettings;
 
 
                     if (!PrintSettingsInfo.PrintDocument.DefaultPageSettings.Landscape)
                     if (!PrintSettingsInfo.PrintDocument.DefaultPageSettings.Landscape)
@@ -412,30 +411,8 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                         PrintOrientationIndex = 1;
                         PrintOrientationIndex = 1;
                     }
                     }
                     this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
                     this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
-                }
-            }
-            else
-            {
-                printQueue = localDefaultPrintServer.GetPrintQueue(PrinterName);
-                LoadPrinterSettings();
-                DialogParameters value = new DialogParameters();
-                value.Add("Unicode", Unicode);
-                value.Add(ParameterNames.PrintQueue, printQueue);
-                printDialogs.ShowDialog(DialogNames.HomePagePrinterPaperSettingsDialog, value, e =>
-                {
-                    if (e.Result == ButtonResult.OK)
-                    {
-                        PrintSettingsInfo.PageMediaSize = e.Parameters.GetValue<PageMediaSize>("PageMediaSize");
-                        PrintSettingsInfo.Margin.Clear();
-                        PrintSettingsInfo.Margin.Add(e.Parameters.GetValue<int>("MarginLeft"));
-                        PrintSettingsInfo.Margin.Add(e.Parameters.GetValue<int>("MarginTop"));
-                        PrintSettingsInfo.Margin.Add(e.Parameters.GetValue<int>("MarginRight"));
-                        PrintSettingsInfo.Margin.Add(e.Parameters.GetValue<int>("MarginBottom"));
-                        this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
-                    }
-                });
+                    PrintSettingsInfo.IsPaperSizeChanged= false;
             }
             }
-
         }
         }
 
 
         public void ChangePrintMod(object e)
         public void ChangePrintMod(object e)
@@ -716,7 +693,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
             if (printModInfoWithUnicode.printModInfo.EnumPrintMod == currentHomePagePrinterMod)
             if (printModInfoWithUnicode.printModInfo.EnumPrintMod == currentHomePagePrinterMod)
             {
             {
                 PrintSettingsInfo.PrintModInfo = printModInfoWithUnicode.printModInfo;
                 PrintSettingsInfo.PrintModInfo = printModInfoWithUnicode.printModInfo;
-                this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
+               this.printEvent.GetEvent<SendPrintSettingsInfoEvent>().Publish(new PrintSettingsInfoWithUnicode { printSettingsInfo = this.PrintSettingsInfo, Unicode = this.Unicode });
             }
             }
         }
         }
 
 
@@ -741,7 +718,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add(ParameterNames.PDFViewer, PDFViewer);
             param.Add(ParameterNames.PrintSettingsInfo, PrintSettingsInfo);
             param.Add(ParameterNames.PrintSettingsInfo, PrintSettingsInfo);
             param.Add("Unicode", Unicode);
             param.Add("Unicode", Unicode);
-            printRegion.RequestNavigate(HomePagePrinterDocumentRegionName, HomePagePrinterDocumentName, param);
+           printRegion.RequestNavigate(HomePagePrinterDocumentRegionName, HomePagePrinterDocumentName, param);
             PageSetupDialog pageSetupDialog = new PageSetupDialog();
             PageSetupDialog pageSetupDialog = new PageSetupDialog();
             PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
             PrintSettingsInfo.PrintDocument.PrinterSettings.PrinterName = PrinterName;
             pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;
             pageSetupDialog.Document = PrintSettingsInfo.PrintDocument;

+ 12 - 5
PDF Office/ViewModels/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterDocumentContentViewModel.cs

@@ -104,6 +104,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
             public Rectangle DocumentBounds = new Rectangle();
             public Rectangle DocumentBounds = new Rectangle();
             public bool DocumentLandscape = false;
             public bool DocumentLandscape = false;
             public bool DocumentColor = false;
             public bool DocumentColor = false;
+            public bool IsSettingsChanged = true;
         }
         }
 
 
         public DocumentSettingsInfo documentSettingsInfo = new DocumentSettingsInfo();
         public DocumentSettingsInfo documentSettingsInfo = new DocumentSettingsInfo();
@@ -1671,10 +1672,17 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
         {
             if (PDFViewer != null && printSettingsInfoWIthUnicode.printSettingsInfo != null)
             if (PDFViewer != null && printSettingsInfoWIthUnicode.printSettingsInfo != null)
             {
             {
-                documentSettingsInfo.DocumentWidth = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width;
-                documentSettingsInfo.DocumentHeight = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height;
-                documentSettingsInfo.margins = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins;
-                documentSettingsInfo.DocumentBounds = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Bounds;
+                if (PrintSettingsInfo.IsPaperSizeChanged)
+                {
+                    documentSettingsInfo.IsSettingsChanged = true;
+                }
+                if (!documentSettingsInfo.IsSettingsChanged)
+                {
+                    documentSettingsInfo.DocumentWidth = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Width;
+                    documentSettingsInfo.DocumentHeight = PrintSettingsInfo.PrintDocument.DefaultPageSettings.PaperSize.Height;
+                    documentSettingsInfo.margins = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Margins;
+                    documentSettingsInfo.DocumentBounds = PrintSettingsInfo.PrintDocument.DefaultPageSettings.Bounds;
+                }
                 CaculatePrintedPageCount();
                 CaculatePrintedPageCount();
                 SetPaperCollection();
                 SetPaperCollection();
                 if (PrintedPageCount != PreviousPrintedPageCount)
                 if (PrintedPageCount != PreviousPrintedPageCount)
@@ -1683,7 +1691,6 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
                     PreviousPrintedPageCount = PrintedPageCount;
                     PreviousPrintedPageCount = PrintedPageCount;
                 }
                 }
                 PaintPageByCurrentPreviewIndex(TargetPaperIndex);
                 PaintPageByCurrentPreviewIndex(TargetPaperIndex);
-
             }
             }
         }
         }
 
 

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

@@ -344,7 +344,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
 
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
         {
-            DefaultLabel = "(Column, Row) -Page -xxx.pdf - yyyy/mm/dd hh-mm-ss";
+            DefaultLabel = "(Column, Row) -Page -xxx.pdf - yyyy/MM/dd hh-mm-ss";
             navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             navigationContext.Parameters.TryGetValue<string>("Unicode", out Unicode);
             SendPosterInfo();
             SendPosterInfo();
         }
         }

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

@@ -110,7 +110,7 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
         {
         {
             if (SizeInfo != null)
             if (SizeInfo != null)
             {
             {
-                this.eventAggregator.GetEvent<SendPrintSettingsModInfoEvent>().Publish(new PrintModInfoWithUnicode { printModInfo = SizeInfo, Unicode = this.Unicode});
+               this.eventAggregator.GetEvent<SendPrintSettingsModInfoEvent>().Publish(new PrintModInfoWithUnicode { printModInfo = SizeInfo, Unicode = this.Unicode});
             }
             }
         }
         }
 
 

+ 169 - 2
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -34,6 +34,10 @@ using Prism.Events;
 using System.Windows.Input;
 using System.Windows.Input;
 using ContextMenu = System.Windows.Controls.ContextMenu;
 using ContextMenu = System.Windows.Controls.ContextMenu;
 using MenuItem = System.Windows.Controls.MenuItem;
 using MenuItem = System.Windows.Controls.MenuItem;
+using System.Drawing;
+using Color = System.Windows.Media.Color;
+using Brush = System.Windows.Media.Brush;
+using FontFamily = System.Windows.Media.FontFamily;
 
 
 namespace PDF_Office.ViewModels.FillAndSign
 namespace PDF_Office.ViewModels.FillAndSign
 {
 {
@@ -654,8 +658,8 @@ namespace PDF_Office.ViewModels.FillAndSign
                             }
                             }
                         }
                         }
                         else
                         else
-                        {
-                          
+                        {
+                           e.PopupMenu = ViewerContextMenu();
                             if (e.PopupMenu != null)
                             if (e.PopupMenu != null)
                             {
                             {
                                 e.Handle = true;
                                 e.Handle = true;
@@ -666,6 +670,166 @@ namespace PDF_Office.ViewModels.FillAndSign
                     break;
                     break;
             }
             }
         }
         }
+        private ContextMenu ViewerContextMenu()
+        {
+            ContextMenu contextMenu = App.Current.FindResource("ViewerContextMenu") as ContextMenu;
+           
+            ViewerContextMenu_Loaded(contextMenu, null);
+            return contextMenu;
+        }
+
+        private void ViewerContextMenu_Loaded(object sender, RoutedEventArgs e,Visibility visibility =Visibility.Collapsed)
+        {
+            ContextMenu contextMenu = sender as ContextMenu;
+            if (contextMenu.Items.Count > 0)
+            {
+                int index = PDFViewer.CurrentIndex;
+                //检测是否已存在相同数据
+                CPDFBookmark list = PDFViewer.Document.GetBookmarkList().FirstOrDefault(q => q.PageIndex == index);
+                foreach (var item in contextMenu.Items)
+                {
+                    if (item is Separator separator) { 
+                    
+                    separator.Visibility = visibility;
+                    }
+                    if (item is MenuItem menuItem1)
+                    {
+                        //if (menuItem1.Tag.ToString() == "DisplayAnnot" || menuItem1.Tag.ToString() == "HiddenAnnot")
+                        //{
+                        //    SetMenuItemVisibility(menuItem1, "DisplayAnnot", "HiddenAnnot", isHiddenAnnot);
+                        //}
+                        
+                        switch (menuItem1.Tag.ToString())
+                        {
+                            case "Copy":
+                                //粘贴
+                                //if (!ApplicationCommands.Paste.CanExecute(null, (UIElement)sender))
+                                //{
+                                //    menuItem1.IsEnabled = false;
+                                //    menuItem1.Opacity = 0.5;
+                                //}
+                                //else
+                                //{
+                                //    menuItem1.IsEnabled = true;
+                                //    menuItem1.Opacity = 1;
+                                //}
+                                menuItem1.CommandTarget = (UIElement)PDFViewer;
+                                menuItem1.Command = ApplicationCommands.Paste;
+                                break;
+
+                            case "AddAnnotation":
+                                menuItem1.Visibility = visibility;
+                             
+                                break;
+
+                            case "HiddenAnnot":
+                                menuItem1.Visibility = visibility;
+                       
+                                break;
+
+                            case "DisplayAnnot":
+                                menuItem1.Visibility = visibility;
+                    
+                                break;
+
+                            case "AddBookMark":
+                                menuItem1.Visibility = visibility;
+                     
+                                break;
+
+                            case "DelBookMark":
+                                menuItem1.Visibility = visibility;
+             
+                                break;
+
+                            case "ToolMode":
+                                menuItem1.Visibility = visibility;
+                    
+                                break;
+
+                            case "ReadModel":
+                                menuItem1.Visibility = visibility;
+                   
+                                break;
+
+                            case "UnReadModel":
+                                menuItem1.Visibility = visibility;
+                  
+                                break;
+
+                            case "ViewZoom":
+                                menuItem1.Visibility = visibility;
+              
+                                break;
+
+                            case "PageDisplay":
+                                menuItem1.Visibility = visibility;
+              
+                                break;
+
+                            case "Select":
+                                menuItem1.Click -= Select_Click;
+
+                                menuItem1.Click += Select_Click;
+                                break;
+
+                            case "Print":
+                                menuItem1.Command = viewContentViewModel.PrintCommand;
+                                break;
+                        }
+                    }
+                }
+            }
+        }
+        private void Select_Click(object sender, RoutedEventArgs e)
+        {
+            if (viewContentViewModel.OpenBOTA == false)
+            {
+                viewContentViewModel.OpenBOTA = true;
+            }
+            bool isBook = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemSearch");
+            if (isBook == false)
+            {
+                bOTAContent.TabItemSearch.IsSelected = true;
+            }
+        }
+        public IRegionManager region;
+        private bool IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, string tabItemText)
+        {
+            bool isTabItem = false;
+            bOTAContentViewModel = null;
+            bOTAContent = null;
+            if (region.Regions.ContainsRegionWithName(viewContentViewModel.BOTARegionName))
+            {
+                var views = region.Regions[viewContentViewModel.BOTARegionName].Views;
+                var model = views.FirstOrDefault(q => q is BOTAContent);
+                if (model is BOTAContent bOTAContent1)
+                {
+                    bOTAContent = bOTAContent1;
+                    bOTAContentViewModel = bOTAContent.DataContext as BOTAContentViewModel;
+                    if (bOTAContentViewModel.CurrentBar == tabItemText)
+                    {
+                        isTabItem = true;
+                    }
+                }
+                //foreach (var item in views)
+                //{
+                //    if (item is BOTAContent bOTAContent1)
+                //    {
+                //        bOTAContent = bOTAContent1;
+                //        bOTAContentViewModel = bOTAContent.DataContext as BOTAContentViewModel;
+                //        if (bOTAContentViewModel.CurrentBar == tabItemText)
+                //        {
+                //            isTabItem = true;
+
+                //            break;
+                //        }
+                //    }
+                //}
+            }
+            return isTabItem;
+        }
+
         private bool isHightAnnot(AnnotHandlerEventArgs annot)
         private bool isHightAnnot(AnnotHandlerEventArgs annot)
         {
         {
             if (annot.EventType == AnnotArgsType.AnnotUnderline ||
             if (annot.EventType == AnnotArgsType.AnnotUnderline ||
@@ -909,6 +1073,9 @@ namespace PDF_Office.ViewModels.FillAndSign
         public void OnNavigatedFrom(NavigationContext navigationContext)
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
         {
             UnBindingPDFViewerHandler();
             UnBindingPDFViewerHandler();
+            ContextMenu contextMenu = App.Current.FindResource("ViewerContextMenu") as ContextMenu;
+
+            ViewerContextMenu_Loaded(contextMenu, null,Visibility.Visible);
             viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
             viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
         }
         }
 
 

+ 9 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs

@@ -163,6 +163,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public DelegateCommand ShowDialogCommand { get; set; }
         public DelegateCommand ShowDialogCommand { get; set; }
 
 
         private CPDFViewer PDFViewer;
         private CPDFViewer PDFViewer;
+
+        private ViewContentViewModel viewContentViewModel;
         public ObservableCollection<Stamp> StandardStampList { get; set; }
         public ObservableCollection<Stamp> StandardStampList { get; set; }
         public ObservableCollection<Stamp> DynamicStampList { get; set; }
         public ObservableCollection<Stamp> DynamicStampList { get; set; }
         public ObservableCollection<Stamp> CustomStampList { get; set; }
         public ObservableCollection<Stamp> CustomStampList { get; set; }
@@ -242,6 +244,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             {
             {
                 return;
                 return;
             }
             }
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+        }
+
+        public void Close()
+        {
+            PDFViewer.SetMouseMode(MouseModes.PanTool);
+            viewContentViewModel.IsPropertyOpen = false;
         }
         }
 
 
         public void SetDynamicStamp(Stamp stamp)
         public void SetDynamicStamp(Stamp stamp)

+ 25 - 6
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -1180,13 +1180,32 @@ namespace PDF_Office.ViewModels
                         permissionsPassword = SecurityInfo.PermissionsPassword;
                         permissionsPassword = SecurityInfo.PermissionsPassword;
                         cPDFPermissionsInfo = SecurityInfo.CPDFPermissionsInfo;
                         cPDFPermissionsInfo = SecurityInfo.CPDFPermissionsInfo;
                     }
                     }
-                    PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
-                    AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("", "文件安全设置已修改,需要另存为", "Cancel", "OK");
-                    if (alertsMessage.result == ContentResult.Ok)
-                        return saveAsFile();
+                    if (false)
+                    {
+                        //PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
+                        AlertsMessage alertsMessage = new AlertsMessage();
+                        alertsMessage.ShowDialog("", "文件安全设置已修改,需要另存为", "Cancel", "OK");
+                        if (alertsMessage.result == ContentResult.Ok)
+                            return saveAsFile();
+                        else
+                            return false;
+                    }
                     else
                     else
-                        return false;
+                    {
+                        string currentPath = PDFViewer.Document.FilePath;
+                        string tempPath = PDFViewer.Document.FilePath+".temp.pdf";
+                        PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
+                        PDFViewer.Document.WriteToFilePath(tempPath);
+                        PDFViewer.InitDocument(tempPath);
+                        //PDFViewer.Document.UnlockWithPassword(permissionsPassword);
+                        //PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);
+                        PDFViewer.Document.WriteToFilePath(currentPath);
+                        System.IO.File.Delete(tempPath);
+                        PDFViewer.CloseDocument();
+                        PDFViewer.InitDocument(currentPath);
+                        PDFViewer.Document.UnlockWithPassword(permissionsPassword);
+                    }
+             
                 }
                 }
 
 
                 bool result = PDFViewer.Document.WriteToLoadedPath();
                 bool result = PDFViewer.Document.WriteToLoadedPath();

+ 1 - 1
PDF Office/Views/BOTA/OutLineControl.xaml

@@ -73,7 +73,7 @@
                     <customcontrol:PathButton.ContextMenu>
                     <customcontrol:PathButton.ContextMenu>
                         <ContextMenu Name="MenuMore">
                         <ContextMenu Name="MenuMore">
                             <ContextMenu.ItemContainerStyle>
                             <ContextMenu.ItemContainerStyle>
-                                <Style TargetType="MenuItem">
+                                <Style TargetType="MenuItem" BasedOn="{StaticResource GlobalMenuItem}">
                                     <Setter Property="Padding" Value="-25,7,-40,7" />
                                     <Setter Property="Padding" Value="-25,7,-40,7" />
                                     <Setter Property="VerticalContentAlignment" Value="Center" />
                                     <Setter Property="VerticalContentAlignment" Value="Center" />
                                 </Style>
                                 </Style>

+ 3 - 1
PDF Office/Views/BOTA/SearchContent.xaml

@@ -13,6 +13,8 @@
              xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
              xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              mc:Ignorable="d" 
              mc:Ignorable="d" 
+             Loaded="UserControl_Loaded"
+             KeyDown="UserControl_KeyDown"
              d:DesignHeight="450" d:DesignWidth="800">
              d:DesignHeight="450" d:DesignWidth="800">
 
 
     <UserControl.Resources>
     <UserControl.Resources>
@@ -343,7 +345,7 @@
                 <ListView.GroupStyle>
                 <ListView.GroupStyle>
                     <GroupStyle >
                     <GroupStyle >
                         <GroupStyle.HeaderTemplate>
                         <GroupStyle.HeaderTemplate>
-                            <DataTemplate >
+                            <DataTemplate>
                                 <Border Background="{StaticResource color.sys.layout.fg.light}" Height="32" Padding="16,5,5,5" VerticalAlignment="Center" >
                                 <Border Background="{StaticResource color.sys.layout.fg.light}" Height="32" Padding="16,5,5,5" VerticalAlignment="Center" >
                                     <Grid VerticalAlignment="Center">
                                     <Grid VerticalAlignment="Center">
                                     <TextBlock VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Left"  FontSize="14" Text="{Binding Name}"
                                     <TextBlock VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Left"  FontSize="14" Text="{Binding Name}"

+ 14 - 0
PDF Office/Views/BOTA/SearchContent.xaml.cs

@@ -154,5 +154,19 @@ namespace PDF_Office.Views.BOTA
             HistorySearchText.Clear();
             HistorySearchText.Clear();
             UpDataItem();
             UpDataItem();
         }
         }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            SearchText.Focus();
+        }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Escape)
+            {
+                SearchResultList.SelectedIndex = -1;
+            }
+            e.Handled = true;
+        }
     }
     }
 }
 }

+ 14 - 4
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePictureToPDFDialog.xaml

@@ -101,10 +101,20 @@
                   DragLeave="MainPage_DragLeave"
                   DragLeave="MainPage_DragLeave"
                   >
                   >
                 <!--<Label Name="DropGrid" Background="#18A0FB" Opacity="0.5" Panel.ZIndex="1" Visibility="Collapsed"/>-->
                 <!--<Label Name="DropGrid" Background="#18A0FB" Opacity="0.5" Panel.ZIndex="1" Visibility="Collapsed"/>-->
-                <Button Name="BtnBlank"  Background="Green" Height="480" Width="632" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}">
-                </Button>
+                <Grid Visibility="{Binding AddFileVisibility}"  Height="480" Width="632">
+                    <Button Name="BtnBlank" Background="White" Height="180" Width="418" Visibility="{Binding AddFileVisibility}" Command="{Binding ADDPictureCommand}" BorderBrush="#FFFFFF">
+                        <StackPanel>
+                            <Grid Width="128" Height="128">
+                                <Path Data="M19.5 43.7691C19.5 42.7996 20.286 42.0137 21.2555 42.0137H40.478C40.8527 42.0137 41.2176 42.1336 41.5193 42.3559L50.4493 48.9359C51.2666 49.5381 52.2551 49.8629 53.2702 49.8629H93.2372C94.2067 49.8629 94.9927 50.6489 94.9927 51.6184V95.5671C94.9927 96.5366 94.2067 97.3225 93.2372 97.3225H21.2555C20.286 97.3225 19.5 96.5366 19.5 95.5671V43.7691Z" Stroke="#CED0D4" StrokeThickness="3"/>
+                                <Path Data="M27 41.3125V37.2555C27 35.4575 28.4575 34 30.2555 34H49.478C50.1729 34 50.8496 34.2224 51.4091 34.6346L60.3391 41.2146C60.8986 41.6269 61.5753 41.8493 62.2702 41.8493H100.237C102.035 41.8493 103.493 43.3068 103.493 45.1047V91C103.493 94.3137 100.806 97 97.4927 97H91.6811" Stroke="#CED0D4" StrokeThickness="3"/>
+                            </Grid>
+                            <TextBlock Margin="0,8,0,0" HorizontalAlignment="Center" Text="No Files"  FontSize="14" Style="{StaticResource PropertyHeaderLv2}"></TextBlock>
+                            <TextBlock Margin="0,2,0,0" Width="418" Height="20" Text="Click the button below to select the file." TextAlignment="Center" Style="{StaticResource PropertyHeaderLv2}" FontSize="12" TextBlock.Foreground="{StaticResource color.sys.text.neutral.lv3}"></TextBlock>
+                        </StackPanel>
+                    </Button>
+                </Grid>
                 <ListView x:Name="listView"  DataContext="{Binding ImagesDataTable}"   Background="White"   ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" BorderThickness="1,0,1,1" Visibility="{Binding ElementName=BtnBlank, Path=Visibility, Converter={StaticResource unVisibleConvert}}">
                 <ListView x:Name="listView"  DataContext="{Binding ImagesDataTable}"   Background="White"   ItemsSource="{Binding}" SelectionChanged="listView_SelectionChanged" BorderThickness="1,0,1,1" Visibility="{Binding ElementName=BtnBlank, Path=Visibility, Converter={StaticResource unVisibleConvert}}">
-                    
+
                     <ListView.ContextMenu>
                     <ListView.ContextMenu>
                         <ContextMenu  StaysOpen="True"  >
                         <ContextMenu  StaysOpen="True"  >
                             <MenuItem Header="打开文件" Name="OpenFileMenuItem"  Click="OpenFileMenuItem_Click" />
                             <MenuItem Header="打开文件" Name="OpenFileMenuItem"  Click="OpenFileMenuItem_Click" />
@@ -115,7 +125,7 @@
                         <GridView  ColumnHeaderContainerStyle="{StaticResource HeadStyle}">
                         <GridView  ColumnHeaderContainerStyle="{StaticResource HeadStyle}">
                             <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}">
                             <GridViewColumn  Header="文档名"  Width="400" DisplayMemberBinding="{Binding FileName}">
                             </GridViewColumn>
                             </GridViewColumn>
-                                <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
+                            <GridViewColumn Header="大小" Width="100" DisplayMemberBinding="{Binding FileSize}"/>
                             <GridViewColumn Header="状态" Width="82" >
                             <GridViewColumn Header="状态" Width="82" >
                                 <GridViewColumn.CellTemplate>
                                 <GridViewColumn.CellTemplate>
                                     <DataTemplate>
                                     <DataTemplate>

+ 18 - 10
PDF Office/Views/Dialog/ToolsDialogs/MergeDialog.xaml

@@ -91,9 +91,14 @@
 
 
         <Border Grid.Column="1" Grid.Row="1"  Grid.RowSpan="2" Padding="50,6,50,6" Visibility="{Binding Visibility, Converter={StaticResource UnVisivleConvert}, ElementName=NoFileStackPanel}">
         <Border Grid.Column="1" Grid.Row="1"  Grid.RowSpan="2" Padding="50,6,50,6" Visibility="{Binding Visibility, Converter={StaticResource UnVisivleConvert}, ElementName=NoFileStackPanel}">
             <Grid>
             <Grid>
-                <TextBlock Text="File Name" HorizontalAlignment="Left" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
-                <TextBlock Text="Page Range" HorizontalAlignment="Center" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
-                <TextBlock Text="Size" HorizontalAlignment="Right" FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="201"/>
+                    <ColumnDefinition Width="160"/>
+                    <ColumnDefinition Width="*"/>
+                </Grid.ColumnDefinitions>
+                <TextBlock Text="File Name"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <TextBlock Grid.Column="1"  Text="Page Range"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
+                <TextBlock Grid.Column="2" Text="Size" HorizontalAlignment="Center"  FontFamily="Segoe UI" FontSize="12" FontWeight="Bold" Foreground="{StaticResource color.sys.text.neutral.lv1}"/>
             </Grid>
             </Grid>
         </Border>
         </Border>
         <Border Grid.Column="1" Grid.Row="3">
         <Border Grid.Column="1" Grid.Row="3">
@@ -133,11 +138,14 @@
                                         <Grid.ColumnDefinitions>
                                         <Grid.ColumnDefinitions>
                                             <ColumnDefinition Width="40"/>
                                             <ColumnDefinition Width="40"/>
                                             <ColumnDefinition Width="60"/>
                                             <ColumnDefinition Width="60"/>
-                                            <ColumnDefinition Width="141"/>
+                                            <ColumnDefinition Width="8"/>
+                                            <ColumnDefinition Width="133"/>
                                             <ColumnDefinition Width="auto"/>
                                             <ColumnDefinition Width="auto"/>
-                                            <ColumnDefinition Width="*"/>
-                                            <ColumnDefinition Width="16"/>
                                             <ColumnDefinition Width="16"/>
                                             <ColumnDefinition Width="16"/>
+                                            <ColumnDefinition Width="56"/>
+                                            <ColumnDefinition Width="17"/>
+                                            <ColumnDefinition Width="*"/>
+                                            <ColumnDefinition Width="17"/>
                                         </Grid.ColumnDefinitions>
                                         </Grid.ColumnDefinitions>
                                         <Line   Margin="0,0,0,0" Grid.ColumnSpan="6" Visibility="{Binding IsForward, Converter={StaticResource BoolToVisible}}" X1="0"  X2="{Binding ActualWidth, ElementName=ContentPanel}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="{StaticResource color.sys.layout.accent}" />
                                         <Line   Margin="0,0,0,0" Grid.ColumnSpan="6" Visibility="{Binding IsForward, Converter={StaticResource BoolToVisible}}" X1="0"  X2="{Binding ActualWidth, ElementName=ContentPanel}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="{StaticResource color.sys.layout.accent}" />
 
 
@@ -146,15 +154,15 @@
                                         <TextBlock Text="{Binding Converter={StaticResource IndexConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
                                         <TextBlock Text="{Binding Converter={StaticResource IndexConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"
                                  VerticalAlignment="Center"  HorizontalAlignment="Center"/>
                                  VerticalAlignment="Center"  HorizontalAlignment="Center"/>
                                         <Image Margin="8" Grid.Column="1"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Source="{Binding DocThumbnail}"  Stretch="Uniform"  />
                                         <Image Margin="8" Grid.Column="1"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Source="{Binding DocThumbnail}"  Stretch="Uniform"  />
-                                        <StackPanel Grid.Column="2" Margin="16,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center">
+                                        <StackPanel Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center">
                                             <TextBlock Text="{Binding DocName}" FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv1}"  TextTrimming="CharacterEllipsis"/>
                                             <TextBlock Text="{Binding DocName}" FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv1}"  TextTrimming="CharacterEllipsis"/>
                                             <TextBlock Text="{Binding DocPageCount}"  FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv3}"/>
                                             <TextBlock Text="{Binding DocPageCount}"  FontFamily="Segoe UI" FontSize="14" FontWeight="Regular" Foreground="{StaticResource color.sys.text.neutral.lv3}"/>
                                         </StackPanel>
                                         </StackPanel>
-                                        <StackPanel Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="16,0,0,0">
+                                        <StackPanel Grid.Column="4" HorizontalAlignment="Stretch" VerticalAlignment="Center">
                                             <customcontrol:WritableComboBox SelectedIndex="0" Width="150" Height="30" MaxPageRange="{Binding SDKPageCount}" Text="{Binding SetPageRange, Mode=TwoWay}"/>
                                             <customcontrol:WritableComboBox SelectedIndex="0" Width="150" Height="30" MaxPageRange="{Binding SDKPageCount}" Text="{Binding SetPageRange, Mode=TwoWay}"/>
                                         </StackPanel>
                                         </StackPanel>
-                                        <TextBlock Grid.Column="4" Text="{Binding DocSize}"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="16,0,0,0"/>
-                                        <StackPanel Grid.Column="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,0">
+                                        <TextBlock Grid.Column="6" Text="{Binding DocSize}"  HorizontalAlignment="Center" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
+                                        <StackPanel Grid.Column="8" VerticalAlignment="Center" HorizontalAlignment="Stretch">
 
 
                                             <customcontrol:PathButton
                                             <customcontrol:PathButton
             Visibility="Collapsed"
             Visibility="Collapsed"

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml


+ 9 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml.cs

@@ -83,5 +83,14 @@ namespace PDF_Office.Views.PropertyPanel.AnnotPanel
             MenuItem item = sender as MenuItem;
             MenuItem item = sender as MenuItem;
             (DataContext as StampAnnotPropertyViewModel).EditorCustomStamp(item.DataContext as Stamp);
             (DataContext as StampAnnotPropertyViewModel).EditorCustomStamp(item.DataContext as Stamp);
         }
         }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Escape)
+            {
+                (DataContext as StampAnnotPropertyViewModel).Close();
+            }
+            e.Handled = true;
+        }
     }
     }
 }
 }