Browse Source

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

OYXH\oyxh 2 years ago
parent
commit
1129ff3739

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

@@ -74,7 +74,7 @@ namespace PDF_Office
         /// <summary>
         /// 内嵌文档路径
         /// </summary>
-        public static string GuidPDFPath = Path.Combine(Environment.CurrentDirectory, "Resources//GuidPDF//Quick Start Guide.pdf");
+        public static string GuidPDFPath = Path.Combine(Environment.CurrentDirectory, "Resources\\GuidPDF\\Quick Start Guide.pdf");
 
         /// <summary>
         /// 是否需要更新内嵌文档
@@ -105,9 +105,17 @@ namespace PDF_Office
         /// </summary>
         public static string modelFolderPath = null;
 
+        /// <summary>
+        /// 是否是软件的第一个主窗体
+        /// </summary>
         public static bool IsFirstOpen = true;
         public static bool IsBookMode = false;
 
+        /// <summary>
+        /// 是否已经登陆
+        /// </summary>
+        public static bool IsLogin = false;
+
         //是否需要显示注册弹窗
         //app第一次启动时需要弹出注册弹窗
         public static bool IsShowRegist = false;

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

@@ -34,6 +34,7 @@ using System.Collections.ObjectModel;
 using System.Windows.Forms;
 using ComboBox = System.Windows.Controls.ComboBox;
 using CheckBox = System.Windows.Controls.CheckBox;
+using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
 
 namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
 {
@@ -1006,8 +1007,33 @@ namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
-
+             
             parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+
+            VerifyPasswordResult result = SecurityHelper.VerifyPasswordForSelectedPermissions(PDFViewer.Document, Model.Dialog.ToolsDialogs.SaftyDialogs.EnumPermissionsSet.StatusAllowsPrinting, printDialogs);
+            if (result.IsDiscryptied)
+            {
+                if (result.Password!=null)
+                {
+                    string filePath = PDFViewer.Document.FilePath;
+                    PDFViewer.CloseDocument();
+                    PDFViewer.InitDocument(filePath);
+                    PDFViewer.Document.UnlockWithPassword(result.Password);
+                    PDFViewer.Load();
+                }
+
+                ///TODO:
+                ///此处填入需要执行的代码
+            }
+            if (!result.IsDiscryptied)
+            {
+                System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+                {
+                    this.RequestClose(new Prism.Services.Dialogs.DialogResult());
+                }));
+            }
+
+
             if (PDFViewer != null && PDFViewer.Document != null)
             {
                 for (int temp = 0; temp < PDFViewer.Document.PageCount; temp++)

+ 1 - 8
PDF Office/ViewModels/Dialog/ToolsDialogs/MergeDialogViewModel.cs

@@ -194,14 +194,7 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
         {
             OpenFileDialog openFile = new OpenFileDialog();
             openFile.Multiselect = true;
-            openFile.Filter = "Files(*pdf;*.bmp;*.gif;*.jpeg;*.jpg;*.png;*.tiff)|*.pdf;*.bmp;*.gif;*.jpeg;*.jpg;*.png;*.tiff|" +
-                "(*.pdf)|*.pdf|" +
-                "(*.bmp)|*.bmp|" +
-                "(*.gif)|*.gif|" +
-                "(*.jpeg)|*.jpeg|" +
-                "(*.jpg)|*.jpg|" +
-                "(*.png)|*.png|" +
-                "(*.tiff)|*.tiff";
+            openFile.Filter = Properties.Resources.imageex.ToLower()+"|*";
             if (openFile.ShowDialog() == false)
             {
                 return null;

+ 2 - 1
PDF Office/ViewModels/TipContent/FileRestrictedTipViewModel.cs

@@ -42,9 +42,10 @@ namespace PDF_Office.ViewModels.TipContent
                 if (result.Password != null)
                 {
                     string filePath = PDFViewer.Document.FilePath;
-                    PDFViewer.Document.Release();
+                    PDFViewer.CloseDocument();
                     PDFViewer.InitDocument(filePath);
                     PDFViewer.Document.UnlockWithPassword(result.Password);
+                    PDFViewer.Load();
                 }
                 ///TODO:
                 ///此处填入需要执行的代码

+ 17 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -80,6 +80,9 @@ namespace PDF_Office.ViewModels.Tools
                 PDFViewer.PDFActionHandler += PDFViewer_PDFActionHandler;
                 PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
                 PDFViewer.AnnotHoverHandler += PDFViewer_AnnotHoverHandler;
+
+                PDFViewer.PreviewMouseLeftButtonDown -= PDFViewer_PreviewMouseLeftButtonDown;
+                PDFViewer.PreviewMouseLeftButtonDown += PDFViewer_PreviewMouseLeftButtonDown;
             }
         }
 
@@ -133,6 +136,8 @@ namespace PDF_Office.ViewModels.Tools
                 PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
                 PDFViewer.PDFActionHandler -= PDFViewer_PDFActionHandler;
                 PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
+
+                PDFViewer.PreviewMouseLeftButtonDown -= PDFViewer_PreviewMouseLeftButtonDown;
             }
         }
 
