Browse Source

视图-阅读模式优化

OYXH\oyxh 2 years ago
parent
commit
ac4bd04f65
46 changed files with 1754 additions and 242 deletions
  1. 5 3
      PDF Office/App.xaml.cs
  2. 31 0
      PDF Office/DataConvert/AnnotateFontSizeConverter.cs
  3. 38 0
      PDF Office/DataConvert/BoolToTextWrapConvert.cs
  4. 46 0
      PDF Office/DataConvert/GroupHeaderConverter.cs
  5. 27 0
      PDF Office/DataConvert/IntToBooleanConvert.cs
  6. 51 0
      PDF Office/DataConvert/StringToDateConvert.cs
  7. 16 0
      PDF Office/Model/RegionNames.cs
  8. 46 0
      PDF Office/PDF Office.csproj
  9. 11 1
      PDF Office/Properties/Settings.Designer.cs
  10. BIN
      PDF Office/Resources/BOTA/Annotation/Arrow.png
  11. BIN
      PDF Office/Resources/BOTA/Annotation/Bookmark.png
  12. BIN
      PDF Office/Resources/BOTA/Annotation/Circle.png
  13. BIN
      PDF Office/Resources/BOTA/Annotation/Freehande.png
  14. BIN
      PDF Office/Resources/BOTA/Annotation/Freehande2.png
  15. BIN
      PDF Office/Resources/BOTA/Annotation/Hand.png
  16. BIN
      PDF Office/Resources/BOTA/Annotation/Highlight.png
  17. BIN
      PDF Office/Resources/BOTA/Annotation/Hyperlink.png
  18. BIN
      PDF Office/Resources/BOTA/Annotation/Image.png
  19. BIN
      PDF Office/Resources/BOTA/Annotation/Line.png
  20. BIN
      PDF Office/Resources/BOTA/Annotation/Note.png
  21. BIN
      PDF Office/Resources/BOTA/Annotation/Point.png
  22. BIN
      PDF Office/Resources/BOTA/Annotation/Rectangle.png
  23. BIN
      PDF Office/Resources/BOTA/Annotation/Selecttool.png
  24. BIN
      PDF Office/Resources/BOTA/Annotation/Stamp.png
  25. BIN
      PDF Office/Resources/BOTA/Annotation/Textbox.png
  26. BIN
      PDF Office/Resources/BOTA/Annotation/wavyline2.png
  27. BIN
      PDF Office/Resources/BOTA/empty_annotation.png
  28. 48 0
      PDF Office/Styles/ButtonStyle.xaml
  29. 47 0
      PDF Office/Styles/ComboxStyle.xaml
  30. 26 15
      PDF Office/Styles/CustomBtnStyle.xaml
  31. 152 35
      PDF Office/Styles/ExpanderStyle.xaml
  32. 46 0
      PDF Office/Styles/ListViewStyle.xaml
  33. 43 0
      PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs
  34. 3 3
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  35. 1 0
      PDF Office/ViewModels/PropertyPanel/ViewModular/ReadModeContentViewModel.cs
  36. 217 0
      PDF Office/ViewModels/PropertyPanel/ViewModular/ReadViewContentViewModel.cs
  37. 176 66
      PDF Office/ViewModels/ViewContentViewModel.cs
  38. 248 0
      PDF Office/Views/BOTA/AnnotationContent.xaml
  39. 28 0
      PDF Office/Views/BOTA/AnnotationContent.xaml.cs
  40. 291 0
      PDF Office/Views/BOTA/AnnotationListItem.xaml
  41. 28 0
      PDF Office/Views/BOTA/AnnotationListItem.xaml.cs
  42. 53 0
      PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml
  43. 63 0
      PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml.cs
  44. 3 3
      PDF Office/Views/PropertyPanel/ViewModular/ViewModularContent.xaml.cs
  45. 4 34
      PDF Office/Views/ViewContent.xaml
  46. 6 82
      PDF Office/Views/ViewContent.xaml.cs

+ 5 - 3
PDF Office/App.xaml.cs

@@ -38,9 +38,11 @@ using PDF_Office.Views.FillAndSign.PropertyPanel;
 using PDF_Office.Views.PropertyPanel.ViewModular;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing;
 using PDF_Office.Views.Dialog.ConverterDialogs;
+
 using PDF_Office.Helper;
+
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageConverter;
-using PDF_Office.Views.EditTools.Watermark; 
+using PDF_Office.Views.EditTools.Watermark;
 using PDF_Office.Views.EditTools.Background;
 
 namespace PDF_Office
@@ -126,7 +128,8 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<SplitScreenContent>();
             containerRegistry.RegisterForNavigation<ThemesContent>();
             containerRegistry.RegisterForNavigation<ReadModeContent>();
-
+            containerRegistry.RegisterForNavigation<ReadViewContent>();
+            containerRegistry.RegisterForNavigation<AnnotationContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModSizeContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModPosterContent>();
             containerRegistry.RegisterForNavigation<HomePagePrinterModMultipleContent>();
@@ -194,7 +197,6 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<ConverterExcelDialog>(DialogNames.ConverterExcelDialog);
             containerRegistry.RegisterDialog<ConverterProgressBarDialog>(DialogNames.ConverterProgressBarDialog);
 
-
             #endregion 注册弹窗
         }
 

