Browse Source

UI-调整阅读页层级结构,左右侧边栏不推动中间视图区域

ZhouJieSheng 1 year ago
parent
commit
72ca420c22

+ 10 - 6
PDF Office/ViewModels/HomePanel/RecentFiles/RecentFilesContentViewModel.cs

@@ -187,13 +187,17 @@ namespace PDF_Master.ViewModels.HomePanel.RecentFiles
         /// </summary>
         public void UpdateItemSoucre()
         {
-            var item = RecentFilesGroup[0];
-            var compageitem = Settings.Default.RecentOpenFiles[0];
-            //因为新增文件都会排序到第一个,因此只需要比较集合数量和第一个对象是否一致即可判断两个集合是否一致
-            //如果不一致则更新数据源
-            if (item!=compageitem||RecentFilesGroup.Count!= Settings.Default.RecentOpenFiles.Count)
+            //补充判空处理,避免清空最近文件列表后,切换多页签会报异常
+            if (RecentFilesGroup.Count > 0)
             {
-                InitVariables();
+                var item = RecentFilesGroup[0];
+                var compageitem = Settings.Default.RecentOpenFiles[0];
+                //因为新增文件都会排序到第一个,因此只需要比较集合数量和第一个对象是否一致即可判断两个集合是否一致
+                //如果不一致则更新数据源
+                if (item != compageitem || RecentFilesGroup.Count != Settings.Default.RecentOpenFiles.Count)
+                {
+                    InitVariables();
+                }
             }
         }
 

+ 9 - 3
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -2088,8 +2088,11 @@ namespace PDF_Master.ViewModels
 
             #endregion 旧版本
 
-            botaState = OpenBOTA;
-            OpenBOTA = false;
+            //5.6注释  
+            //已调整左右侧边栏层级,暂时注释掉,修复展开BOTA,进入阅读模式再退出后,BOTA保持展开,但没有选中的问题
+            //留意测试阶段是否会有问题,如果没问题,在上线前删除
+            //botaState = OpenBOTA;
+            //OpenBOTA = false;
             this.events.GetEvent<ReadModeEvent>().Publish(new ReadModeArgs() { Unicode = unicode, IsReadMode = true });
 
             //模拟一次用户点击 关闭属性面板
@@ -2197,7 +2200,10 @@ namespace PDF_Master.ViewModels
             }
 
             IsLoading = Visibility.Collapsed;
-            OpenBOTA = botaState;
+            //5.6注释  
+            //已调整左右侧边栏层级,暂时注释掉,修复展开BOTA,进入阅读模式再退出后,BOTA保持展开,但没有选中的问题
+            //留意测试阶段是否会有问题,如果没问题,在上线前删除
+            //OpenBOTA = botaState;
             PDFViewer.DisableClearSelectAnnot(false);
             PDFViewer.ClearSelectAnnots();
             PDFViewer.SetMouseMode(MouseModes.AnnotCreate);

+ 8 - 4
PDF Office/Views/MainWindow.xaml

@@ -11,6 +11,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
     xmlns:viewmodels="clr-namespace:PDF_Master.ViewModels"
+    Title="PDF Master"
     Width="1280"
     Height="800"
     MinWidth="540"
@@ -18,16 +19,16 @@
     d:DataContext="{d:DesignInstance Type=viewmodels:MainWindowViewModel}"
     prism:ViewModelLocator.AutoWireViewModel="True"
     Activated="Window_Activated"
-    SnapsToDevicePixels="True"
     BorderBrush="{StaticResource color.sys.layout.bg.tabbar}"
     BorderThickness="2"
     Closed="Window_Closed"
     Closing="Window_Closing"
     PreviewMouseLeftButtonDown="Window_PreviewMouseLeftButtonDown"
     SizeChanged="Window_SizeChanged"
+    SnapsToDevicePixels="True"
     Style="{StaticResource WindowStyle}"
     UseLayoutRounding="True"
-Title ="PDF Master"    WindowStartupLocation="CenterScreen"
+    WindowStartupLocation="CenterScreen"
     mc:Ignorable="d">
     <Window.Resources>
         <ResourceDictionary>
@@ -360,8 +361,8 @@ Title ="PDF Master"    WindowStartupLocation="CenterScreen"
                         <TextBlock
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
-                            FontSize="14"
                             FontFamily="SF Pro Text"
+                            FontSize="14"
                             FontWeight="SemiBold"
                             Foreground="White"
                             Text="{Binding Useremailchar}" />
@@ -437,7 +438,10 @@ Title ="PDF Master"    WindowStartupLocation="CenterScreen"
                 <Grid Margin="16,13" Background="Transparent">
                     <StackPanel Orientation="Horizontal">
                         <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding ProgressTitle}" />
