Sfoglia il codice sorgente

其他-补充合并导致的遗漏代码

ZhouJieSheng 2 anni fa
parent
commit
e8c812c61c

+ 32 - 14
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -59,10 +59,21 @@ namespace PDF_Office.ViewModels
         /// </summary>
         public string BottomToolRegionName { get; set; }
 
+        private bool _isInPageEdit = false;
         /// <summary>
         /// 是否处于页面编辑模式,用于执行undo redo 的具体操作
         /// </summary>
-        public bool isInPageEdit = false;
+        public bool isInPageEdit
+        {
+            get { return _isInPageEdit; }
+            set { _isInPageEdit = value;
+                if (!value)
+                {
+                    CanRedo = PDFViewer.UndoManager.CanRedo;
+                    CanUndo = PDFViewer.UndoManager.CanUndo;
+                }
+                }
+        }
 
         public Action PageEditUndo { get; set; }
 
@@ -393,6 +404,9 @@ namespace PDF_Office.ViewModels
 
             eventAggregator.GetEvent<EnterSelectedEditToolEvent>().Subscribe(EnterEditTools);
             eventAggregator.GetEvent<CloseEditToolEvent>().Subscribe(CloseEditTool);
+
+            //TODO:根据缓存 选择用户上次选择的菜单
+            EnterSelectedBar("TabItemAnnotation");
         }
 
         private void MenuEnterReadModeEvent(object obj)
@@ -431,22 +445,21 @@ namespace PDF_Office.ViewModels
             ConverterBarContentVisible = Visibility.Collapsed;
             switch (currentBar)
             {
+                case "TabItemAnnotation":
+                case "TabItemScan":
                 case "TabItemTool":
+                case "TabItemForm":
+                case "TabItemEdit":
                     ToolsBarContentVisible = Visibility.Visible;
                     break;
                 case "TabItemConvert":
                     ConverterBarContentVisible = Visibility.Visible;
                     break;
                 case "TabItemPageEdit":
-                    ToolContentVisible = Visibility.Visible;
-                    break;
                 case "WatermarkContent":
-                    ToolContentVisible = Visibility.Visible;
-                    break;
                 case "BackgroundContent":
                     ToolContentVisible = Visibility.Visible;
                     break;
-
                 default:
                     break;
             }
@@ -454,17 +467,22 @@ namespace PDF_Office.ViewModels
 
         private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
-            if (e.PropertyName == "CanSave")
+            if (!isInPageEdit)
             {
-                CanSave = PDFViewer.UndoManager.CanSave;
-            }
-            if (e.PropertyName == "CanUndo")
-            {
-                CanUndo = PDFViewer.UndoManager.CanUndo;
+                //不处于页面编辑模式下时,根据PDFVIewer的undo redo状态来更新按钮状态
+                //页面编辑模式下,按钮状态根据页面编辑的undo redo来显示
+                if (e.PropertyName == "CanUndo")
+                {
+                    CanUndo = PDFViewer.UndoManager.CanUndo;
+                }
+                if (e.PropertyName == "CanRedo")
+                {
+                    CanRedo = PDFViewer.UndoManager.CanRedo;
+                }
             }
-            if (e.PropertyName == "CanRedo")
+            if (e.PropertyName == "CanSave")
             {
-                CanRedo = PDFViewer.UndoManager.CanRedo;
+                CanSave = PDFViewer.UndoManager.CanSave;
             }
         }
 

+ 8 - 1
PDF Office/Views/BOTA/BOTAContent.xaml

@@ -4,6 +4,7 @@
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:convert="clr-namespace:PDF_Office.DataConvert"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
     xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
@@ -68,7 +69,7 @@
             Style="{StaticResource TabControlWithUnderLineStyle}"
             TabStripPlacement="Left">
             <!--  建立一个空的标头占位  -->
-            <TabItem Height="0" />
+            <TabItem Height="0" BorderThickness="0" />
             <TabItem
                 Name="TabItemThumbnail"
                 Width="48"
@@ -111,6 +112,12 @@
                 Height="48"
                 Header="签名"
                 Visibility="{Binding ElementName=MenuSign, Path=IsChecked, Converter={StaticResource BoolToVisibleConvert}, Mode=TwoWay}" />
+            <i:Interaction.Triggers>
+                <i:EventTrigger EventName="SelectionChanged">
+                    <i:InvokeCommandAction Command="{Binding TabControlSelectionChangedCommand}" PassEventArgsToCommand="True" />
+                </i:EventTrigger>
+            </i:Interaction.Triggers>
         </TabControl>
+        <ContentControl Grid.Column="1" prism:RegionManager.RegionName="{Binding BOTAContentRegionName}" />
     </Grid>
 </UserControl>