+ 31 - 0
PDF Office/DataConvert/AnnotateFontSizeConverter.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class AnnotateFontSizeConverter : IValueConverter
+    {
+        //用于注释列表的字体   作者和日期的日期比正文日期小两个规格
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if ((double)value <= 0)
+            {
+                return null;
+            }
+            else
+            {
+                return (double)value - 2;
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 38 - 0
PDF Office/DataConvert/BoolToTextWrapConvert.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PDF_Office.DataConvert
+{
+    public class BoolToTextWrapConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null)
+            {
+                return TextWrapping.NoWrap;
+            }
+            else
+            {
+                if ((bool)value)
+                {
+                    return TextWrapping.Wrap;
+                }
+                else
+                {
+                    return TextWrapping.NoWrap;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 46 - 0
PDF Office/DataConvert/GroupHeaderConverter.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class GroupHeaderConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null || string.IsNullOrEmpty(value.ToString())) return null;
+            if (value.ToString().Length == 8)//日期
+            {
+                string dateStr = value.ToString();
+                string text = dateStr.Substring(0, 4) + "-" + dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2);
+                return text;
+            }
+            else//页码
+            {
+                try
+                {
+                    string page = "Page ";
+                    if ((int)value == -1)
+                        return null;
+                    else
+                    {
+                        return page + ((int)value + 1).ToString();
+                    }
+                }
+                catch (Exception ex)
+                {
+                    return null;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 27 - 0
PDF Office/DataConvert/IntToBooleanConvert.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class IntToBooleanConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value is int && ((int)value) > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 51 - 0
PDF Office/DataConvert/StringToDateConvert.cs

@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    /// <summary>
+    /// 用于注释 书签等的时间转换
+    /// </summary>
+    public class StringToDateConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            string date = "";
+            if (string.IsNullOrEmpty((string)value) || !Regex.IsMatch(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
+            {
+                date = System.DateTime.Now.ToString("HH:mm");
+            }
+            else if (Regex.IsMatch(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
+            {
+                string dateStr = Regex.Match(value.ToString(), "(?<=D\\:)[0-9]+(?=[\\+\\-])").Value;
+
+                if (string.Equals(dateStr.Substring(4, 4), DateTime.Now.ToString("MMdd")))
+                {//同天
+                    date = dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
+                }
+                else if (string.Equals(dateStr.Substring(0, 4), DateTime.Now.ToString("yyyy")))
+                {//同年
+                    date = dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                   dateStr.Substring(10, 2);
+                }
+                else
+                {
+                    date = dateStr.Substring(0, 4) + "/" + dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                    dateStr.Substring(10, 2);
+                }
+            }
+            return date;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return null;
+        }
+    }
+}

+ 16 - 0
PDF Office/Model/RegionNames.cs

@@ -39,6 +39,14 @@ namespace PDF_Office.Model
             }
         }
 
+        public static string ReadRegionName
+        {
+            get
+            {
+                return GetRegionName("ReadRegionName");
+            }
+        }
+
         /// <summary>
         /// BOTA内容项 对应的Content RegionName
         /// </summary>
@@ -127,6 +135,14 @@ namespace PDF_Office.Model
             }
         }
 
+        public static string ReadModePageRegionName
+        {
+            get
+            {
+                return GetRegionName("ReadModePageRegionName");
+            }
+        }
+
         /// <summary>
         /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
         /// 如果字典里没有键值就新建一个GUID,并插入到

+ 46 - 0
PDF Office/PDF Office.csproj

@@ -217,9 +217,14 @@
     <Compile Include="CustomControl\WritableComboBox.xaml.cs">
       <DependentUpon>WritableComboBox.xaml</DependentUpon>
     </Compile>
+    <Compile Include="DataConvert\AnnotateFontSizeConverter.cs" />
+    <Compile Include="DataConvert\BoolToTextWrapConvert.cs" />
     <Compile Include="DataConvert\FileFormatToIconConvert.cs" />
+    <Compile Include="DataConvert\GroupHeaderConverter.cs" />
+    <Compile Include="DataConvert\IntToBooleanConvert.cs" />
     <Compile Include="DataConvert\ObjectConvert.cs" />
     <Compile Include="DataConvert\PropertyPanelVisible.cs" />
+    <Compile Include="DataConvert\StringToDateConvert.cs" />
     <Compile Include="DataConvert\StringToVisibleConvert.cs" />
     <Compile Include="DataConvert\UnVisivleConvert.cs" />
     <Compile Include="EventAggregators\EditToolsEvent.cs" />
@@ -289,6 +294,7 @@
       <DesignTime>True</DesignTime>
       <AutoGen>True</AutoGen>
     </Compile>
+    <Compile Include="ViewModels\BOTA\AnnotationContentViewModel.cs" />
     <Compile Include="ViewModels\BOTA\BookmarkContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\AddBookmarkDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\BookmarkInfoDialogViewModel.cs" />
@@ -315,6 +321,7 @@
     <Compile Include="ViewModels\EditTools\Background\BackgroundTemplateListBaseContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Background\BackgroundTemplateListColorContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Background\BackgroundTemplateListFileContentViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
@@ -381,6 +388,12 @@
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListBaseContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListFileContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkTemplateListTextContentViewModel.cs" />
+    <Compile Include="Views\BOTA\AnnotationContent.xaml.cs">
+      <DependentUpon>AnnotationContent.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\BOTA\AnnotationListItem.xaml.cs">
+      <DependentUpon>AnnotationListItem.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\BOTA\BookmarkContent.xaml.cs">
       <DependentUpon>BookmarkContent.xaml</DependentUpon>
     </Compile>
@@ -643,6 +656,9 @@
     <Compile Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml.cs">
       <DependentUpon>ReadModeContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\ViewModular\ReadViewContent.xaml.cs">
+      <DependentUpon>ReadViewContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModular\SplitScreenContent.xaml.cs">
       <DependentUpon>SplitScreenContent.xaml</DependentUpon>
     </Compile>
@@ -772,6 +788,14 @@
       <SubType>Designer</SubType>
       <Generator>XamlIntelliSenseFileGenerator</Generator>
     </Page>
+    <Page Include="Views\BOTA\AnnotationContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\BOTA\AnnotationListItem.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\BOTA\BookmarkContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1053,6 +1077,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\ViewModular\ReadViewContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModular\SplitScreenContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1186,6 +1214,24 @@
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     </None>
     <None Include="source\AnalysisWord\Res\word\_rels\document.xml.rels" />
+    <Resource Include="Resources\BOTA\Annotation\Arrow.png" />
+    <Resource Include="Resources\BOTA\Annotation\Bookmark.png" />
+    <Resource Include="Resources\BOTA\Annotation\Circle.png" />
+    <Resource Include="Resources\BOTA\Annotation\Freehande.png" />
+    <Resource Include="Resources\BOTA\Annotation\Freehande2.png" />
+    <Resource Include="Resources\BOTA\Annotation\Hand.png" />
+    <Resource Include="Resources\BOTA\Annotation\Highlight.png" />
+    <Resource Include="Resources\BOTA\Annotation\Hyperlink.png" />
+    <Resource Include="Resources\BOTA\Annotation\Image.png" />
+    <Resource Include="Resources\BOTA\Annotation\Line.png" />
+    <Resource Include="Resources\BOTA\Annotation\Note.png" />
+    <Resource Include="Resources\BOTA\Annotation\Point.png" />
+    <Resource Include="Resources\BOTA\Annotation\Rectangle.png" />
+    <Resource Include="Resources\BOTA\Annotation\Selecttool.png" />
+    <Resource Include="Resources\BOTA\Annotation\Stamp.png" />
+    <Resource Include="Resources\BOTA\Annotation\Textbox.png" />
+    <Resource Include="Resources\BOTA\Annotation\wavyline2.png" />
+    <Resource Include="Resources\BOTA\empty_annotation.png" />
     <Content Include="source\AnalysisWord\Res\_rels\.rels">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

+ 11 - 1
PDF Office/Properties/Settings.Designer.cs

@@ -22,7 +22,17 @@ namespace PDF_Office.Properties {
                 return defaultInstance;
             }
         }