@@ -140,6 +145,16 @@ namespace PDF_Office.ViewModels.Tools
 
         #region 与触发事件调用相关的函数
 
+        //鼠标左键双击注释
+        private void PDFViewer_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ClickCount == 2)
+            {
+                if (CurrentSelectedAnnot != null)
+                    PopAnnotNoteText(CurrentSelectedAnnot);
+            }
+        }
+
         //是否为形状注释
         private bool isShapAnnot(AnnotHandlerEventArgs annot)
         {
@@ -260,7 +275,7 @@ namespace PDF_Office.ViewModels.Tools
         #endregion 与触发事件调用相关的函数
 
         #region PDFViewer事件
-
+        private AnnotHandlerEventArgs CurrentSelectedAnnot = null;
         //选中和非选中注释
         private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
         {
@@ -275,6 +290,7 @@ namespace PDF_Office.ViewModels.Tools
                         if (e.IsAnnotCreateReset == false)
                         {
                             GetSelectedAnnots(e);
+                            CurrentSelectedAnnot = annot;
                         }
                         else
                         {

+ 37 - 32
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -1610,38 +1610,43 @@ namespace PDF_Office.ViewModels.Tools
             {
                 var menu = obj as CusMenuItem;
                 var annot = menu.Parameter as AnnotHandlerEventArgs;
-                if (annot != null)
-                {
-                    AnnotationHandlerEventArgs args = new AnnotationHandlerEventArgs();
-
-                    args.ClientRect = annot.ClientRect;
-                    args.AnnotHandlerEventArgs = annot;
-                    args.PageIndex = annot.PageIndex;
-                    args.AnnotIndex = annot.AnnotIndex;
-                    args.EventType = annot.EventType;
-                    args.CreateTime = annot.CreateTime;
-                    args.UpdateTime = annot.UpdateTime;
-                    args.Content = annot.Content;
-                    args.MarkupContent = annot.MarkupContent;
-                    args.Author = annot.Author;
-                    args.Locked = annot.Locked;
-                    args.ReadOnly = annot.ReadOnly;
-                    args.FormField = annot.FormField;
-                    args.Document = PDFViewer.Document;
-
-                    DialogParameters value = new DialogParameters();
-                    value.Add(ParameterNames.Annotation, args);
-                    dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
-                                          {
-                                              if (e.Result == ButtonResult.OK && e.Parameters != null)
-                                              {
-                                                  PDFViewer.UndoManager.CanSave = true;
-                                                  if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
-                                                  {
-                                                  }
-                                              }
-                                          });
-                }
+                PopAnnotNoteText(annot);
+            }
+        }
+
+        private void PopAnnotNoteText(AnnotHandlerEventArgs annot)
+        {
+            if (annot != null)
+            {
+                AnnotationHandlerEventArgs args = new AnnotationHandlerEventArgs();
+
+                args.ClientRect = annot.ClientRect;
+                args.AnnotHandlerEventArgs = annot;
+                args.PageIndex = annot.PageIndex;
+                args.AnnotIndex = annot.AnnotIndex;
+                args.EventType = annot.EventType;
+                args.CreateTime = annot.CreateTime;
+                args.UpdateTime = annot.UpdateTime;
+                args.Content = annot.Content;
+                args.MarkupContent = annot.MarkupContent;
+                args.Author = annot.Author;
+                args.Locked = annot.Locked;
+                args.ReadOnly = annot.ReadOnly;
+                args.FormField = annot.FormField;
+                args.Document = PDFViewer.Document;
+
+                DialogParameters value = new DialogParameters();
+                value.Add(ParameterNames.Annotation, args);
+                dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
+                {
+                    if (e.Result == ButtonResult.OK && e.Parameters != null)
+                    {
+                        PDFViewer.UndoManager.CanSave = true;
+                        if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
+                        {
+                        }
+                    }
+                });
             }
         }
 

