Browse Source

阅读视图 多选 esc 退出 布局优化

OYXH\oyxh 1 year ago
parent
commit
7ee8a36441

+ 23 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -17,6 +17,7 @@ using PDF_Master.Properties;
 using PDF_Master.ViewModels.BOTA;
 using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
 using PDF_Master.ViewModels.Tools.AnnotManager;
+using PDF_Master.Views;
 using PDF_Master.Views.BOTA;
 using PDF_Master.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
@@ -784,13 +785,33 @@ namespace PDF_Master.ViewModels.Tools
                         }
                         else
                         {
+                            BottomToolContent bottomTool = null;
+                            BottomToolContentViewModel bottomToolVM = viewContentViewModel.GetBottomToolContentVM(ref bottomTool);
                             if (isDifferentAnnotTyle)
                             {
-                                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                                ShowPropertyPanel(false);
+                                if (bottomToolVM != null)
+                                {
+                                    if (bottomToolVM.IsShowViewModular == false)
+                                    {
+                                        //viewContentViewModel.IsReadModeShow = false;
+                                        viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                                        ShowPropertyPanel(false);
+                                    }
+                                }
+                                else
+                                {
+                                    //viewContentViewModel.IsReadModeShow = false;
+                                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                                    ShowPropertyPanel(false);
+                                }
                             }
                             else
                             {
+                                viewContentViewModel.IsReadModeShow = false;
+                                if (bottomToolVM != null)
+                                {
+                                    bottomToolVM.IsShowViewModular = false;
+                                }
                                 GetSelectedAnnots(e);
                                 if (string.IsNullOrEmpty(StrAnnotToolChecked) == true)
                                 {

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

@@ -17,6 +17,7 @@ using PDF_Master.ViewModels.BOTA;
 using PDF_Master.ViewModels.PropertyPanel;
 using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
 using PDF_Master.ViewModels.Tools.AnnotManager;
+using PDF_Master.Views;
 using PDF_Master.Views.BOTA;
 using PDF_Master.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
@@ -2069,7 +2070,24 @@ namespace PDF_Master.ViewModels.Tools
                                     //{
                                     //    ExitAnnotationTool(false);
                                     //}
-                                    ExitAnnotationTool(false);
+                                    BottomToolContent bottomTool = null;
+                                    BottomToolContentViewModel bottomToolVM = viewContentViewModel.GetBottomToolContentVM(ref bottomTool);
+                                    if (bottomToolVM != null)
+                                    {
+                                        if (bottomToolVM.IsShowViewModular)
+                                        {
+                                            ExitAnnotationTool(false);
+                                        }
+                                        else
+                                        {
+                                            ExitAnnotationTool();
+                                        }
+                                    }
+                                    else
+                                    {
+                                        ExitAnnotationTool();
+                                    }
+
                                     break;
                             }
                         }

+ 42 - 19
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -48,6 +48,8 @@ using PDFSettings;
 using PDF_Master.Views;
 using System.Windows.Documents;
 using ComPDFKit.PDFPage;
+using ComPDFKitViewer;
+using SplitMode = PDF_Master.EventAggregators.SplitMode;
 
 namespace PDF_Master.ViewModels
 {
@@ -709,10 +711,12 @@ namespace PDF_Master.ViewModels
         private bool isCreateLink = false;
         internal bool IsRightMenuSelectedTextAddLink = false;
         internal bool IsSelectedTextAddLink = false;
+
         /// <summary>
         /// 上下左右滑动的距离
         /// </summary>
         private double scrolloffset = 50;
+
         public string LinkAnnotTipText
         {
             get { return linkAnnotTipText; }
@@ -724,6 +728,7 @@ namespace PDF_Master.ViewModels
 
         private bool botaState = false;
         private bool propertyOpenState = false;
+
         #endregion 属性、变量
 
         #region 命令
@@ -2095,7 +2100,7 @@ namespace PDF_Master.ViewModels
             botaState = OpenBOTA;
             propertyOpenState = IsPropertyOpen;
 
-            //5.6注释  
+            //5.6注释
             //已调整左右侧边栏层级,暂时注释掉,修复展开BOTA,进入阅读模式再退出后,BOTA保持展开,但没有选中的问题
             //留意测试阶段是否会有问题,如果没问题,在上线前删除
 
@@ -2187,28 +2192,32 @@ namespace PDF_Master.ViewModels
                 }
             }
             ///退出阅读模式 显示视图面板
-            //IsPropertyOpen = true;
-            //if (region.Regions.ContainsRegionWithName(PropertyRegionName))
-            //{
-            //    NavigationParameters param = new NavigationParameters();
-            //    param.Add(ParameterNames.PDFViewer, PDFViewer);
-            //    param.Add(ParameterNames.BottomToolContentViewModel, this);
-            //    region.RequestNavigate(RegionNames.PropertyRegionName, "ViewModularContent", param);
-            //}
-            if (region.Regions.ContainsRegionWithName(BottomToolRegionName))
+            BottomToolContent bottomTool = null;
+            BottomToolContentViewModel bottomToolVM = GetBottomToolContentVM(ref bottomTool);
+            if (bottomToolVM != null)
             {
-                var views = region.Regions[BottomToolRegionName].Views;
-                var isHasView = views.FindFirst(q => q is BottomToolContent);
-                if (isHasView is BottomToolContent bottomToolContent)
+                bottomToolVM.IsShowViewModular = propertyOpenState;
+                IsPropertyOpen = propertyOpenState;
+                if (bottomToolVM.IsShowViewModular && bottomTool != null)
                 {
-                    BottomToolContentViewModel toolContentViewModel = bottomToolContent.DataContext as BottomToolContentViewModel;
-                    toolContentViewModel.IsShowViewModular = propertyOpenState;
-                    IsPropertyOpen = propertyOpenState;
+                    bottomToolVM.ShowViewModularCommand.Execute(true);
                 }
+                
             }
+            //if (region.Regions.ContainsRegionWithName(BottomToolRegionName))
+            //{
+            //    var views = region.Regions[BottomToolRegionName].Views;
+            //    var isHasView = views.FindFirst(q => q is BottomToolContent);
+            //    if (isHasView is BottomToolContent bottomToolContent)
+            //    {
+            //        BottomToolContentViewModel toolContentViewModel = bottomToolContent.DataContext as BottomToolContentViewModel;
+            //        toolContentViewModel.IsShowViewModular = propertyOpenState;
+            //        IsPropertyOpen = propertyOpenState;
+            //    }
+            //}
 
             IsLoading = Visibility.Collapsed;
-            //5.6注释  
+            //5.6注释
             //已调整左右侧边栏层级,暂时注释掉,修复展开BOTA,进入阅读模式再退出后,BOTA保持展开,但没有选中的问题
             //留意测试阶段是否会有问题,如果没问题,在上线前删除
             //5.15
@@ -2228,6 +2237,22 @@ namespace PDF_Master.ViewModels
             TipVisible = Visibility.Collapsed;
         }
 
+        public BottomToolContentViewModel GetBottomToolContentVM(ref BottomToolContent bottomTool)
+        {
+            BottomToolContentViewModel viewModel = null;
+            if (region.Regions.ContainsRegionWithName(BottomToolRegionName))
+            {
+                var views = region.Regions[BottomToolRegionName].Views;
+                var isHasView = views.FindFirst(q => q is BottomToolContent);
+                if (isHasView is BottomToolContent bottomToolContent)
+                {
+                    bottomTool = bottomToolContent;
+                    viewModel = bottomToolContent.DataContext as BottomToolContentViewModel;
+                }
+            }
+            return viewModel;
+        }
+
         /// <summary>
         /// 高级功能前弹出比较表
         /// </summary>
@@ -2686,8 +2711,6 @@ namespace PDF_Master.ViewModels
                         string tempPath = PDFViewer.Document.FilePath + ".temp.pdf";
                         if (PDFViewer.Document.Descrypt(tempPath))
                         {
-
-
                             PDFViewer.CloseDocument();
                             PDFViewer.InitDocument(tempPath);
                             PDFViewer.Document.Encrypt(openPassword, permissionsPassword, cPDFPermissionsInfo);