-        
+        public double AnnotateFontSize
+        {
+            get
+            {
+                return ((double)(this["AnnotateFontSize"]));
+            }
+            set
+            {
+                this["AnnotateFontSize"] = value;
+            }
+        }
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         public global::PDFSettings.Settings.RecentOpenFiles RecentOpenFiles {

BIN
PDF Office/Resources/BOTA/Annotation/Arrow.png


BIN
PDF Office/Resources/BOTA/Annotation/Bookmark.png


BIN
PDF Office/Resources/BOTA/Annotation/Circle.png


BIN
PDF Office/Resources/BOTA/Annotation/Freehande.png


BIN
PDF Office/Resources/BOTA/Annotation/Freehande2.png


BIN
PDF Office/Resources/BOTA/Annotation/Hand.png


BIN
PDF Office/Resources/BOTA/Annotation/Highlight.png


BIN
PDF Office/Resources/BOTA/Annotation/Hyperlink.png


BIN
PDF Office/Resources/BOTA/Annotation/Image.png


BIN
PDF Office/Resources/BOTA/Annotation/Line.png


BIN
PDF Office/Resources/BOTA/Annotation/Note.png


BIN
PDF Office/Resources/BOTA/Annotation/Point.png


BIN
PDF Office/Resources/BOTA/Annotation/Rectangle.png


BIN
PDF Office/Resources/BOTA/Annotation/Selecttool.png


BIN
PDF Office/Resources/BOTA/Annotation/Stamp.png


BIN
PDF Office/Resources/BOTA/Annotation/Textbox.png


BIN
PDF Office/Resources/BOTA/Annotation/wavyline2.png


BIN
PDF Office/Resources/BOTA/empty_annotation.png


+ 48 - 0
PDF Office/Styles/ButtonStyle.xaml

@@ -184,4 +184,52 @@
             </Trigger>
         </ControlTemplate.Triggers>
     </ControlTemplate>
+
+    <SolidColorBrush x:Key="BOTA.Path.Fill" Color="#000000" />
+    <Style
+        x:Key="PageEditToolBtn"
+        BasedOn="{StaticResource TitleBarBtn}"
+        TargetType="{x:Type Button}">
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="BorderBrush" Value="Transparent" />
+        <Setter Property="Width" Value="auto" />
+        <Setter Property="Height" Value="40" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="#1A000000" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="#26000000" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" />
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+                            <Setter TargetName="border" Property="Background" Value="Transparent" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="#33000000" />
+                            <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="#FF999999" />
+                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.4" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 47 - 0
PDF Office/Styles/ComboxStyle.xaml

@@ -83,4 +83,51 @@
         <Setter Property="FontFamily" Value="Segoe UI" />
         <Setter Property="FontSize" Value="14" />
     </Style>
+
+    <Style x:Key="ContextMenuStyle" TargetType="{x:Type ContextMenu}">
+        <Setter Property="SnapsToDevicePixels" Value="True" />
+        <Setter Property="Grid.IsSharedSizeScope" Value="true" />
+        <Setter Property="HasDropShadow" Value="True" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type ContextMenu}">
+                    <Border Uid="Border_93">
+                        <Border.Style>
+                            <Style TargetType="{x:Type Border}">
+                                <Setter Property="Tag" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
+                                <Style.Triggers>
+                                    <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}}" Value="True">
+                                        <Setter Property="Effect">
+                                            <Setter.Value>
+                                                <DropShadowEffect
+                                                    BlurRadius="4"
+                                                    Opacity="0.8"
+                                                    ShadowDepth="1" />
+                                            </Setter.Value>
+                                        </Setter>
+                                    </DataTrigger>
+                                </Style.Triggers>
+                            </Style>
+                        </Border.Style>
+                        <Border
+                            Uid="Border_50"
+                            Background="{TemplateBinding Background}"
+                            BorderBrush="{TemplateBinding BorderBrush}"
+                            BorderThickness="{TemplateBinding BorderThickness}">
+                            <ScrollViewer
+                                Uid="ScrollViewer_9"
+                                CanContentScroll="True"
+                                Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
+                                                                              TypeInTargetAssembly={x:Type FrameworkElement}}}">
+                                <ItemsPresenter
+                                    Uid="ItemsPresenter_5"
+                                    KeyboardNavigation.DirectionalNavigation="Cycle"
+                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                            </ScrollViewer>
+                        </Border>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 26 - 15
PDF Office/Styles/CustomBtnStyle.xaml

@@ -388,30 +388,42 @@
 
 
     <Style x:Key="HomePageCompressBtn" TargetType="Button">
-        <Setter Property="Background" Value="White"/>
-        <Setter Property="BorderBrush" Value="White"/>
-        <Setter Property="HorizontalAlignment" Value="Center"/>
+        <Setter Property="Background" Value="White" />
+        <Setter Property="BorderBrush" Value="White" />
+        <Setter Property="HorizontalAlignment" Value="Center" />
 
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type Button}">
-                    <Border x:Name="border" BorderBrush="White" BorderThickness="1,1,1,1" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" >
-                        <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="White"
+                        BorderThickness="1,1,1,1"
+                        SnapsToDevicePixels="true">
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
-                            <Setter Property="Background" TargetName="border" Value="#1A000000"/>
-                            <Setter Property="BorderBrush" TargetName="border" Value= "AntiqueWhite"/>
+                            <Setter TargetName="border" Property="Background" Value="#1A000000" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="AntiqueWhite" />
                         </Trigger>
                         <Trigger Property="IsPressed" Value="true">
-                            <Setter Property="Background" TargetName="border" Value="#26000000"/>
-                            <Setter Property="BorderBrush" TargetName="border" Value= "WhiteSmoke"/>
+                            <Setter TargetName="border" Property="Background" Value="#26000000" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="WhiteSmoke" />
                         </Trigger>
                         <Trigger Property="IsEnabled" Value="false">