+ 2 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -628,7 +628,7 @@ namespace PDF_Office.ViewModels.Tools
             if (KeyEventsHelper.IsSingleKey(Key.Escape))
             {
                 BtnHandIsChecked = true;
-                PDFViewer.SetMouseMode(MouseModes.PanTool);
+                PDFViewer.SetMouseMode(MouseModes.Scroll);
                 PDFViewer.ClearSelectAnnots();
                 StrAnnotToolChecked = "";
             }
@@ -762,6 +762,7 @@ namespace PDF_Office.ViewModels.Tools
             BindingPDFViewerHandler();
             BindingEvent();
             LoaedStickyNotePopup();
+            BtnHandIsChecked = (PDFViewer.MouseMode == MouseModes.Scroll? true:false);
         }
 
         #endregion Navigation

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

@@ -507,7 +507,11 @@ namespace PDF_Office.ViewModels
             get { return isPorpertyOpen; }
             set
             {
-                SetProperty(ref isPorpertyOpen, value);
+                //如果设置为手动展开属性面板时,则不响应代码控制的展开
+                if (Settings.Default.AppProperties.InitialVIew.AutoExpandProperty)
+                {
+                    SetProperty(ref isPorpertyOpen, value);
+                }
             }
         }
 

+ 84 - 47
PDF Office/Views/MainWindow.xaml

@@ -22,8 +22,8 @@
     BorderThickness="2"
     Closed="Window_Closed"
     Closing="Window_Closing"
-    SizeChanged="Window_SizeChanged"
     PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
+    SizeChanged="Window_SizeChanged"
     Style="{StaticResource WindowStyle}"
     UseLayoutRounding="True"
     WindowStartupLocation="CenterScreen"
@@ -233,7 +233,8 @@
             HorizontalAlignment="Right"
             Orientation="Horizontal"
             WindowChrome.IsHitTestVisibleInChrome="True">
-            <Grid Visibility="{Binding ElementName=Btn_Login,Path=Visibility}" >
+
+            <Grid Visibility="{Binding ElementName=Btn_Login, Path=Visibility}">
                 <Border VerticalAlignment="Center">
                     <Path Data="M0 4C0 1.79086 1.79086 0 4 0H132C134.209 0 136 1.79086 136 4V10.323C136 10.7319 136.249 11.0996 136.629 11.2514L141.179 13.0715C142.017 13.4068 142.017 14.5932 141.179 14.9285L136.629 16.7486C136.249 16.9004 136 17.2681 136 17.677V24C136 26.2091 134.209 28 132 28H4C1.79086 28 0 26.2091 0 24V4Z" Fill="#FFCF52" />
                 </Border>
@@ -253,21 +254,33 @@
                 Command="{Binding OpenRegisterCommand}"
                 Style="{StaticResource subToolBar}"
                 Visibility="{Binding RegisterVis, Mode=TwoWay}">
-                <Border
-                    Width="40"
-                    Height="40"
-                    Margin="-2,-2,0,0"
-                    Background="{StaticResource color.icon.base.neutral.norm.lv1}"
-                    BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
-                    BorderThickness="1"
-                    CornerRadius="100">
-                    <Path
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z"
-                        Fill="White" />
-                </Border>
+                <Grid>
+                    <Border
+                        x:Name="myBorder1"
+                        Width="24"
+                        Height="24"
+                        Background="White"
+                        CornerRadius="12" />
+                    <Border
+                        Width="24"
+                        Height="24"
+                        Background="{StaticResource color.icon.base.neutral.norm.lv1}"
+                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
+                        <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
+                        <Border.OpacityMask>
+                            <VisualBrush Visual="{Binding ElementName=myBorder1}" />
+                        </Border.OpacityMask>
+                    </Border>
+                    <Border
+                        Width="24"
+                        Height="24"
+                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
+                        BorderThickness="2"
+                        CornerRadius="100" />
+                </Grid>
+
             </Button>
+
             <Button
                 x:Name="Btn_Login"
                 Width="40"
@@ -276,22 +289,30 @@
                 Command="{Binding OpenLoginCommand}"
                 Style="{StaticResource subToolBar}"
                 Visibility="{Binding LoginVis, Mode=TwoWay}">