-                        <TextBlock Foreground="{StaticResource color.sys.text.anti.norm}" Text="{Binding Value, StringFormat={}({0})}" />
+                        <TextBlock
+                            Foreground="{StaticResource color.sys.text.anti.norm}"
+                            Text="{Binding Value, StringFormat={}({0})}"
+                            Visibility="Collapsed" />
                     </StackPanel>
                     <Button
                         Width="12"

+ 3 - 2
PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml

@@ -15,6 +15,7 @@
     d:DesignHeight="900"
     d:DesignWidth="256"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    Background="{StaticResource color.sys.layout.mg}"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -29,8 +30,8 @@
     <UserControl.InputBindings>
         <KeyBinding Command="{Binding OpenFullCommand}" Gesture="F11" />
     </UserControl.InputBindings>
-    
-    
+
+
     <ScrollViewer VerticalScrollBarVisibility="Auto">
         <StackPanel Margin="5,0,5,0">
             <TextBlock

+ 9 - 2
PDF Office/Views/ViewContent.xaml

@@ -68,7 +68,7 @@
         <KeyBinding Command="{Binding SaveFile}" Gesture="Ctrl+S" />
         <KeyBinding Command="{Binding SaveAsFile}" Gesture="Ctrl+Shift+S" />
         <KeyBinding Command="{Binding CloseWindowCommand}" Gesture="Ctrl+Shift+W" />
-        <KeyBinding Command="{Binding PropertyCommand}" Gesture="Ctrl+I"/>
+        <KeyBinding Command="{Binding PropertyCommand}" Gesture="Ctrl+I" />
         <KeyBinding
             Key="W"
             Command="{StaticResource CloseTab}"
@@ -588,18 +588,25 @@
                 </Grid.ColumnDefinitions>
                 <ContentControl
                     x:Name="BOTAContent"
+                    Panel.ZIndex="1"
                     prism:RegionManager.RegionName="{Binding BOTARegionName}"
                     SizeChanged="ContentControl_SizeChanged" />
                 <GridSplitter
                     Name="BOTASplitter"
                     Grid.Column="1"
                     Width="3"
+                    Panel.ZIndex="1"
                     Background="Transparent"
                     Cursor="SizeWE"
                     FocusVisualStyle="{x:Null}"
                     ResizeBehavior="PreviousAndNext"
                     ShowsPreview="True" />
-                <Grid Name="GridViewer" Grid.Column="2">
+                <Grid
+                    Name="GridViewer"
+                    Grid.Column="0"
+                    Grid.ColumnSpan="4"
+                    Margin="50,0,0,0"
+                    Panel.ZIndex="0">
                     <!--  分屏功能需要的布局  -->
                     <Grid.RowDefinitions>
                         <RowDefinition Height="*" />

+ 10 - 6
PDF Office/Views/ViewContent.xaml.cs

@@ -95,9 +95,11 @@ namespace PDF_Master.Views
                 //因为ispropertyOpen 属性改成了单向控制  因此这里的语句不再适用
                 //this.TbtnProperty.IsChecked = false;
                 Grid.SetRowSpan(DocumentView, 4);
-                Grid.SetRow(DocumentView, 0);
-                Grid.SetColumnSpan(GridViewer, 4);
-                Grid.SetColumn(GridViewer, 0);
+                Grid.SetRow(DocumentView, 0);
+                //调整了阅读页层级,不需要再设置列数,和跨列数
+                //显示在BOTA上层
+                GridViewer.SetValue(Panel.ZIndexProperty,1);
+                GridViewer.Margin = new Thickness(0,0,0,0);
                 //var annotArgs = new SelectToolArgs();
                 //viewModel.PDFViewer.SetToolParam(annotArgs);
                 #region to do
@@ -116,9 +118,11 @@ namespace PDF_Master.Views
                 RectangleReadMode.IsHitTestVisible =false;
                 //this.TbtnProperty.IsChecked=true;
                 Grid.SetRowSpan(DocumentView, 1);
-                Grid.SetRow(DocumentView, 2);
-                Grid.SetColumn(GridViewer, 2);
-                Grid.SetColumnSpan(GridViewer, 1);
+                Grid.SetRow(DocumentView, 2);
+                //调整了阅读页层级,不需要再设置列数,和跨列数
+                //设置PDFView显示在BOTA的下层
+                GridViewer.SetValue(Panel.ZIndexProperty, 0);
+                GridViewer.Margin = new Thickness(50, 0, 0, 0);
                 //var annotArgs = new SelectToolArgs();
                 //viewModel.PDFViewer.SetToolParam(annotArgs);
                 #region to do