-                            <Setter Property="Background" TargetName="border" Value="White"/>
-                            <Setter Property="BorderBrush" TargetName="border" Value="White"/>
-                            <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="Black"/>
-                            <Setter Property="Opacity" TargetName="contentPresenter" Value="1"/>
+                            <Setter TargetName="border" Property="Background" Value="White" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="White" />
+                            <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="Black" />
+                            <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
@@ -419,5 +431,4 @@
         </Setter>
     </Style>
 </ResourceDictionary>
-    
-    
+

File diff suppressed because it is too large
+ 152 - 35
PDF Office/Styles/ExpanderStyle.xaml


+ 46 - 0
PDF Office/Styles/ListViewStyle.xaml

@@ -399,4 +399,50 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <ControlTemplate x:Key="AnnotationListItemStyle" TargetType="{x:Type ListBoxItem}">
+        <Border
+            x:Name="Bd"
+            Padding="{TemplateBinding Padding}"
+            Background="{TemplateBinding Background}"
+            BorderBrush="{TemplateBinding BorderBrush}"
+            BorderThickness="{TemplateBinding BorderThickness}"
+            SnapsToDevicePixels="True">
+            <ContentPresenter
+                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                Content="{TemplateBinding Content}"
+                ContentStringFormat="{TemplateBinding ContentStringFormat}"
+                ContentTemplate="{TemplateBinding ContentTemplate}"
+                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+        </Border>
+        <ControlTemplate.Triggers>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="IsMouseOver" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#0A000000" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelectionActive" Value="False" />
+                    <Condition Property="IsSelected" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#1A477EDE" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <MultiTrigger>
+                <MultiTrigger.Conditions>
+                    <Condition Property="Selector.IsSelectionActive" Value="True" />
+                    <Condition Property="IsSelected" Value="True" />
+                </MultiTrigger.Conditions>
+                <Setter TargetName="Bd" Property="Background" Value="#1A477EDE" />
+                <Setter TargetName="Bd" Property="BorderBrush" Value="Transparent" />
+            </MultiTrigger>
+            <Trigger Property="IsEnabled" Value="False">
+                <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+            </Trigger>
+        </ControlTemplate.Triggers>
+    </ControlTemplate>
 </ResourceDictionary>

+ 43 - 0
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -0,0 +1,43 @@
+using ComPDFKitViewer.AnnotEvent;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.BOTA
+{
+    public class AnnotationContentViewModel : BindableBase, INavigationAware
+    {
+        private ObservableCollection<AnnotHandlerEventArgs> annotationListItems;
+
+        public ObservableCollection<AnnotHandlerEventArgs> AnnotationListItems
+        {
+            get { return annotationListItems; }
+            set
+            {
+                SetProperty(ref annotationListItems, value);
+            }
+        }
+
+        public AnnotationContentViewModel()
+        {
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+        }
+    }
+}

+ 3 - 3
PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs

@@ -67,7 +67,7 @@ namespace PDF_Office.ViewModels.BOTA
             viewNameByTabItem.Add("TabItemThumbnail", "PageEditContent");
             viewNameByTabItem.Add("TabItemOutLine", "");
             viewNameByTabItem.Add("TabItemBookMark", "BookmarkContent");
-            viewNameByTabItem.Add("TabItemAnnotation", "");
+            viewNameByTabItem.Add("TabItemAnnotation", "AnnotationContent");
             viewNameByTabItem.Add("TabItemSearch", "");
             viewNameByTabItem.Add("TabItemForm", "");
             viewNameByTabItem.Add("TabItemSign", "");
@@ -81,9 +81,9 @@ namespace PDF_Office.ViewModels.BOTA
         {
             NavigationParameters param = new NavigationParameters();
             param.Add(ParameterNames.PDFViewer, pdfViewer);
-            if(currentBar== "TabItemThumbnail")
+            if (currentBar == "TabItemThumbnail")
             {
-                param.Add(ParameterNames.BOTAThumb,true);
+                param.Add(ParameterNames.BOTAThumb, true);
             }
             regions.RequestNavigate(BOTAContentRegionName, viewNameByTabItem[currentBar], param);
         }

+ 1 - 0
PDF Office/ViewModels/PropertyPanel/ViewModular/ReadModeContentViewModel.cs

@@ -21,6 +21,7 @@ using TextBox = System.Windows.Controls.TextBox;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 using Button = System.Windows.Controls.Button;
 using System.Windows.Controls.Primitives;