-                <Border
-                    Width="40"
-                    Height="40"
-                    Margin="-2,-2,0,0"
-                    HorizontalAlignment="Center"
-                    VerticalAlignment="Center"
-                    Background="{StaticResource color.icon.base.neutral.norm.lv1}"
-                    BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
-                    BorderThickness="1"
-                    CornerRadius="100">
-                    <Path
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z"
-                        Fill="White" />
-                </Border>
+                <Grid>
+                    <Border
+                        x:Name="myBorder2"
+                        Width="24"
+                        Height="24"
+                        Background="White"
+                        CornerRadius="12" />
+                    <Border
+                        Width="24"
+                        Height="24"
+                        Background="{StaticResource color.icon.base.neutral.norm.lv1}"
+                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
+                        <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
+                        <Border.OpacityMask>
+                            <VisualBrush Visual="{Binding ElementName=myBorder2}" />
+                        </Border.OpacityMask>
+                    </Border>
+                    <Border
+                        Width="24"
+                        Height="24"
+                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
+                        BorderThickness="2"
+                        CornerRadius="100" />
+                </Grid>
             </Button>
             <Button
                 x:Name="Btn_User"
@@ -301,20 +322,30 @@
                 Command="{Binding OpenUserCommand}"
                 Style="{StaticResource subToolBar}"
                 Visibility="{Binding UserVis, Mode=TwoWay}">
-                <Border
-                    Width="40"
-                    Height="40"
-                    Margin="-2,-2,0,0"
-                    Background="#1770F4"
-                    BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}"
-                    BorderThickness="1"
-                    CornerRadius="100">
-                    <Path
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z"
-                        Fill="White" />
-                </Border>
+                <Grid>
+                    <Border
+                        x:Name="myBorder3"
+                        Width="24"
+                        Height="24"
+                        Background="White"
+                        CornerRadius="12" />
+                    <Border
+                        Width="24"
+                        Height="24"
+                        Background="#1770F4"
+                        BorderBrush="{StaticResource color.icon.base.neutral.norm.lv1}">
+                        <Path Data="M12 13C14.2091 13 16 11.2091 16 9C16 6.79086 14.2091 5 12 5C9.79086 5 8 6.79086 8 9C8 11.2091 9.79086 13 12 13ZM12 31C17.5228 31 22 27.4183 22 23C22 18.5817 17.5228 15 12 15C6.47715 15 2 18.5817 2 23C2 27.4183 6.47715 31 12 31Z" Fill="White" />
+                        <Border.OpacityMask>
+                            <VisualBrush Visual="{Binding ElementName=myBorder3}" />
+                        </Border.OpacityMask>
+                    </Border>
+                    <Border
+                        Width="24"
+                        Height="24"
+                        BorderBrush="#1770F4"
+                        BorderThickness="2"
+                        CornerRadius="100" />
+                </Grid>
             </Button>
             <Separator BorderBrush="#94989C" BorderThickness="1">
                 <Separator.LayoutTransform>
@@ -377,6 +408,7 @@
             <Border
                 Width="226"
                 Height="58"
+                
                 Background="{StaticResource color.sys.layout.dark.bg}"
                 BorderThickness="0"
                 CornerRadius="{StaticResource border-radius.8}"
@@ -391,7 +423,12 @@
                         Height="12"
                         HorizontalAlignment="Right"
                         VerticalAlignment="Top"
-                        Command="{Binding CloseOCRCommand}" />
+                        BorderThickness="0"
+                    Background="{StaticResource color.sys.layout.dark.bg}"
+                        Command="{Binding CloseOCRCommand}" 
+                         Padding="0,0,1,1">
+                        <Path Data="M6.00006 7.06072L9.46973 10.5304L10.5304 9.46973L7.06072 6.00006L10.5304 2.53039L9.46973 1.46973L6.00006 4.9394L2.53039 1.46973L1.46973 2.53039L4.9394 6.00006L1.46973 9.46973L2.53039 10.5304L6.00006 7.06072Z" Fill="#CED0D4"></Path>
+                    </Button>
                     <ProgressBar
                         Height="4"
                         Margin="0,0,0,4"

+ 1 - 1
PDFSettings/APPSettingProperties.cs

@@ -150,7 +150,7 @@ namespace PDFSettings
         /// <summary>
         /// 属性面板 手动展开
         /// </summary>
-        public bool ClickOpenProperty = true;
+        public bool ClickOpenProperty = false;
 
         /// <summary>
         /// 阅读页背景色