+using Microsoft.Office.Interop.Word;
 
 namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
 {

+ 217 - 0
PDF Office/ViewModels/PropertyPanel/ViewModular/ReadViewContentViewModel.cs

@@ -0,0 +1,217 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.ViewModels.PropertyPanel.ViewModular
+{
+    public class ReadViewContentViewModel : BindableBase, INavigationAware
+    {
+        public string ReadRegionName { get; set; }
+        public string ReadModeRegionName { get; set; }
+
+        public CPDFViewer PDFViewer { get; set; }
+
+        private bool canSave;
+
+        /// <summary>
+        /// 是否可以保存
+        /// </summary>
+        public bool CanSave
+        {
+            get { return canSave; }
+            set
+            {
+                SetProperty(ref canSave, value);
+            }
+        }
+
+        private bool canUndo;
+
+        /// <summary>
+        /// 是否可以进行Undo
+        /// </summary>
+        public bool CanUndo
+        {
+            get { return canUndo; }
+            set
+            {
+                SetProperty(ref canUndo, value);
+            }
+        }
+
+        private bool canRedo;
+
+        /// <summary>
+        /// 是否可以进行Redo
+        /// </summary>
+        public bool CanRedo
+        {
+            get { return canRedo; }
+            set
+            {
+                SetProperty(ref canRedo, value);
+            }
+        }
+
+        private Visibility readModeContentVisibility = Visibility.Collapsed;
+
+        public Visibility ReadModeContentVisibility
+        {
+            get { return readModeContentVisibility; }
+            set
+            {
+                SetProperty(ref readModeContentVisibility, value);
+            }
+        }
+
+        private Visibility rectangleReadModeVisibility = Visibility.Collapsed;
+
+        public Visibility RectangleReadModeVisibility
+        {
+            get { return rectangleReadModeVisibility; }
+            set
+            {
+                SetProperty(ref rectangleReadModeVisibility, value);
+            }
+        }
+
+        public IRegionManager region;
+
+        public IDialogService dialogs;
+
+        /// <summary>
+        /// 鼠标滚轮缩放的缩放值
+        /// </summary>
+        private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+
+        public DelegateCommand Load { get; set; }
+
+        public ReadViewContentViewModel(IRegionManager regionManager, IDialogService dialogService)
+        {
+            region = regionManager;
+            dialogs = dialogService;
+            ReadRegionName = RegionNames.ReadRegionName;
+            ReadModeRegionName = RegionNames.ReadModePageRegionName;
+            ReadModeContentVisibility = Visibility.Visible;
+            RectangleReadModeVisibility = Visibility.Collapsed;
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            if (pdfview != null)
+            {
+                PDFViewer = pdfview;
+                LoadFile();
+            }
+        }
+
+        /// <summary>
+        /// 将PDFViwer添加到Region
+        /// </summary>
+        private void LoadFile()
+        {
+            PDFViewer.MouseWheelZoomHandler += PdfViewer_MouseWheelZoomHandler;
+            PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+            CanSave = PDFViewer.UndoManager.CanSave;
+            CanUndo = PDFViewer.UndoManager.CanUndo;
+            CanRedo = PDFViewer.UndoManager.CanRedo;
+
+            if (region.Regions.ContainsRegionWithName(ReadRegionName))
+            {
+                if (!region.Regions[ReadRegionName].Views.Contains(PDFViewer))
+                {
+                    region.AddToRegion(ReadRegionName, PDFViewer);
+                }
+                else
+                {
+                    var contentRegion = region.Regions[ReadRegionName];
+                    contentRegion.Remove(PDFViewer);
+                    region.AddToRegion(ReadRegionName, PDFViewer);
+                }
+            }
+
+            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
+            {
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add(ParameterNames.ViewContentViewModel, this);
+
+                region.RequestNavigate(ReadModeRegionName, "ReadModeContent", parameters);
+            }
+             ));
+        }
+
+        public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
+        {
+            double newZoom = CheckZoomLevel(PDFViewer.ZoomFactor + (e ? 0.01 : -0.01), e);
+            PDFViewer.Zoom(newZoom);
+        }
+
+        private double CheckZoomLevel(double zoom, bool IsGrowth)
+        {
+            double standardZoom = 100;
+            if (zoom <= 0.01)
+            {
+                return 0.01;
+            }
+            if (zoom >= 10)
+            {
+                return 10;
+            }
+
+            zoom *= 100;
+            for (int i = 0; i < zoomLevel.Length - 1; i++)
+            {
+                if (zoom > zoomLevel[i] && zoom <= zoomLevel[i + 1] && IsGrowth)
+                {
+                    standardZoom = zoomLevel[i + 1];
+                    break;
+                }
+                if (zoom >= zoomLevel[i] && zoom < zoomLevel[i + 1] && !IsGrowth)
+                {
+                    standardZoom = zoomLevel[i];
+                    break;
+                }
+            }
+            return standardZoom / 100;
+        }
+
+        private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            //不处于页面编辑模式下时,根据PDFVIewer的undo redo状态来更新按钮状态
+            //页面编辑模式下,按钮状态根据页面编辑的undo redo来显示
+            if (e.PropertyName == "CanUndo")
+            {
+                CanUndo = PDFViewer.UndoManager.CanUndo;
+            }
+            if (e.PropertyName == "CanRedo")
+            {
+                CanRedo = PDFViewer.UndoManager.CanRedo;
+            }
+            if (e.PropertyName == "CanSave")
+            {
+                CanSave = PDFViewer.UndoManager.CanSave;
+            }
+        }
+    }
+}

+ 176 - 66
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -23,6 +23,7 @@ using PDF_Office.Views;
 using Prism.Events;
 using PDF_Office.EventAggregators;
 using PDF_Office.Views.EditTools.Background;
+using PDF_Office.Views.PageEdit;
 
 namespace PDF_Office.ViewModels
 {
@@ -30,7 +31,7 @@ namespace PDF_Office.ViewModels
     {
         #region 属性、变量
 
-        private CPDFViewer PDFViewer { get; set; }
+        public CPDFViewer PDFViewer { get; set; }
 
         private MainContentViewModel mainViewModel { get; set; }
 
@@ -60,25 +61,50 @@ namespace PDF_Office.ViewModels
         public string BottomToolRegionName { get; set; }
 
         private bool _isInPageEdit = false;
+
         /// <summary>
         /// 是否处于页面编辑模式,用于执行undo redo 的具体操作
         /// </summary>
         public bool isInPageEdit
         {
             get { return _isInPageEdit; }
-            set { _isInPageEdit = value;
+            set
+            {
+                _isInPageEdit = value;
                 if (!value)
                 {
                     CanRedo = PDFViewer.UndoManager.CanRedo;
                     CanUndo = PDFViewer.UndoManager.CanUndo;
                 }
-                }
+            }
         }
 
         public Action PageEditUndo { get; set; }
 
         public Action PageEditRedo { get; set; }
 
+        private Visibility readModeContentVisibility = Visibility.Collapsed;
+
+        public Visibility ReadModeContentVisibility
+        {
+            get { return readModeContentVisibility; }
+            set
+            {
+                SetProperty(ref readModeContentVisibility, value);
+            }
+        }
+
+        private Visibility rectangleReadModeVisibility = Visibility.Collapsed;
+
+        public Visibility RectangleReadModeVisibility
+        {
+            get { return rectangleReadModeVisibility; }
+            set
+            {
+                SetProperty(ref rectangleReadModeVisibility, value);
+            }
+        }
+
         /// <summary>
         ///工具条
         ///0:收起
@@ -467,6 +493,7 @@ namespace PDF_Office.ViewModels
                 case "BackgroundContent":
                     ToolContentVisible = Visibility.Visible;
                     break;
+
                 default:
                     break;
             }
@@ -625,31 +652,31 @@ namespace PDF_Office.ViewModels
         {
             //在构造函数中使用Region需要借助Dispatcher 确保UI已经加载完成,加载BOTA区域
             System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-            {
-                NavigationParameters parameters = new NavigationParameters();
-                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
-                parameters.Add(ParameterNames.ViewContentViewModel, this);
-
-                region.RequestNavigate(BOTARegionName, "BOTAContent", parameters);
-                region.RequestNavigate(BottomToolRegionName, "BottomToolContent", parameters);
-                region.RequestNavigate(ReadModeRegionName, "ReadModeContent", parameters);
-
-                //TODO 根据上一次关闭记录的菜单,选中TabItem
-                EnterSelectedBar("TabItemAnnotation");
-            }
-            ));
+                  {
+                      NavigationParameters parameters = new NavigationParameters();
+                      parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                      parameters.Add(ParameterNames.ViewContentViewModel, this);
+
+                      region.RequestNavigate(BOTARegionName, "BOTAContent", parameters);
+                      region.RequestNavigate(BottomToolRegionName, "BottomToolContent", parameters);
+                      region.RequestNavigate(ReadModeRegionName, "ReadModeContent", parameters);
+
+                      //TODO 根据上一次关闭记录的菜单,选中TabItem
+                      EnterSelectedBar("TabItemAnnotation");
+                  }
+                  ));
         }
 
         public void SelectedPrpoertyPanel(string Content, AnnotPropertyPanel annotPropertyPanel)
         {
             System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
-            {
-                NavigationParameters parameters = new NavigationParameters();
-                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
-                parameters.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
-                region.RequestNavigate(PropertyRegionName, Content, parameters);
-            }
-         ));
+                      {
+                          NavigationParameters parameters = new NavigationParameters();
+                          parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                          parameters.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
+                          region.RequestNavigate(PropertyRegionName, Content, parameters);
+                      }
+                      ));
         }
 
         /// <summary>
@@ -714,48 +741,48 @@ namespace PDF_Office.ViewModels
                 {
                     PDFViewer.UndoManager.CanSave = false;
                     App.Current.Dispatcher.Invoke(() =>
-                    {
-                        //TODO:更新缩略图
-                        //OpenFileInfo info = SettingHelper.GetFileInfo(PdfViewer.Document.FilePath);
-                        //try
-                        //{
-                        //    if (!string.IsNullOrEmpty(info.ThumbImgPath) && !PdfViewer.Document.IsEncrypted)//加密的文档不获取缩略图
-                        //    {
-                        //        var size = PdfViewer.Document.GetPageSize(0);
-                        //        System.Drawing.Bitmap bitmap = ToolMethod.RenderPageBitmapNoWait(PdfViewer.Document, (int)size.Width, (int)size.Height, 0, true, true);
-                        //        string folderPath = System.IO.Path.Combine(App.CurrentPath, "CoverImage");
-                        //        if (File.Exists(folderPath))
-                        //            File.Delete(folderPath);
-                        //        DirectoryInfo folder = new DirectoryInfo(folderPath);
-                        //        if (!folder.Exists)
-                        //            folder.Create();
-                        //        string imagePath = info.ThumbImgPath;
-                        //        if (!File.Exists(imagePath))//由加密文档变为非加密文档时 新建一个路径
-                        //        {
-                        //            string imageName = Guid.NewGuid().ToString();
-                        //            imagePath = System.IO.Path.Combine(folderPath, imageName);
-                        //            using (FileStream stream = new FileStream(imagePath, FileMode.Create))
-                        //            {
-                        //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
-                        //            }
-                        //        }
-                        //        else
-                        //        {
-                        //            using (FileStream stream = new FileStream(imagePath, FileMode.Open))
-                        //            {
-                        //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
-                        //            }
-                        //        }
-                        //        info.ThumbImgPath = imagePath;
-                        //        SettingHelper.SetFileInfo(info);
-                        //    }
-                        //}
-                        //catch
-                        //{
-                        //    info.ThumbImgPath = null;
-                        //    SettingHelper.SetFileInfo(info);
-                        //}
-                    });
+                                  {
+                                      //TODO:更新缩略图
+                                      //OpenFileInfo info = SettingHelper.GetFileInfo(PdfViewer.Document.FilePath);
+                                      //try
+                                      //{
+                                      //    if (!string.IsNullOrEmpty(info.ThumbImgPath) && !PdfViewer.Document.IsEncrypted)//加密的文档不获取缩略图
+                                      //    {
+                                      //        var size = PdfViewer.Document.GetPageSize(0);
+                                      //        System.Drawing.Bitmap bitmap = ToolMethod.RenderPageBitmapNoWait(PdfViewer.Document, (int)size.Width, (int)size.Height, 0, true, true);
+                                      //        string folderPath = System.IO.Path.Combine(App.CurrentPath, "CoverImage");
+                                      //        if (File.Exists(folderPath))
+                                      //            File.Delete(folderPath);
+                                      //        DirectoryInfo folder = new DirectoryInfo(folderPath);
+                                      //        if (!folder.Exists)
+                                      //            folder.Create();
+                                      //        string imagePath = info.ThumbImgPath;
+                                      //        if (!File.Exists(imagePath))//由加密文档变为非加密文档时 新建一个路径
+                                      //        {
+                                      //            string imageName = Guid.NewGuid().ToString();
+                                      //            imagePath = System.IO.Path.Combine(folderPath, imageName);
+                                      //            using (FileStream stream = new FileStream(imagePath, FileMode.Create))
+                                      //            {
+                                      //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
+                                      //            }
+                                      //        }
+                                      //        else
+                                      //        {
+                                      //            using (FileStream stream = new FileStream(imagePath, FileMode.Open))
+                                      //            {
+                                      //                bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
+                                      //            }
+                                      //        }
+                                      //        info.ThumbImgPath = imagePath;
+                                      //        SettingHelper.SetFileInfo(info);
+                                      //    }
+                                      //}
+                                      //catch
+                                      //{
+                                      //    info.ThumbImgPath = null;
+                                      //    SettingHelper.SetFileInfo(info);
+                                      //}
+                                  });
                 }
                 else
                 {
@@ -800,7 +827,7 @@ namespace PDF_Office.ViewModels
                         //提示文件被其他软件占用 无法保存
                         //MessageBoxEx.Show(App.MainPageLoader.GetString("Main_TheFileOccupiedWarning"), "", Winform.MessageBoxButtons.OKCancel, new string[] { App.MainPageLoader.GetString("Main_SaveAs"), App.MainPageLoader.GetString("Main_Cancel") })
                     }
-                      ;
+                ;
                 }
                 return result;
             }
@@ -968,6 +995,89 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        public async void RbtnReadMode(ViewContent viewContent)
+        {
+            App.IsBookMode = true;
+            ReadModeContentVisibility = Visibility.Visible;
+            RectangleReadModeVisibility = Visibility.Collapsed;
+            IsLoading = Visibility.Visible;
+            await Task.Delay(1);
+
+            //region.AddToRegion(ToolContentRegionName, PDFViewer);
+
+            //if (region.Regions.ContainsRegionWithName(ToolContentRegionName))
+            //{
+            //    if (!region.Regions[ToolContentRegionName].Views.Contains(PDFViewer))
+            //    {
+            //        region.AddToRegion(ToolContentRegionName, PDFViewer);
+            //    }
+            //    else
+            //    {
+            //        var contentRegion = region.Regions[ToolContentRegionName];
+            //        contentRegion.Remove(PDFViewer);
+            //        //if (region.Regions[ToolContentRegionName].Views.Contains(PageEditContent))
+            //        //{
+            //        //    contentRegion.Remove(PageEditContent);
+            //        //}
+
+            //        region.AddToRegion(ToolContentRegionName, PDFViewer);
+            //    }
+            //}
+
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            param.Add(ParameterNames.ViewContentViewModel, this);
+            region.RequestNavigate(ToolContentRegionName, "ReadViewContent", param);
+
+            //ShowContent(CurrentBar, true);
+            if (GridToolRow != 0)
+            {
+                GridToolRow = 0;
+            }
+
+            if (GridToolRowSpan != 4)
+            {
+                GridToolRowSpan = 4;
+            }
+            //isInPageEdit = true;
+            UpdateShowContent("TabItemPageEdit");
+            IsLoading = Visibility.Collapsed;
+        }
+
+        public async void UnReadModel()
+        {
+            App.IsBookMode = false;
+            ReadModeContentVisibility = Visibility.Collapsed;
+            RectangleReadModeVisibility = Visibility.Collapsed;
+            IsLoading = Visibility.Visible;
+            await Task.Delay(1);
+            //region.AddToRegion(ViwerRegionName, PDFViewer);
+
+            if (region.Regions.ContainsRegionWithName(ViwerRegionName))
+            {
+                if (region.Regions[ViwerRegionName].Views.Contains(PDFViewer))
+                {
+                    var contentRegion = region.Regions[ViwerRegionName];
+                    contentRegion.Remove(PDFViewer);
+                }
+                region.AddToRegion(ViwerRegionName, PDFViewer);
+            }
+            if (string.IsNullOrEmpty(CurrentBar) || CurrentBar.Equals("TabItemPageEdit", StringComparison.OrdinalIgnoreCase))
+            {
+                EnterSelectedBar("TabItemAnnotation");
+            }
+            else
+            {
+                EnterSelectedBar(CurrentBar);
+            }
+
+            //isInPageEdit = false;
+            //ShowContent(CurrentBar, false);
+            //isInPageEdit = false;
+
+            IsLoading = Visibility.Collapsed;
+        }
+
         #endregion 方法
     }
 }

File diff suppressed because it is too large
+ 248 - 0
PDF Office/Views/BOTA/AnnotationContent.xaml


+ 28 - 0
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.BOTA
+{
+    /// <summary>
+    /// AnnotationContent.xaml 的交互逻辑
+    /// </summary>
+    public partial class AnnotationContent : UserControl
+    {
+        public AnnotationContent()
+        {
+            InitializeComponent();
+        }
+    }
+}

File diff suppressed because it is too large
+ 291 - 0
PDF Office/Views/BOTA/AnnotationListItem.xaml


+ 28 - 0
PDF Office/Views/BOTA/AnnotationListItem.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.BOTA
+{
+    /// <summary>
+    /// AnnotationListItem.xaml 的交互逻辑
+    /// </summary>
+    public partial class AnnotationListItem : UserControl
+    {
+        public AnnotationListItem()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 53 - 0
PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml

@@ -0,0 +1,53 @@
+<UserControl
+    x:Class="PDF_Office.Views.PropertyPanel.ViewModular.ReadViewContent"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:Viewer="clr-namespace:ComPDFKitViewer.PdfViewer;assembly=ComPDFKit.Viewer"
+    xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.ViewModular"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodels="clr-namespace:PDF_Office.ViewModels.PropertyPanel.ViewModular"
+    d:DataContext="{d:DesignInstance Type=viewmodels:ReadViewContentViewModel}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    KeyDown="UserControl_KeyDown"
+    mc:Ignorable="d">
+    <i:Interaction.Triggers>
+        <i:EventTrigger EventName="Loaded">
+            <prism:InvokeCommandAction Command="{Binding Load}" />
+        </i:EventTrigger>
+    </i:Interaction.Triggers>
+    <Grid>
+        <ContentControl
+            x:Name="PDFViewerContent"
+            HorizontalAlignment="Stretch"
+            prism:RegionManager.RegionName="{Binding ReadRegionName}" />
+        <!--阅读模式下的页面控件-->
+        <ContentControl
+            x:Name="ReadModeContent"
+            Height="44"
+            Margin="0,0,0,5"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Bottom"
+            prism:RegionManager.RegionName="{Binding ReadModeRegionName}"
+            MouseEnter="RectangleReadMode_MouseEnter"
+            MouseLeave="ReadModeContent_MouseLeave"
+            Visibility="{Binding ReadModeContentVisibility}" />
+
+        <Rectangle
+            x:Name="RectangleReadMode"
+            Width="{Binding ActualWidth, ElementName=ReadModeContent, Mode=OneWay}"
+            Height="44"
+            Margin="0,0,0,5"
+            HorizontalAlignment="Center"
+            VerticalAlignment="Bottom"
+            Fill="Transparent"
+            MouseEnter="RectangleReadMode_MouseEnter"
+            Visibility="{Binding RectangleReadModeVisibility}" />
+    </Grid>
+</UserControl>

+ 63 - 0
PDF Office/Views/PropertyPanel/ViewModular/ReadViewContent.xaml.cs

@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+namespace PDF_Office.Views.PropertyPanel.ViewModular
+{
+    /// <summary>
+    /// ReadViewContent.xaml 的交互逻辑
+    /// </summary>
+    public partial class ReadViewContent : UserControl
+    {
+        public ReadViewContent()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// 鼠标移动到控件范围时显示控件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void RectangleReadMode_MouseEnter(object sender, MouseEventArgs e)
+        {
+            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
+            {
+                if (App.IsBookMode)
+                {
+                    this.ReadModeContent.Visibility = Visibility.Visible;
+                    this.RectangleReadMode.Visibility = Visibility.Collapsed;
+                }
+            }));
+        }
+
+        /// <summary>
+        /// 鼠标移开页面控件,三秒后隐藏该控件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private async void ReadModeContent_MouseLeave(object sender, MouseEventArgs e)
+        {
+            await System.Threading.Tasks.Task.Delay(3000);
+            //Thread.Sleep(3000);
+            this.ReadModeContent.Visibility = Visibility.Collapsed;
+            this.RectangleReadMode.Visibility = Visibility.Visible;
+        }
+
+        private void UserControl_KeyDown(object sender, KeyEventArgs e)
+        {
+        }
+    }
+}

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

@@ -41,10 +41,10 @@ namespace PDF_Office.Views.PropertyPanel.ViewModular
                 {
                     if (main.ContentMain.Content is ViewContent viewContent)
                     {
-                        viewContent.RbtnReadMode_Click(sender, e);
-
+                        //viewContent.RbtnReadMode(sender, e);
+                        ViewContentViewModel model = viewContent.DataContext as ViewContentViewModel;
+                        model.RbtnReadMode(viewContent);
                     }
-
                 }
             }
         }

+ 4 - 34
PDF Office/Views/ViewContent.xaml

@@ -172,11 +172,8 @@
             </TabControl>
         </Grid>
 
-        <!--底部工具栏-->
-        <ContentControl
-            Grid.Row="3"
-            prism:RegionManager.RegionName="{Binding BottomToolRegionName}"
-            Visibility="{Binding IsReadMode}" />
+        <!--  底部工具栏  -->
+        <ContentControl Grid.Row="3" prism:RegionManager.RegionName="{Binding BottomToolRegionName}" />
 
         <!--  专门用来显示菜单二级工具栏  -->
         <!--  调整工具栏的显示图层,方便阅读模式处理  -->
@@ -220,7 +217,7 @@
                 </ColumnDefinition>
             </Grid.ColumnDefinitions>
 
-            <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" Visibility="{Binding IsReadMode}" />
+            <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
                 Grid.Column="1"
                 Width="12"
@@ -233,34 +230,8 @@
                 HorizontalAlignment="Stretch"
                 prism:RegionManager.RegionName="{Binding ViwerRegionName}" />
             <ScrollViewer Grid.Column="4" VerticalScrollBarVisibility="Auto">
-                <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" Visibility="{Binding IsReadMode}" />
+                <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
             </ScrollViewer>
-            <!--  阅读模式下的页面控件  -->
-            <ContentControl
-                x:Name="ReadModeContent"
-                Grid.Column="0"
-                Grid.ColumnSpan="5"
-                Height="44"
-                Margin="0,0,0,5"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Bottom"
-                prism:RegionManager.RegionName="{Binding ReadModeRegionName}"
-                MouseEnter="RectangleReadMode_MouseEnter"
-                MouseLeave="ReadModeContent_MouseLeave"
-                Visibility="Collapsed" />
-
-            <Rectangle
-                x:Name="RectangleReadMode"
-                Grid.Column="0"
-                Grid.ColumnSpan="5"
-                Width="{Binding ActualWidth, ElementName=ReadModeContent, Mode=OneWay}"
-                Height="44"
-                Margin="0,0,0,5"
-                HorizontalAlignment="Center"
-                VerticalAlignment="Bottom"
-                Fill="Transparent"
-                MouseEnter="RectangleReadMode_MouseEnter"
-                Visibility="Collapsed" />
         </Grid>
 
         <!--  用于显示页面编辑、水印、背景、标记密文等功能的区域  -->
@@ -271,6 +242,5 @@
             prism:RegionManager.RegionName="{Binding ToolContentRegionName}"
             Visibility="{Binding ToolContentVisible}" />
         <cus:LoadingControl Grid.RowSpan="3" Visibility="{Binding IsLoading}" />
-
     </Grid>
 </UserControl>

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

@@ -1,6 +1,9 @@
 using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
 using PDF_Office.ViewModels;
 using PDF_Office.Views.PropertyPanel.ViewModular;
+using Prism.Regions;
 using System;
 using System.Threading;
 using System.Threading.Tasks;
@@ -25,56 +28,6 @@ namespace PDF_Office.Views
             viewModel = (ViewContentViewModel)this.DataContext;
         }
 
-        /// <summary>
-        /// 阅读模式
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        public void RbtnReadMode(object sender, RoutedEventArgs e)
-        {
-            if (viewModel != null)
-            {
-                App.IsBookMode = true;
-                SetReadMode(true);
-            }
-        }
-
-        /// <summary>
-        /// 设置阅读模式下的控件
-        /// </summary>
-        /// <param name="isBookMode"></param>
-        private async void SetReadMode(bool isBookMode)
-        {
-            if (isBookMode)
-            {
-                viewModel.IsReadMode = Visibility.Collapsed;
-                viewModel.IsPropertyOpen = false;
-
-                await Task.Delay(1);
-
-                this.ReadModeContent.Visibility = Visibility.Visible;
-                this.RectangleReadMode.Visibility = Visibility.Collapsed;
-
-                Grid.SetColumn(this.PDFViewerContent, 0);
-                Grid.SetColumnSpan(this.PDFViewerContent, 4);
-                Grid.SetRow(this.DocumentView, 0);
-                Grid.SetRowSpan(this.DocumentView, 4);
-            }
-            else
-            {
-                viewModel.IsReadMode = Visibility.Visible;
-                viewModel.IsPropertyOpen = true;
-
-                this.ReadModeContent.Visibility = Visibility.Collapsed;
-                this.RectangleReadMode.Visibility = Visibility.Visible;
-                await Task.Delay(1);
-                Grid.SetColumn(this.PDFViewerContent, 2);
-                Grid.SetColumnSpan(this.PDFViewerContent, 1);
-                Grid.SetRow(this.DocumentView, 2);
-                Grid.SetRowSpan(this.DocumentView, 1);
-            }
-        }
-
         /// <summary>
         /// 退出阅读模式
         /// </summary>
@@ -86,40 +39,11 @@ namespace PDF_Office.Views
             {
                 if (viewModel != null)
                 {
-                    App.IsBookMode = false;
-                    SetReadMode(false);
+                    //App.IsBookMode = false;
+                    //SetReadMode(false);
+                    viewModel.UnReadModel();
                 }
             }
         }
-
-        /// <summary>
-        /// 鼠标移开页面控件,三秒后隐藏该控件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private async void ReadModeContent_MouseLeave(object sender, RoutedEventArgs e)
-        {
-            await System.Threading.Tasks.Task.Delay(3000);
-            //Thread.Sleep(3000);
-            this.ReadModeContent.Visibility = Visibility.Collapsed;
-            this.RectangleReadMode.Visibility = Visibility.Visible;
-        }
-
-        /// <summary>
-        /// 鼠标移动到控件范围时显示控件
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void RectangleReadMode_MouseEnter(object sender, MouseEventArgs e)
-        {
-            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
-            {
-                if (App.IsBookMode)
-                {
-                    this.ReadModeContent.Visibility = Visibility.Visible;
-                    this.RectangleReadMode.Visibility = Visibility.Collapsed;
-                }
-            }));
-        }
     }
 }