Browse Source

Merge branch 'dev' into practice2

# Conflicts:
#	PDF Office/PDF Office.csproj
#	PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
#	PDF Office/ViewModels/ViewContentViewModel.cs
OYXH\oyxh 2 years ago
parent
commit
6a2fb6ead3
100 changed files with 6536 additions and 1199 deletions
  1. 1 0
      PDF Office/App.xaml
  2. 7 2
      PDF Office/App.xaml.cs
  3. BIN
      PDF Office/ComPDFKit.Desk.dll
  4. BIN
      PDF Office/ComPDFKit.Viewer.dll
  5. 62 0
      PDF Office/CustomControl/CustomImageControl.cs
  6. 370 0
      PDF Office/CustomControl/PathButton.cs
  7. 2 3
      PDF Office/CustomControl/ToastControl.xaml
  8. 2 1
      PDF Office/CustomControl/ToastControl.xaml.cs
  9. 14 1
      PDF Office/DataConvert/FileToImageSourceConvert.cs
  10. 98 0
      PDF Office/DataConvert/WidthConvert.cs
  11. 47 0
      PDF Office/Helper/CacheFilePath.cs
  12. 42 1
      PDF Office/Helper/CommonHelper.cs
  13. 104 0
      PDF Office/Helper/DragDropHelper.cs
  14. 255 58
      PDF Office/Helper/PDFToolsHelper.cs
  15. 228 0
      PDF Office/Helper/RichTextBoxHelper.cs
  16. 124 0
      PDF Office/Model/AnnotPanel/Stamp.cs
  17. 200 0
      PDF Office/Model/BOTA/OutlineNode.cs
  18. 0 1
      PDF Office/Model/CloudDrive/CloudDriveItem.cs
  19. 51 12
      PDF Office/Model/CloudDrive/CloudFiles.cs
  20. 10 0
      PDF Office/Model/DialogNames.cs
  21. 6 2
      PDF Office/Model/PDFTool/ToolItem.cs
  22. 79 0
      PDF Office/Model/PageEdit/PageEditHistory.cs
  23. 1 0
      PDF Office/Model/PageEdit/PageEditItem.cs
  24. 18 0
      PDF Office/Model/PageEdit/PageItemUnits.cs
  25. 20 0
      PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs
  26. 95 14
      PDF Office/PDF Office.csproj
  27. 0 0
      PDF Office/Resources/PageEdit/GridLine.jpg
  28. 0 0
      PDF Office/Resources/PageEdit/HorizontalLine.jpg
  29. 0 0
      PDF Office/Resources/PageEdit/Staff.jpg
  30. BIN
      PDF Office/Resources/StampIcons/Accepted.png
  31. BIN
      PDF Office/Resources/StampIcons/Approved.png
  32. BIN
      PDF Office/Resources/StampIcons/Completed.png
  33. BIN
      PDF Office/Resources/StampIcons/Confidential.png
  34. BIN
      PDF Office/Resources/StampIcons/Draft.png
  35. BIN
      PDF Office/Resources/StampIcons/Empty_stamp.png
  36. BIN
      PDF Office/Resources/StampIcons/Final.png
  37. BIN
      PDF Office/Resources/StampIcons/ForComment.png
  38. BIN
      PDF Office/Resources/StampIcons/ForPublicRelease.png
  39. BIN
      PDF Office/Resources/StampIcons/InformationOnly.png
  40. BIN
      PDF Office/Resources/StampIcons/InitialHere.png
  41. BIN
      PDF Office/Resources/StampIcons/NotApproved.png
  42. BIN
      PDF Office/Resources/StampIcons/NotForPublicRelease.png
  43. BIN
      PDF Office/Resources/StampIcons/PreliminaryResults.png
  44. BIN
      PDF Office/Resources/StampIcons/PrivateMark1.png
  45. BIN
      PDF Office/Resources/StampIcons/PrivateMark2.png
  46. BIN
      PDF Office/Resources/StampIcons/PrivateMark3.png
  47. BIN
      PDF Office/Resources/StampIcons/Rejected.png
  48. BIN
      PDF Office/Resources/StampIcons/SignHere.png
  49. BIN
      PDF Office/Resources/StampIcons/Void.png
  50. BIN
      PDF Office/Resources/StampIcons/Witness.png
  51. BIN
      PDF Office/Resources/StampIcons/revised.png
  52. 11 5
      PDF Office/Styles/CustomListItemStyle.xaml
  53. 160 0
      PDF Office/Styles/OutLineItemStyle.xaml
  54. 128 0
      PDF Office/Styles/PathButtonStyle.xaml
  55. 45 0
      PDF Office/Styles/RadioButtonStyle.xaml
  56. 5 5
      PDF Office/ViewModels/BOTA/BOTAContentViewModel.cs
  57. 456 0
      PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs
  58. 203 0
      PDF Office/ViewModels/BOTA/SearchContentViewModel.cs
  59. 22 5
      PDF Office/ViewModels/Dialog/PageEditDialogs/InsertDialogViewModel.cs
  60. 1 3
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveContentViewModel.cs
  61. 147 35
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveManager.cs
  62. 42 35
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxManager.cs
  63. 54 41
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxUserItem.cs
  64. 51 2
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveManager.cs
  65. 76 36
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveUserItem.cs
  66. 173 62
      PDF Office/ViewModels/HomePanel/CloudDrive/CloudFilesContentViewModel.cs
  67. 0 1
      PDF Office/ViewModels/HomePanel/HomeCloudContentViewModel.cs
  68. 11 11
      PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs
  69. 651 153
      PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs
  70. 220 0
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/CustomCreateDialogViewModel.cs
  71. 105 0
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/DynamicPropertyDialogViewModel.cs
  72. 9 0
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs
  73. 85 1
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs
  74. 363 2
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs
  75. 0 12
      PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextEditPropertyViewModel.cs
  76. 32 0
      PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs
  77. 8 3
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs
  78. 6 1
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs
  79. 6 1
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs
  80. 29 0
      PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs
  81. 104 155
      PDF Office/ViewModels/ViewContentViewModel.cs
  82. 138 0
      PDF Office/Views/BOTA/OutLineControl.xaml
  83. 366 0
      PDF Office/Views/BOTA/OutLineControl.xaml.cs
  84. 200 0
      PDF Office/Views/BOTA/SearchContent.xaml
  85. 102 0
      PDF Office/Views/BOTA/SearchContent.xaml.cs
  86. 42 9
      PDF Office/Views/Dialog/PageEditDialogs/InsertDialog.xaml
  87. 11 6
      PDF Office/Views/HomePanel/CloudDrive/CloudDriveContent.xaml
  88. 77 18
      PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml
  89. 96 76
      PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml.cs
  90. 6 6
      PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml
  91. 1 1
      PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml
  92. 43 39
      PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml.cs
  93. 8 4
      PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml
  94. 32 39
      PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml.cs
  95. 41 18
      PDF Office/Views/PageEdit/PageEditContent.xaml
  96. 155 319
      PDF Office/Views/PageEdit/PageEditContent.xaml.cs
  97. 94 0
      PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml
  98. 34 0
      PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml.cs
  99. 51 0
      PDF Office/Views/PropertyPanel/AnnotPanel/DynamicPropertyDialog.xaml
  100. 0 0
      PDF Office/Views/PropertyPanel/AnnotPanel/TextEditProperty.xaml.cs

+ 1 - 0
PDF Office/App.xaml

@@ -15,6 +15,7 @@
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/WindowsStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/CustomBtnStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ContainerStyles/ComboxStyle/ComboxItemStyle.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/PathButtonStyle.xaml"/>
                 <!--  Enable show customctrol's correctly UI in Xaml Designer  -->
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Themes/Generic.xaml" />
             </ResourceDictionary.MergedDictionaries>

+ 7 - 2
PDF Office/App.xaml.cs

@@ -128,8 +128,11 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<PageEditContent>();
             containerRegistry.RegisterForNavigation<BottomToolContent>();
             containerRegistry.RegisterForNavigation<ToolsBarContent>();
+            containerRegistry.RegisterForNavigation<TextEditToolContent>();
             containerRegistry.RegisterForNavigation<AnnotToolContent>();
             containerRegistry.RegisterForNavigation<BookmarkContent>();
+            containerRegistry.RegisterForNavigation<SearchContent>();
+            containerRegistry.RegisterForNavigation<OutLineControl>();
             containerRegistry.RegisterForNavigation<ViewModularContent>();
             containerRegistry.RegisterForNavigation<SplitScreenContent>();
             containerRegistry.RegisterForNavigation<ThemesContent>();
@@ -193,6 +196,8 @@ namespace PDF_Office
             containerRegistry.RegisterDialog<HomePagePrinterPageSetDialog>(DialogNames.HomePagePrinterPageSetDialog);
             containerRegistry.RegisterDialog<HomePagePictureToPDFDialog>(DialogNames.HomePagePictureToPDFDialog);
             containerRegistry.RegisterDialog<HomePageBatchProcessingDialog>(DialogNames.HomePageBatchProcessingDialog);
+            containerRegistry.RegisterDialog<DynamicPropertyDialog>(DialogNames.DynamicPropertyDialog);
+            containerRegistry.RegisterDialog<CustomCreateDialog>(DialogNames.CustomCreateDialog);
             containerRegistry.RegisterDialog<ConverterCSVDialog>(DialogNames.ConverterCSVDialog);
             containerRegistry.RegisterDialog<ConverterPPTDialog>(DialogNames.ConverterPPTDialog);
             containerRegistry.RegisterDialog<ConverterTextDialog>(DialogNames.ConverterTextDialog);
@@ -248,8 +253,8 @@ namespace PDF_Office
 
             try
             {
-                CPDFSDKVerifier.LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret);
-                if (verifyResult != CPDFSDKVerifier.LicenseErrorCode.LICENSE_ERR_SUCCESS)
+                LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify(devKey, devSecret);
+                if (verifyResult != LicenseErrorCode.LICENSE_ERR_SUCCESS)
                     return false;
             }
             catch { }

BIN
PDF Office/ComPDFKit.Desk.dll


BIN
PDF Office/ComPDFKit.Viewer.dll


+ 62 - 0
PDF Office/CustomControl/CustomImageControl.cs

@@ -0,0 +1,62 @@
+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.CustomControl
+{
+    internal class CustomImageControl : FrameworkElement
+    {
+        private DrawingVisual PresentChild { get; set; }
+        private DrawingContext DrawDC { get; set; }
+        public CustomImageControl()
+        {
+            PresentChild = new DrawingVisual();
+            AddVisualChild(PresentChild);
+            AddLogicalChild(PresentChild);
+        }
+        protected override Visual GetVisualChild(int index)
+        {
+            if (PresentChild == null)
+            {
+                throw new ArgumentOutOfRangeException();
+            }
+            return PresentChild;
+        }
+        protected override int VisualChildrenCount
+        {
+            get
+            {
+                if (PresentChild != null)
+                {
+                    return 1;
+                }
+                return 0;
+            }
+        }
+
+        public DrawingContext OpenDraw()
+        {
+            if (DrawDC == null)
+            {
+                DrawDC = PresentChild?.RenderOpen();
+            }
+            return DrawDC;
+        }
+        public void CloseDraw()
+        {
+            DrawDC?.Close();
+            DrawDC = null;
+        }
+    }
+}

+ 370 - 0
PDF Office/CustomControl/PathButton.cs

@@ -0,0 +1,370 @@
+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.CustomControl
+{
+    public class PathButton : Button
+    {
+        static PathButton()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(PathButton), new FrameworkPropertyMetadata(typeof(PathButton)));
+        }
+
+        public override void OnApplyTemplate()
+        {
+            base.OnApplyTemplate();
+            if (this.MouseOverBackground == null)
+            {
+                this.MouseOverBackground = Background;
+            }
+            if (this.MouseDownBackground == null)
+            {
+                if (this.MouseOverBackground == null)
+                {
+                    this.MouseDownBackground = Background;
+                }
+                else
+                {
+                    this.MouseDownBackground = MouseOverBackground;
+                }
+            }
+            if (this.MouseOverBorderBrush == null)
+            {
+                this.MouseOverBorderBrush = BorderBrush;
+            }
+            if (this.MouseDownBorderBrush == null)
+            {
+                if (this.MouseOverBorderBrush == null)
+                {
+                    this.MouseDownBorderBrush = BorderBrush;
+                }
+                else
+                {
+                    this.MouseDownBorderBrush = MouseOverBorderBrush;
+                }
+            }
+            if (this.MouseOverForeground == null)
+            {
+                this.MouseOverForeground = Foreground;
+            }
+            if (this.MouseDownForeground == null)
+            {
+                if (this.MouseOverForeground == null)
+                {
+                    this.MouseDownForeground = Foreground;
+                }
+                else
+                {
+                    this.MouseDownForeground = this.MouseOverForeground;
+                }
+            }
+            if (this.IconChecked == null)
+            {
+                if (this.IconPress == null)
+                {
+                    this.IconChecked = Icon;
+                }
+                else
+                {
+                    this.IconChecked = this.IconPress;
+                }
+            }
+
+            if (this.IconCheckedFill == null)
+            {
+                if (this.IconPressFill == null)
+                {
+                    this.IconCheckedFill = IconFill;
+                }
+                else
+                {
+                    this.IconCheckedFill = this.IconPressFill;
+                }
+            }
+        }
+
+        #region 依赖项属性  
+
+        /// <summary>  
+        /// 鼠标移上去的背景颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseOverBackgroundProperty
+            = DependencyProperty.Register("MouseOverBackground", typeof(Brush), typeof(PathButton));
+
+        /// <summary>  
+        /// 鼠标按下去的背景颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseDownBackgroundProperty
+            = DependencyProperty.Register("MouseDownBackground", typeof(Brush), typeof(PathButton));
+
+        /// <summary>  
+        /// 鼠标移上去的字体颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseOverForegroundProperty
+            = DependencyProperty.Register("MouseOverForeground", typeof(Brush), typeof(PathButton), new PropertyMetadata(null, null));
+
+        /// <summary>  
+        /// 鼠标按下去的字体颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseDownForegroundProperty
+            = DependencyProperty.Register("MouseDownForeground", typeof(Brush), typeof(PathButton), new PropertyMetadata(null, null));
+
+        /// <summary>  
+        /// 鼠标移上去的边框颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseOverBorderBrushProperty
+            = DependencyProperty.Register("MouseOverBorderBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(null, null));
+
+        /// <summary>  
+        /// 鼠标按下去的边框颜色  
+        /// </summary>  
+        public static readonly DependencyProperty MouseDownBorderBrushProperty
+            = DependencyProperty.Register("MouseDownBorderBrush", typeof(Brush), typeof(PathButton), new PropertyMetadata(null, null));
+
+        /// <summary>  
+        /// 圆角  
+        /// </summary>  
+        public static readonly DependencyProperty CornerRadiusProperty
+            = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(PathButton), null);
+
+        //图标  
+        public static readonly DependencyProperty IconProperty
+            = DependencyProperty.Register("Icon", typeof(Geometry), typeof(PathButton), null);
+
+        //图标填充色  
+        public static readonly DependencyProperty IconFillProperty
+            = DependencyProperty.Register("IconFill", typeof(Brush), typeof(PathButton), null);
+
+        //图标透明度 
+        public static readonly DependencyProperty IconOpacityProperty
+            = DependencyProperty.Register("IconOpacity", typeof(double), typeof(PathButton), null);
+
+        //按钮是否被选中
+        public static readonly DependencyProperty IsCheckedProperty
+            = DependencyProperty.Register("IsChecked", typeof(bool), typeof(PathButton), null);
+
+        //选中的图标  
+        public static readonly DependencyProperty IconCheckedProperty
+            = DependencyProperty.Register("IconChecked", typeof(Geometry), typeof(PathButton), null);
+
+        //鼠标移上去的图标填充色   
+        public static readonly DependencyProperty IconCheckedFillProperty
+            = DependencyProperty.Register("IconCheckedFill", typeof(Brush), typeof(PathButton), null);
+
+        //鼠标移上去的透明度 
+        public static readonly DependencyProperty IconCheckedOpacityProperty
+            = DependencyProperty.Register("IconCheckedOpacity", typeof(double), typeof(PathButton), null);
+
+        //鼠标移上去的图标  
+        public static readonly DependencyProperty IconMouseOverProperty
+            = DependencyProperty.Register("IconMouseOver", typeof(Geometry), typeof(PathButton), null);
+
+        //鼠标移上去的图标填充色   
+        public static readonly DependencyProperty IconMouseOverFillProperty
+            = DependencyProperty.Register("IconMouseOverFill", typeof(Brush), typeof(PathButton), null);
+
+        //鼠标移上去的透明度 
+        public static readonly DependencyProperty IconMouseOverOpacityProperty
+            = DependencyProperty.Register("IconMouseOverOpacity", typeof(double), typeof(PathButton), null);
+
+        //鼠标按下去的图标
+        public static readonly DependencyProperty IconPressProperty
+            = DependencyProperty.Register("IconPress", typeof(Geometry), typeof(PathButton), null);
+
+        //鼠标按下去的图标填充色   
+        public static readonly DependencyProperty IconPressFillProperty
+            = DependencyProperty.Register("IconPressFill", typeof(Brush), typeof(PathButton), null);
+
+        //鼠标按下去的透明度 
+        public static readonly DependencyProperty IconPressOpacityProperty
+            = DependencyProperty.Register("IconPressOpacity", typeof(double), typeof(PathButton), null);
+
+        //图标高度  
+        public static readonly DependencyProperty IconHeightProperty
+            = DependencyProperty.Register("IconHeight", typeof(double), typeof(PathButton), new PropertyMetadata(24.0, null));
+
+        //图标宽度  
+        public static readonly DependencyProperty IconWidthProperty
+            = DependencyProperty.Register("IconWidth", typeof(double), typeof(PathButton), new PropertyMetadata(24.0, null));
+
+        //图标和内容的对齐方式  
+        public static readonly DependencyProperty IconContentOrientationProperty
+            = DependencyProperty.Register("IconContentOrientation", typeof(Orientation), typeof(PathButton), new PropertyMetadata(Orientation.Horizontal, null));
+
+        //图标和内容的距离  
+        public static readonly DependencyProperty IconContentMarginProperty
+            = DependencyProperty.Register("IconContentMargin", typeof(Thickness), typeof(PathButton), new PropertyMetadata(new Thickness(0, 0, 0, 0), null));
+
+        #endregion
+
+        #region 属性包装 
+
+        public Brush MouseOverBackground
+        {
+            get
+            {
+                return (Brush)GetValue(MouseOverBackgroundProperty);
+            }
+            set { SetValue(MouseOverBackgroundProperty, value); }
+        }
+
+        public Brush MouseDownBackground
+        {
+            get
+            {
+                return (Brush)GetValue(MouseDownBackgroundProperty);
+            }
+            set { SetValue(MouseDownBackgroundProperty, value); }
+        }
+
+        public Brush MouseOverForeground
+        {
+            get
+            {
+                return (Brush)GetValue(MouseOverForegroundProperty);
+            }
+            set { SetValue(MouseOverForegroundProperty, value); }
+        }
+
+        public Brush MouseDownForeground
+        {
+            get
+            {
+                return (Brush)GetValue(MouseDownForegroundProperty);
+            }
+            set { SetValue(MouseDownForegroundProperty, value); }
+        }
+
+        public Brush MouseOverBorderBrush
+        {
+            get { return (Brush)GetValue(MouseOverBorderBrushProperty); }
+            set { SetValue(MouseOverBorderBrushProperty, value); }
+        }
+
+        public Brush MouseDownBorderBrush
+        {
+            get { return (Brush)GetValue(MouseDownBorderBrushProperty); }
+            set { SetValue(MouseDownBorderBrushProperty, value); }
+        }
+
+        public CornerRadius CornerRadius
+        {
+            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+            set { SetValue(CornerRadiusProperty, value); }
+        }
+
+        public Geometry Icon
+        {
+            get { return (Geometry)GetValue(IconProperty); }
+            set { SetValue(IconProperty, value); }
+        }
+
+        public Brush IconFill
+        {
+            get { return (Brush)GetValue(IconFillProperty); }
+            set { SetValue(IconFillProperty, value); }
+        }
+
+        public double IconOpacity
+        {
+            get { return (double)GetValue(IconOpacityProperty); }
+            set { SetValue(IconOpacityProperty, value); }
+        }
+        public bool IsChecked
+        {
+            get { return (bool)GetValue(IsCheckedProperty); }
+            set { SetValue(IsCheckedProperty, value); }
+        }
+
+        public Geometry IconChecked
+        {
+            get { return (Geometry)GetValue(IconCheckedProperty); }
+            set { SetValue(IconCheckedProperty, value); }
+        }
+
+        public Brush IconCheckedFill
+        {
+            get { return (Brush)GetValue(IconCheckedFillProperty); }
+            set { SetValue(IconCheckedFillProperty, value); }
+        }
+
+        public double IconCheckedOpacity
+        {
+            get { return (double)GetValue(IconCheckedOpacityProperty); }
+            set { SetValue(IconCheckedOpacityProperty, value); }
+        }
+        public Geometry IconMouseOver
+        {
+            get { return (Geometry)GetValue(IconMouseOverProperty); }
+            set { SetValue(IconMouseOverProperty, value); }
+        }
+
+        public Brush IconMouseOverFill
+        {
+            get { return (Brush)GetValue(IconMouseOverProperty); }
+            set { SetValue(IconMouseOverProperty, value); }
+        }
+
+        public double IconMouseOverOpacity
+        {
+            get { return (double)GetValue(IconMouseOverProperty); }
+            set { SetValue(IconMouseOverProperty, value); }
+        }
+
+        public Geometry IconPress
+        {
+            get { return (Geometry)GetValue(IconPressProperty); }
+            set { SetValue(IconPressProperty, value); }
+        }
+
+        public Brush IconPressFill
+        {
+            get { return (Brush)GetValue(IconPressFillProperty); }
+            set { SetValue(IconPressFillProperty, value); }
+        }
+
+        public double IconPressOpacity
+        {
+            get { return (double)GetValue(IconPressOpacityProperty); }
+            set { SetValue(IconPressOpacityProperty, value); }
+        }
+
+        public double IconHeight
+        {
+            get { return (double)GetValue(IconHeightProperty); }
+            set { SetValue(IconHeightProperty, value); }
+        }
+
+        public double IconWidth
+        {
+            get { return (double)GetValue(IconWidthProperty); }
+            set { SetValue(IconWidthProperty, value); }
+        }
+
+        public Orientation IconContentOrientation
+        {
+            get { return (Orientation)GetValue(IconContentOrientationProperty); }
+            set { SetValue(IconContentOrientationProperty, value); }
+        }
+
+        public Thickness IconContentMargin
+        {
+            get { return (Thickness)GetValue(IconContentMarginProperty); }
+            set { SetValue(IconContentMarginProperty, value); }
+        }
+
+        #endregion
+    }
+}

+ 2 - 3
PDF Office/CustomControl/ToastControl.xaml

@@ -12,14 +12,13 @@
     d:DesignWidth="800"
     Background="Transparent"
     IsVisibleChanged="Toast_IsVisibleChanged"
-    Visibility="Collapsed"
+    Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ToastControl}, Path=Visibility}"
     mc:Ignorable="d">
     <Border
         Name="tipBorder"
         HorizontalAlignment="Center"
         Background="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ToastControl}, Path=Background}"
-        CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ToastControl}, Path=CornerRadius}"
-        Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ToastControl}, Path=Visibility}">
+        CornerRadius="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ToastControl}, Path=CornerRadius}">
         <TextBlock
             Name="txtTip"
             Padding="6,2,6,2"

+ 2 - 1
PDF Office/CustomControl/ToastControl.xaml.cs

@@ -83,6 +83,7 @@ namespace PDF_Office.CustomControl
         private void DoubleAnimation_Completed(object sender, EventArgs e)
         {
             this.Visibility = Visibility.Collapsed;
+            this.Opacity = 1;
         }
 
         private void Toast_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
@@ -95,7 +96,7 @@ namespace PDF_Office.CustomControl
                 doubleAnimation.To = 0;
                 doubleAnimation.BeginTime = BeginTime;
                 doubleAnimation.Duration = Duration;
-                this.BeginAnimation(UserControl.OpacityProperty,doubleAnimation);
+                this.BeginAnimation(UserControl.OpacityProperty, doubleAnimation);
             }
         }
     }

+ 14 - 1
PDF Office/DataConvert/FileToImageSourceConvert.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Globalization;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -18,7 +19,19 @@ namespace PDF_Office.DataConvert
         {
             if(!string.IsNullOrEmpty((string)value)&&System.IO.File.Exists((string)value))
             {
-                return new BitmapImage(new Uri((string)value, UriKind.Relative));
+                //采用数组的形式读取,避免因bitmap占用,导致图片无法引用的问题
+                // Read byte[] from png file
+                BinaryReader binReader = new BinaryReader(File.Open((string)value, FileMode.Open));
+                FileInfo fileInfo = new FileInfo((string)value);
+                byte[] bytes = binReader.ReadBytes((int)fileInfo.Length);
+                binReader.Close();
+
+                // Init bitmap
+                BitmapImage bitmap = new BitmapImage();
+                bitmap.BeginInit();
+                bitmap.StreamSource = new MemoryStream(bytes);
+                bitmap.EndInit();
+                return bitmap;
             }
             return null;
         }

+ 98 - 0
PDF Office/DataConvert/WidthConvert.cs

@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+
+namespace PDF_Office.DataConvert
+{
+    public class WidthConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null)
+            {
+                return 0;
+            }
+            else
+            {
+                if (value is double)
+                {
+                    double width = (double)value;
+                    width = width - SystemParameters.VerticalScrollBarWidth-8;
+                    return Math.Max(0, width);
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+    public class SearchWidthConvert : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value == null)
+            {
+                return 0;
+            }
+            else
+            {
+                if (value is double)
+                {
+                    double width = (double)value;
+                    width = width - SystemParameters.VerticalScrollBarWidth-20;
+                    return Math.Max(0, width);
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+    public class WidthMultiConvert : IMultiValueConverter
+    {
+        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (values == null || values.Length==0)
+            {
+                return 0;
+            }
+            else
+            {
+                if (values[0] is double)
+                {
+                    double width = (double)values[0];
+                    width = width - SystemParameters.VerticalScrollBarWidth - 8;
+                    return Math.Max(0, width);
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+
+        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 47 - 0
PDF Office/Helper/CacheFilePath.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Helper
+{
+    class CacheFilePath
+    {
+        private static readonly CacheFilePath instance = new CacheFilePath();
+        private CacheFilePath()
+        {
+
+        }
+        public static CacheFilePath Instance => instance;
+
+        public string CustomStampPath
+        {
+            get
+            {
+                try
+                {
+                    string Path = System.IO.Path.Combine(App.CurrentPath, "CustomStamp");
+                    System.IO.DirectoryInfo directoryInfo = System.IO.Directory.CreateDirectory(Path);
+                    if (directoryInfo.Exists
+                       &&(directoryInfo.Attributes & System.IO.FileAttributes.ReadOnly) != System.IO.FileAttributes.ReadOnly
+                       &&(directoryInfo.Attributes & System.IO.FileAttributes.Hidden) != System.IO.FileAttributes.Hidden
+                        )
+                    {
+                        return Path;
+                    }
+                    else
+                    {
+                        return "";
+                    }
+                }
+                catch (Exception)
+                {
+                    return "";
+                }
+
+            }
+        }
+
+    }
+}

+ 42 - 1
PDF Office/Helper/CommonHelper.cs

@@ -1,8 +1,10 @@
-using System;
+using PDF_Office.Model.PageEdit;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -18,6 +20,8 @@ namespace PDF_Office.Helper
     /// 5.ShowFileBrowser 显示系统文件浏览器,可以根据传入的路径参数,自动选中对应的文件
     /// 6.CreateFilePath 检查对应路径是否有重名,有重名的情况追加尾号
     /// 7.CreateFolder 检查对应文件夹是否有重名,有重名的情况追加尾号
+    /// 8.GetUnitsFromPageSize 将PDF页面宽高转换成对应的单位
+    /// 9.GetDpi() 返回当前设备DPI
     /// </summary>
     public static class CommonHelper
     {
@@ -277,5 +281,42 @@ namespace PDF_Office.Helper
             info.Create();
             return folder;
         }
+
+        /// <summary>
+        /// 将Document 返回的PageSize 转换成对应单位
+        /// </summary>
+        /// <param name="size"></param>
+        /// <param name="unit"></param>
+        /// <returns></returns>
+        public static double GetUnitsFromPageSize(double size,PageItemUnits unit = PageItemUnits.MM)
+        {
+            double sizeWithUnit = 0;
+            switch (unit)
+            {
+                case PageItemUnits.MM:
+                    sizeWithUnit = (size * 96 / 72.0) / GetDpi() * 25.4;
+                    break;
+                case PageItemUnits.CM:
+                    sizeWithUnit = (size * 96 / 72.0) / GetDpi() * 25.4/10.0;
+                    break;
+                case PageItemUnits.IN:
+                    sizeWithUnit = (size * 96 / 72.0) / GetDpi();
+                    break;
+                default:
+                    break;
+            }
+            return sizeWithUnit;
+        }
+
+        /// <summary>
+        /// 返回设备DPI
+        /// </summary>
+        /// <returns></returns>
+        public static double GetDpi()
+        {
+            BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
+            PropertyInfo property = typeof(SystemParameters).GetProperty("Dpi", bindingAttr);
+            return (int)property.GetValue(null, null);
+        }
     }
 }

+ 104 - 0
PDF Office/Helper/DragDropHelper.cs

@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Interop;
+
+namespace PDF_Office.Helper
+{
+    /// <summary>
+    /// 显示拖拽时图片的辅助类
+    /// </summary>
+    public static class DragDropHelper
+    {
+        private static IDropTargetHelper helper;
+
+        /// <summary>
+        /// 拖拽相关操作的实例
+        /// </summary>
+        public static IDropTargetHelper Helper
+        {
+            get
+            {
+                if (helper == null)
+                {
+                    helper = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("4657278A-411B-11D2-839A-00C04FD918D0"))) as IDropTargetHelper;
+                }
+                return helper;
+            }
+            set { helper = value; }
+        }
+
+
+        public static void DragEnter(FrameworkElement element, DragEventArgs e)
+        {
+            try
+            {
+                Point iconPoint = e.GetPosition(element);
+                Helper?.DragEnter(new WindowInteropHelper(Window.GetWindow(element)).Handle, (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref iconPoint, e.Effects);
+            }
+            catch { }
+        }
+
+        public static void DragOver(FrameworkElement element, DragEventArgs e)
+        {
+            try
+            {
+                Point iconPoint = e.GetPosition(element);
+                Helper?.DragOver(ref iconPoint, e.Effects);
+            }
+            catch { }
+        }
+
+        public static void DragLeave()
+        {
+            try
+            {
+                Helper?.DragLeave();
+            }
+            catch { }
+        }
+
+        public static void Drop(FrameworkElement element, DragEventArgs e)
+        {
+            try
+            {
+                Point iconPoint = e.GetPosition(element);
+                Helper?.Drop((System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref iconPoint, e.Effects);
+            }
+            catch { }
+        }
+    }
+
+    /// <summary>
+    /// 系统设置拖拽时图片的接口
+    /// </summary>
+    [ComImport]
+    [GuidAttribute("4657278B-411B-11d2-839A-00C04FD918D0")]
+    [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+    public interface IDropTargetHelper
+    {
+        // Notifies the drag-image manager that the drop target's IDropTarget::DragEnter method has been called  
+        [PreserveSig]
+        Int32 DragEnter(IntPtr hwndTarget, System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, ref Point ppt, DragDropEffects dwEffect);
+
+        // Notifies the drag-image manager that the drop target's IDropTarget::DragLeave method has been called  
+        [PreserveSig]
+        Int32 DragLeave();
+
+        // Notifies the drag-image manager that the drop target's IDropTarget::DragOver method has been called  
+        [PreserveSig]
+        Int32 DragOver(ref Point ppt, DragDropEffects dwEffect);
+
+        // Notifies the drag-image manager that the drop target's IDropTarget::Drop method has been called  
+        [PreserveSig]
+        Int32 Drop(System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, ref Point ppt, DragDropEffects dwEffect);
+
+        // Notifies the drag-image manager to show or hide the drag image  
+        [PreserveSig]
+        Int32 Show(bool fShow);
+    }
+}

+ 255 - 58
PDF Office/Helper/PDFToolsHelper.cs

@@ -9,7 +9,34 @@ using System.Threading.Tasks;
 
 namespace PDF_Office.Helper
 {
+    /// <summary>
+    /// 预设需求:远程控制对PDF工具进行排序
+    /// </summary>
     public enum PDFToolType
+    {
+        /// <summary>
+        /// 普通工具
+        /// </summary>
+        Normal,
+        /// <summary>
+        /// 常用工具
+        /// </summary>
+        Common,
+        /// <summary>
+        ///付费工具
+        /// </summary>
+        Payment,
+        /// <summary>
+        /// 优势工具
+        /// </summary>
+        Advantage,
+        /// <summary>
+        /// 无需打开文档
+        /// </summary>
+        NoNeedToOpenDoc
+
+    }
+    public enum PDFFnType
     {
         Split,
         Extract,
@@ -31,12 +58,61 @@ namespace PDF_Office.Helper
         Background,
         CompareDoc
 
+    }
+
+    /// <summary>
+    /// PDF工具初始化类型
+    /// </summary>
+    internal class PDFToolsInit
+    {
+        public ToolItem toolItem { get; private set; }
+        public PDFToolsInit()
+        {
+            toolItem = new ToolItem();
+        }
+
+        /// <summary>
+        /// 图标
+        /// </summary>
+        public void SetImagePath(string path)
+        {
+            toolItem.Image = path;
+        }
+
+        /// <summary>
+        /// 初始化UI显示内容
+        /// </summary>
+        public void SetContent(string fnName,string fnInfo)
+        {
+            toolItem.Title = fnName;
+            toolItem.TitleInfo = fnInfo;
+        }
+
+        /// <summary>
+        /// 初始化功能
+        /// </summary>
+        public void SetFnType(PDFFnType fnType)
+        {
+            toolItem.FnType = (int)fnType;
+            toolItem.strFnType = Enum.GetName(typeof(PDFFnType), fnType);
+        }
+
+
     }
     public class PDFToolsHelper
     {
         public List<ToolItem> AllTools = null;
         public List<ToolItem> QuickTools = null;
-        public PDFToolsHelper()
+        public List<ToolItem> MoreTools = null;
+        private static PDFToolsHelper pDFToolsHelper;
+        public static PDFToolsHelper GetInstance()
+        {
+            if (pDFToolsHelper == null)
+                pDFToolsHelper = new PDFToolsHelper();
+
+            return pDFToolsHelper;
+        }
+        private PDFToolsHelper()
         {
             InitPDFTools();
         }
@@ -44,99 +120,220 @@ namespace PDF_Office.Helper
         private void InitPDFTools()
         {
             AllTools = new List<ToolItem>();
+            QuickTools = new List<ToolItem>();
+            MoreTools = new List<ToolItem>();
+            //测试代码
+            //Settings.Default.AllPDFToolsList.Clear();
+            //Settings.Default.QuickPDFToolsList.Clear();
+            //Settings.Default.Save();
             InitAllTools();
+            ContianNewTools();
             InitQuickTools();
+            InitMoreTools();
         }
 
         private void InitAllTools()
-        {
-            string path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/split.png";
-            AddToolItem(PDFToolType.Split, path, "拆分", "Batch convert, compress, secure, watermark PDFs.");
+        { 
+
+            var split = new PDFToolsInit();
+            split.SetFnType(PDFFnType.Split);
+            split.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/split.png");
+            split.SetContent("拆分", "Batch convert, compress, secure, watermark PDFs.");
+
+            var extract = new PDFToolsInit();
+            extract.SetFnType(PDFFnType.Extract);
+            extract.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/extract.png");
+            extract.SetContent("提取", "Batch convert, compress, secure, watermark PDFs.");
+
+            var insert = new PDFToolsInit();
+            insert.SetFnType(PDFFnType.Insert);
+            insert.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/insert.png");
+            insert.SetContent("插入", "Batch convert, compress, secure, watermark PDFs.");
+
+            var compress = new PDFToolsInit();
+            compress.SetFnType(PDFFnType.Compress);
+            compress.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/compress.png");
+            compress.SetContent("压缩", "Batch convert, compress, secure, watermark PDFs.");
+
+            var merge = new PDFToolsInit();
+            merge.SetFnType(PDFFnType.Merge);
+            merge.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/merge.png");
+            merge.SetContent("合并", "Batch convert, compress, secure, watermark PDFs.");
+
+            var print = new PDFToolsInit();
+            print.SetFnType(PDFFnType.Print);
+            print.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/print.png");
+            print.SetContent("打印", "Batch convert, compress, secure, watermark PDFs.");
+
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/extract.png";
-            AddToolItem(PDFToolType.Extract, path, "提取", "Batch convert, compress, secure, watermark PDFs.");
+            var security = new PDFToolsInit();
+            security.SetFnType(PDFFnType.Security);
+            security.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/security.png");
+            security.SetContent("安全", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/insert.png";
-            AddToolItem(PDFToolType.Insert, path, "插入", "Batch convert, compress, secure, watermark PDFs.");
+            var convertPDF = new PDFToolsInit();
+            convertPDF.SetFnType(PDFFnType.ConvertPDF);
+            convertPDF.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/convert.png");
+            convertPDF.SetContent("转档PDF", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/compress.png";
-            AddToolItem(PDFToolType.Compress, path, "压缩", "Batch convert, compress, secure, watermark PDFs.");
+            var pDFToWord = new PDFToolsInit();
+            pDFToWord.SetFnType(PDFFnType.PDFToWord);
+            pDFToWord.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-word.png");
+            pDFToWord.SetContent("PDF转Word", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/merge.png";
-            AddToolItem(PDFToolType.Merge, path, "合并", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/print.png";
-            AddToolItem(PDFToolType.Print, path, "打印", "Batch convert, compress, secure, watermark PDFs.");
+            var pDFToExcel = new PDFToolsInit();
+            pDFToExcel.SetFnType(PDFFnType.PDFToExcel);
+            pDFToExcel.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-excel.png");
+            pDFToExcel.SetContent("PDF转Excel", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/security.png";
-            AddToolItem(PDFToolType.Security, path, "安全", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/convert.png";
-            AddToolItem(PDFToolType.ConvertPDF, path, "转档PDF", "Batch convert, compress, secure, watermark PDFs.");
+            var pDFToPPT = new PDFToolsInit();
+            pDFToPPT.SetFnType(PDFFnType.PDFToPPT);
+            pDFToPPT.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-ppt.png");
+            pDFToPPT.SetContent("PDF转PPT", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-word.png";
-            AddToolItem(PDFToolType.PDFToWord, path, "PDF转Word", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-excel.png";
-            AddToolItem(PDFToolType.PDFToExcel, path, "PDF转Excel", "Batch convert, compress, secure, watermark PDFs.");
+            var imageToPDF = new PDFToolsInit();
+            imageToPDF.SetFnType(PDFFnType.ImageToPDF);
+            imageToPDF.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/image.png");
+            imageToPDF.SetContent("图片转PDF", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/pdf-to-ppt.png";
-            AddToolItem(PDFToolType.PDFToPPT, path, "PDF转PPT", "Batch convert, compress, secure, watermark PDFs.");
+            var oCR = new PDFToolsInit();
+            oCR.SetFnType(PDFFnType.OCR);
+            oCR.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/ocr.png");
+            oCR.SetContent("OCR", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/image.png";
-            AddToolItem(PDFToolType.ImageToPDF, path, "图片转PDF", "Batch convert, compress, secure, watermark PDFs.");
+            var waterMark = new PDFToolsInit();
+            waterMark.SetFnType(PDFFnType.WaterMark);
+            waterMark.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/watermark.png");
+            waterMark.SetContent("水印", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/ocr.png";
-            AddToolItem(PDFToolType.OCR, path, "OCR", "Batch convert, compress, secure, watermark PDFs.");
+            var headerFooter = new PDFToolsInit();
+            headerFooter.SetFnType(PDFFnType.HeaderFooter);
+            headerFooter.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/header&footer.png");
+            headerFooter.SetContent("页眉页脚", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/watermark.png";
-            AddToolItem(PDFToolType.WaterMark, path, "水印", "Batch convert, compress, secure, watermark PDFs.");
+            var batesNumbers = new PDFToolsInit();
+            batesNumbers.SetFnType(PDFFnType.BatesNumbers);
+            batesNumbers.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/batesnumbers.png");
+            batesNumbers.SetContent("贝茨Bates码", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/header&footer.png";
-            AddToolItem(PDFToolType.HeaderFooter, path, "页眉页脚", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/batesnumbers.png";
-            AddToolItem(PDFToolType.BatesNumbers, path, "贝茨Bates码", "Batch convert, compress, secure, watermark PDFs.");
+            var batch = new PDFToolsInit();
+            batch.SetFnType(PDFFnType.Batch);
+            batch.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/batch.png");
+            batch.SetContent("批量处理", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/batch.png";
-            AddToolItem(PDFToolType.Batch, path, "批量处理", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/background.png";
-            AddToolItem(PDFToolType.Background, path, "背景", "Batch convert, compress, secure, watermark PDFs.");
+            var background = new PDFToolsInit();
+            background.SetFnType(PDFFnType.Background);
+            background.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/background.png");
+            background.SetContent("背景", "Batch convert, compress, secure, watermark PDFs.");
 
-            path = @"pack://application:,,,/Resources/HomeIcon/PDFTools/compress.png";
-            AddToolItem(PDFToolType.CompareDoc, path, "文件对比", "Batch convert, compress, secure, watermark PDFs.");
 
-           
+            var compareDoc = new PDFToolsInit();
+            compareDoc.SetFnType(PDFFnType.CompareDoc);
+            compareDoc.SetImagePath(@"pack://application:,,,/Resources/HomeIcon/PDFTools/compress.png");
+            compareDoc.SetContent("文件对比", "Batch convert, compress, secure, watermark PDFs.");
+
+            AllTools.Add(split.toolItem);
+            AllTools.Add(extract.toolItem);
+            AllTools.Add(insert.toolItem);
+            AllTools.Add(compress.toolItem);
+            AllTools.Add(merge.toolItem);
+            AllTools.Add(print.toolItem);
+            AllTools.Add(security.toolItem);
+            AllTools.Add(convertPDF.toolItem);
+            AllTools.Add(pDFToWord.toolItem);
+            AllTools.Add(pDFToExcel.toolItem);
+            AllTools.Add(pDFToPPT.toolItem);
+            AllTools.Add(imageToPDF.toolItem);
+            AllTools.Add(oCR.toolItem);
+            AllTools.Add(waterMark.toolItem);
+            AllTools.Add(headerFooter.toolItem);
+            AllTools.Add(batesNumbers.toolItem);
+            AllTools.Add(batch.toolItem);
+            AllTools.Add(background.toolItem);
+            AllTools.Add(compareDoc.toolItem);
         }
 
         private void ContianNewTools()
         {
-            if (Settings.Default.AllPDFToolsList != null)
+            Settings.Default.AllPDFToolsList.Clear();
+            foreach (var item in AllTools)
             {
-                foreach(var item in AllTools)
-                {
-                    Settings.Default.AllPDFToolsList.FirstOrDefault(tool => tool.Tag == item.Tag);
-                }
+                Settings.Default.AllPDFToolsList.Add(item);
             }
+            Settings.Default.Save();
+
         }
 
-        private void AddToolItem(PDFToolType toolType, string imgPath,string title,string titleInfo,int id = 0)
+        /// <summary>
+        /// 快捷工具
+        /// </summary>
+        private void InitQuickTools()
         {
-            ToolItem toolItem = new ToolItem();
-
-            toolItem.Id = id;
-            toolItem.Tag = (int)toolType;
-            toolItem.TagStr = Enum.GetName(typeof(PDFToolType), toolType);
-            toolItem.Image = imgPath;
-            toolItem.Title = title;
-            toolItem.TitleInfo = titleInfo;
-            AllTools.Add(toolItem);
+            var settingQuickToolslist = Settings.Default.QuickPDFToolsList;
+
+            int quickToolCount = 0;
+            if (settingQuickToolslist != null && settingQuickToolslist.Count > 0)
+            {
+                foreach (var item in AllTools)
+                {
+                    if (quickToolCount == 8)
+                        break;
+
+                    var pdfToolItem = settingQuickToolslist.FirstOrDefault(tool => tool.strFnType == item.strFnType);
+                    if (pdfToolItem != null)
+                    {
+                        quickToolCount++;
+                        pdfToolItem.FnType = item.FnType;
+                        QuickTools.Add(pdfToolItem);
+                    }
+                }
+
+                if (quickToolCount < 8 && AllTools.Count > 8)
+                {
+                    var count = 8 - quickToolCount;
+                    for (int i = count - 1; i < count; i++)
+                    {
+                        QuickTools.Add(AllTools[i]);
+                    }
+                }
+            }
+            else
+            {
+                if (settingQuickToolslist == null)
+                    Settings.Default.QuickPDFToolsList = new QuickPDFToolsList();
+
+                QuickTools = AllTools.Take(8).ToList<ToolItem>();
+
+                foreach(var item in QuickTools)
+                {
+                    Settings.Default.QuickPDFToolsList.Add(item);
+                }
+
+                Settings.Default.Save();
+
+            }
+                
+
         }
 
-        private void InitQuickTools()
+        private void InitMoreTools()
         {
-            QuickTools = AllTools.Take(8).ToList<ToolItem>();
+            List<ToolItem> more = new List<ToolItem>();
+            foreach (var item in AllTools)
+            {
+                var pdfToolItem = QuickTools.FirstOrDefault(tool => tool.strFnType == item.strFnType);
+                if (pdfToolItem == null)
+                {
+                    more.Add(item);
+                }
+            }
+
+            MoreTools = more;
         }
     }
 

+ 228 - 0
PDF Office/Helper/RichTextBoxHelper.cs

@@ -0,0 +1,228 @@
+using ComPDFKit.PDFDocument;
+using PDF_Office.Model.BOTA;
+using PDF_Office.Views.BOTA;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Media;
+using System.Windows.Media.TextFormatting;
+
+namespace PDF_Office.Helper
+{
+    public class OutlineSerach { 
+          public string Title { get; set; }
+    }
+    public class RichTextBoxHelper : DependencyObject
+    {
+        public static FlowDocument GetDocumentBind(DependencyObject obj)
+        {
+            return (FlowDocument)obj.GetValue(DocumentBindProperty);
+        }
+        public static void SetDocumentBind(DependencyObject obj, FlowDocument value)
+        {
+            obj.SetValue(DocumentBindProperty, value);
+        }
+        public static FlowDocument GetOutlineSearchDocumentBind(DependencyObject obj)
+        {
+            return (FlowDocument)obj.GetValue(OutlineSearchDocumentBindProperty);
+        }
+        public static string searchWord = "";
+        public static void SetOutlineSearchDocumentBind(DependencyObject obj, FlowDocument value)
+        {
+            obj.SetValue(OutlineSearchDocumentBindProperty, value);
+        }
+
+        public static readonly DependencyProperty DocumentBindProperty =
+            DependencyProperty.RegisterAttached("DocumentBind",
+                typeof(TextBindProperty),
+                typeof(RichTextBoxHelper),
+                new FrameworkPropertyMetadata
+                {
+                    BindsTwoWayByDefault = true,
+                    PropertyChangedCallback = (obj, e) =>
+                    {
+                        RichTextBox richTextBox = obj as RichTextBox;
+                        TextBindProperty bindItem = e.NewValue as TextBindProperty;
+                        if (richTextBox != null && bindItem != null)
+                        {
+                            richTextBox.Document = GetFlowDocument(bindItem.TextContent.Trim(), bindItem.SearchWord, bindItem.HighLightColor);
+                        }
+                    }
+                });
+
+        public static readonly DependencyProperty OutlineSearchDocumentBindProperty =
+            DependencyProperty.RegisterAttached("OutlineSearchDocumentBind",
+                typeof(OutlineNode),
+                typeof(RichTextBoxHelper),
+                new FrameworkPropertyMetadata
+                {
+                    BindsTwoWayByDefault = false,
+                    PropertyChangedCallback = (obj, e) =>
+                    {
+                        RichTextBox richTextBox = obj as RichTextBox;
+                        OutlineNode bindItem = e.NewValue as OutlineNode;
+                       
+                        if (richTextBox != null )
+                        {
+                           // richTextBox.Document = GetOutlineFlowDocument(bindItem.outline.Title, searchWord, Color.FromArgb(0x99, 0xFF, 0xF7, 0x00));
+                           /* if (richTextBox.Document.Name!="nodata") {
+                                richTextBox.Visibility = Visibility.Collapsed;
+                            }*/
+                        }
+                    }
+                });
+        public static FlowDocument GetOutlineFlowDocument(string content, string keyword, Color textColor)
+        {
+            FlowDocument Document = new FlowDocument();
+            Paragraph textPara = new Paragraph();
+            Document.Blocks.Add(textPara);
+            List<int> indexList = new List<int>();
+            content = Regex.Replace(content, "[\r\n]", " ");
+            if (keyword.Length > 0)
+            {
+                for (int i = 0; i < content.Length && i >= 0;)
+                {
+                    i = content.IndexOf(keyword, i, StringComparison.OrdinalIgnoreCase);
+                    if (i == -1)
+                    {
+                        break;
+                    }
+                    if (indexList.Contains(i) == false)
+                    {
+                        indexList.Add(i);
+                    }
+                    i += keyword.Length;
+                }
+            }
+            List<string> splitList = new List<string>();
+            int lastIndex = -1;
+            foreach (int index in indexList)
+            {
+                string prevStr = string.Empty;
+                if (lastIndex == -1)
+                {
+                    prevStr = content.Substring(0, index);
+                    //Document.Name = "nodata";
+                }
+                else
+                {
+                    prevStr = content.Substring(lastIndex + keyword.Length, index - lastIndex - 1);
+                }
+                if (prevStr != string.Empty)
+                {
+                    splitList.Add(prevStr);
+                }
+
+                splitList.Add(content.Substring(index, keyword.Length));
+                lastIndex = index;
+            }
+            if (indexList.Count > 0)
+            {
+                lastIndex = indexList[indexList.Count - 1];
+                if (content.Length > lastIndex + keyword.Length)
+                {
+                    splitList.Add(content.Substring(lastIndex + keyword.Length));
+                }
+            }
+            TextBlock addBlock = new TextBlock();
+            if (splitList.Count == 0)
+            {
+                Run textRun = new Run(content);
+                addBlock.Inlines.Add(textRun);
+            }
+            else
+            {
+                foreach (string textappend in splitList)
+                {
+                    Run textRun = new Run(textappend);
+                    if (textappend.Equals(keyword, StringComparison.OrdinalIgnoreCase))
+                    {
+                        textRun.Background = new SolidColorBrush(textColor);
+                    }
+                    addBlock.Inlines.Add(textRun);
+                }
+            }
+            addBlock.TextTrimming = TextTrimming.CharacterEllipsis;
+            textPara.Inlines.Add(addBlock);
+
+            return Document;
+        }
+
+        public static FlowDocument GetFlowDocument(string content, string keyword, Color textColor)
+        {
+            FlowDocument Document = new FlowDocument();
+            Paragraph textPara = new Paragraph();
+            Document.Blocks.Add(textPara);
+            List<int> indexList = new List<int>();
+            content = Regex.Replace(content, "[\r\n]", " ");
+            if (keyword.Length > 0)
+            {
+                for (int i = 0; i < content.Length && i >= 0;)
+                {
+                    i = content.IndexOf(keyword, i, StringComparison.OrdinalIgnoreCase);
+                    if (i == -1)
+                    {
+                        break;
+                    }
+                    if (indexList.Contains(i) == false)
+                    {
+                        indexList.Add(i);
+                    }
+                    i += keyword.Length;
+                }
+            }
+            List<string> splitList = new List<string>();
+            int lastIndex = -1;
+            foreach (int index in indexList)
+            {
+                string prevStr = string.Empty;
+                if (lastIndex == -1)
+                {
+                    prevStr = content.Substring(0, index);
+                }
+                else
+                {
+                    prevStr = content.Substring(lastIndex + keyword.Length, index - lastIndex - 1);
+                }
+                if (prevStr != string.Empty)
+                {
+                    splitList.Add(prevStr);
+                }
+
+                splitList.Add(content.Substring(index, keyword.Length));
+                lastIndex = index;
+            }
+            if (indexList.Count > 0)
+            {
+                lastIndex = indexList[indexList.Count - 1];
+                if (content.Length > lastIndex + keyword.Length)
+                {
+                    splitList.Add(content.Substring(lastIndex + keyword.Length));
+                }
+            }
+            TextBlock addBlock = new TextBlock();
+            foreach (string textappend in splitList)
+            {
+                Run textRun = new Run(textappend);
+                if (textappend.Equals(keyword, StringComparison.OrdinalIgnoreCase))
+                {
+                    textRun.Background = new SolidColorBrush(textColor);
+                }
+                addBlock.Inlines.Add(textRun);
+                }
+            addBlock.TextTrimming = TextTrimming.CharacterEllipsis;
+            textPara.Inlines.Add(addBlock);
+
+            return Document;
+        }
+
+    }
+}

+ 124 - 0
PDF Office/Model/AnnotPanel/Stamp.cs

@@ -0,0 +1,124 @@
+using ComPDFKitViewer.AnnotEvent;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.Model.AnnotPanel
+{
+    public class Stamp : BindableBase
+    {
+        private string stampText;
+
+        public string StampText
+        {
+            get { return stampText; }
+            set
+            {
+                SetProperty(ref stampText, value);
+            }
+        }
+
+        private string sourcePath;
+
+        public string SourcePath
+        {
+            get { return sourcePath; }
+            set
+            {
+                SetProperty(ref sourcePath, value);
+            }
+        }
+
+        private int maxWidth;
+
+        public int MaxWidth
+        {
+            get { return maxWidth; }
+            set
+            {
+                SetProperty(ref maxWidth, value);
+            }
+        }
+
+        private int maxHeight;
+
+        public int MaxHeight
+        {
+            get { return maxHeight; }
+            set
+            {
+                SetProperty(ref maxHeight, value);
+            }
+        }
+
+        private StampType type;
+
+        public StampType Type
+        {
+            get { return type; }
+            set
+            {
+                SetProperty(ref type, value);
+            }
+        }
+
+        private string author;
+
+        public string Author
+        {
+            get { return author; }
+            set
+            {
+                SetProperty(ref author, value);
+            }
+        }
+        private double opacity;
+
+        public double Opacity
+        {
+            get { return opacity; }
+            set
+            {
+                SetProperty(ref opacity, value);
+            }
+        }
+
+        private BitmapSource imageSource;
+
+        public BitmapSource ImageSource
+        {
+            get { return imageSource; }
+            set
+            {
+                SetProperty(ref imageSource, value);
+            }
+        }
+
+        private TextStampColor textColor;
+
+        public TextStampColor TextColor
+        {
+            get { return textColor; }
+            set
+            {
+                SetProperty(ref textColor, value);
+            }
+        }
+
+        private string stampTextDate;
+
+        public string StampTextDate
+        {
+            get { return stampTextDate; }
+            set
+            {
+                SetProperty(ref stampTextDate, value);
+            }
+        }
+
+    }
+}

+ 200 - 0
PDF Office/Model/BOTA/OutlineNode.cs

@@ -0,0 +1,200 @@
+using ComPDFKit.PDFDocument;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.Model.BOTA
+{
+    public class OutlineNode : BindableBase
+    {
+        /// <summary>
+        /// 父类大纲
+        /// </summary>
+        private OutlineNode parent = null;
+
+        public OutlineNode Parent
+        {
+            get { return parent; }
+            set
+            {
+                SetProperty(ref parent, value);
+            }
+        }
+        /// <summary>
+        /// 当前大纲对象
+        /// </summary>
+        private CPDFOutline outline = null;
+
+        public CPDFOutline Outline
+        {
+            get { return outline; }
+            set
+            {
+                SetProperty(ref outline, value);
+            }
+        }
+
+        /// <summary>
+        /// 子类大纲集合
+        /// </summary>
+        private ObservableCollection<OutlineNode> chlidlist = new ObservableCollection<OutlineNode>();
+
+        public ObservableCollection<OutlineNode> Chlidlist
+        {
+            get { return chlidlist; }
+            set
+            {
+                SetProperty(ref chlidlist, value);
+            }
+        }
+
+        /// <summary>
+        /// 控制虚线的显示
+        /// </summary>
+        private bool isInsertNextLayer = false;
+
+        public bool IsInsertNextLayer
+        {
+            get { return isInsertNextLayer; }
+            set
+            {
+                SetProperty(ref isInsertNextLayer, value);
+            }
+        }
+
+        /// <summary>
+        /// 控制实线的显示
+        /// </summary>
+        private bool isInsertCurrentLayer = false;
+
+        public bool IsInsertCurrentLayer
+        {
+            get { return isInsertCurrentLayer; }
+            set
+            {
+                SetProperty(ref isInsertCurrentLayer, value);
+            }
+        }
+
+        /// <summary>
+        /// 当前节点展开状态
+        /// </summary>
+        private bool isExpanded = false;
+
+        public bool IsExpanded
+        {
+            get { return isExpanded; }
+            set
+            {
+                SetProperty(ref isExpanded, value);
+            }
+        }
+
+        private bool isSelected;
+
+        public bool IsSelected
+        {
+            get { return isSelected; }
+            set
+            {
+                SetProperty(ref isSelected, value);
+            }
+        }
+
+        private bool canDown = true;
+
+        public bool CanDown
+        {
+            get { return canDown; }
+            set
+            {
+                SetProperty(ref canDown, value);
+            }
+        }
+
+        private bool canUp = true;
+
+        public bool CanUp
+        {
+            get { return canUp; }
+            set
+            {
+                SetProperty(ref canUp, value);
+            }
+        }
+
+        private bool canAddParent = true;
+
+        public bool CanAddParent
+        {
+            get { return canAddParent; }
+            set
+            {
+                SetProperty(ref canAddParent, value);
+            }
+        }
+
+        private Visibility isReName=Visibility.Visible;
+
+        public Visibility IsReName
+        {
+            get { return isReName; }
+            set
+            {
+                SetProperty(ref isReName, value);
+            }
+        }
+
+
+
+        private string pageIndex = "";
+
+        public string PageIndex
+        {
+            get { return pageIndex; }
+            set
+            {
+                SetProperty(ref pageIndex, value);
+            }
+        }
+
+        private double positionX;
+
+        public double PositionX
+        {
+            get { return positionX; }
+            set
+            {
+                SetProperty(ref positionX, value);
+            }
+        }
+
+        private double positionY;
+
+        public double PositionY
+        {
+            get { return positionY; }
+            set
+            {
+                SetProperty(ref positionY, value);
+            }
+        }
+
+        private double zoom;
+
+        public double Zoom
+        {
+            get { return zoom; }
+            set
+            {
+                SetProperty(ref zoom, value);
+            }
+        }
+
+    }
+}

+ 0 - 1
PDF Office/Model/CloudDrive/CloudDriveItem.cs

@@ -16,7 +16,6 @@ namespace PDF_Office.Model.CloudDrive
         OneDrive
     }
 
-
     public class CloudBoxItem
     {
         public CloudType CloudDiskType { get; set; }

+ 51 - 12
PDF Office/Model/CloudDrive/CloudFiles.cs

@@ -33,7 +33,7 @@ namespace PDF_Office.Model.CloudDrive
         }
     }
 
-    #region 公有云盘
+    #region 云盘基类
 
     /// <summary>
     /// 用户信息
@@ -47,6 +47,13 @@ namespace PDF_Office.Model.CloudDrive
         public string UserAccount { get; set; }
     }
 
+    public class FolderBaseItem
+    {
+        public FileOperation Operation { get; set; }
+        public int Level { get; set; }
+        public string FolderName { get; set; }
+    }
+
     /// <summary>
     /// 用户云盘
     /// </summary>
@@ -56,36 +63,68 @@ namespace PDF_Office.Model.CloudDrive
         public CloudType cloudType { get; set; }
     }
 
+    public class FilesBaseItem
+    {
+        public string Id { get; set; }
+        public bool IsFolder { get; set; }
+        public int Level { get; set; }
+        public string Name { get; set; }
+        public string MimeType { get; set; }
+        public long? Size { get; set; }
+        public DateTime? CreatedTime { get; set; }
+    }
+
     #endregion
 
     #region GooglrDrive
+    //文件夹
+    public class GoogleDriveFolder: FolderBaseItem
+    {
+     
+        
+    }
+
 
     /// <summary>
     /// 谷歌云盘的文件
     /// </summary>
-    public class GoogleDriveFiles
+    public class GoogleDriveFiles: FilesBaseItem
     {
-        public string Id { get; set; }
-        public string Name { get; set; }
-        public long? Size { get; set; }
         public long? Version { get; set; }
-        public DateTime? CreatedTime { get; set; }
     }
 
     #endregion
 
 
-    #region GooglrDrive
+    #region DropbBox
 
     /// <summary>
     /// 谷歌云盘的文件
     /// </summary>
-    public class DropbBoxFiles
+    public class DropbBoxFiles : FilesBaseItem
     {
-        public string Id { get; set; }
-        public string Name { get; set; }
-        public long? Size { get; set; }
-        public DateTime? CreatedTime { get; set; }
+        public string PathDisplay { get; set; }
+    }
+    public class DropbBoxFolder : FolderBaseItem
+    {
+
+
+    }
+
+    /// <summary>
+    /// 指定某云盘某用户,对文件的操作
+    /// </summary>
+    public class FileOperation
+    {
+        public string SourceFileName { get; set; }
+        public string SourceFile { get; set; }
+        public UserBaseItem User { get; set; }
+        public FilesBaseItem DoFile { get; set; }
+        public FileOperation(UserBaseItem user, FilesBaseItem doFile)
+        {
+            User = user;
+            DoFile = doFile;
+        }
     }
 
     #endregion

+ 10 - 0
PDF Office/Model/DialogNames.cs

@@ -111,6 +111,16 @@ namespace PDF_Office.Model
         /// </summary>
         public static string HomePageBatchProcessingDialog = "HomePageBatchProcessingDialog";
 
+        /// <summary>
+        /// 注释-图章-动态图章设置弹窗
+        /// </summary>
+        public static string DynamicPropertyDialog = "DynamicPropertyDialog";
+
+        /// <summary>
+        /// 注释-图章-自定义图章创建弹窗
+        /// </summary>
+        public static string CustomCreateDialog = "CustomCreateDialog";
+
         ///<summary>
         ///转档-CSVD,PPT,Text,Word,HTML,Img,RTF,Excel弹窗
         /// </summary>

+ 6 - 2
PDF Office/Model/PDFTool/ToolItem.cs

@@ -2,21 +2,25 @@
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
 namespace PDF_Office.Model.PDFTool
 {
-    public class ToolItem1 : BindableBase
+    public class ToolItem1 : INotifyPropertyChanged
     {
+        public event PropertyChangedEventHandler PropertyChanged = delegate { };
+
         private bool _isShowConciseContent = false;
         public bool IsShowConciseContent
         {
             get { return _isShowConciseContent; }
             set
             {
-                SetProperty(ref _isShowConciseContent, value);
+                _isShowConciseContent = value;
+                PropertyChanged(this, new PropertyChangedEventArgs("IsShowConciseContent"));
             }
         }
         public bool IsNewTool { get; set; }

+ 79 - 0
PDF Office/Model/PageEdit/PageEditHistory.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace PDF_Office.Model.PageEdit
+{
+    public class PageEditHistory
+    {
+        /// <summary>
+        /// 操作类型
+        /// </summary>
+        public ActionType Type { get; set; }
+
+        /// <summary>
+        /// 原位置-新位置集合  用于倒序、旋转、拖拽排序
+        /// </summary>
+        public Dictionary<int, int> SourceTargetValue { get; set; }
+
+        /// <summary>
+        /// 插入位置
+        /// </summary>
+        public int InsertIndex { get; set; }
+
+        /// <summary>
+        ///插入文件的文件路径
+        /// </summary>
+        public string InsertFilePath { get; set; }
+
+        /// <summary>
+        /// 插入文件的密码
+        /// </summary>
+        public string InsertFilePassWord { get; set; }
+
+        /// <summary>
+        /// 插入文档的页面总数
+        /// </summary>
+        public int InsertPageCount { get; set; }
+
+        /// <summary>
+        /// 插入的页面尺寸大小
+        /// </summary>
+        public Size PageSize { get; set; }
+    }
+
+    /// <summary>
+    /// 操作类型
+    /// </summary>
+    public enum ActionType
+    {
+        /// <summary>
+        /// 页面右旋转
+        /// </summary>
+        RightRotate,
+        /// <summary>
+        /// 页面左旋转
+        /// </summary>
+        LeftRotate,
+        /// <summary>
+        /// 从文件插入
+        /// </summary>
+        InsertFromFile,
+        /// <summary>
+        /// 插入自定义页面
+        /// </summary>
+        InsertCustomPages,
+        /// <summary>
+        /// 拖拽排序
+        /// </summary>
+        DragSort,
+        /// <summary>
+        /// 倒序
+        /// </summary>
+        Reverse
+
+    }
+}

+ 1 - 0
PDF Office/Model/PageEdit/PageEditItem.cs

@@ -100,6 +100,7 @@ namespace PDF_Office.Model.PageEdit
         private bool selected = false; 
         /// <summary>
         /// 是否选中
+        /// 用于获取项的选中状态
         /// </summary>
         public bool Selected
         {

+ 18 - 0
PDF Office/Model/PageEdit/PageItemUnits.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.Model.PageEdit
+{
+    /// <summary>
+    /// 页面编辑 页面宽高单位 mm cm in
+    /// </summary>
+    public enum PageItemUnits
+    {
+       MM,
+       CM,
+       IN
+    }
+}

+ 20 - 0
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace PDF_Office.Model.PropertyPanel.AnnotPanel
+{
+    public class FontStyleItem
+    {
+        public string mFontStyleName { get; set; }
+        public int mFontSize { get; set; }
+        public FontFamily mFontFamily { get; set; }
+        public FontStyle mFontStyle { get; set; }
+        public FontWeight mFontWeight { get; set; }
+
+    }
+}

+ 95 - 14
PDF Office/PDF Office.csproj

@@ -199,6 +199,7 @@
       <DependentUpon>CommonWritableComboBox.xaml</DependentUpon>
     </Compile>
     <Compile Include="CustomControl\CustomIconToggleBtn.cs" />
+    <Compile Include="CustomControl\CustomImageControl.cs" />
     <Compile Include="CustomControl\DialogContent.cs" />
     <Compile Include="CustomControl\IconAndTextTabItem.cs" />
     <Compile Include="CustomControl\ListBoxItemToolBar.cs" />
@@ -209,6 +210,7 @@
     <Compile Include="CustomControl\PageTurningPreview.xaml.cs">
       <DependentUpon>PageTurningPreview.xaml</DependentUpon>
     </Compile>
+    <Compile Include="CustomControl\PathButton.cs" />
     <Compile Include="CustomControl\SystemControl\CustomCommandAction .cs" />
     <Compile Include="CustomControl\SystemControl\RoutedEventTrigger.cs" />
     <Compile Include="CustomControl\ToastControl.xaml.cs">
@@ -230,20 +232,26 @@
     <Compile Include="DataConvert\StringToDateConvert.cs" />
     <Compile Include="DataConvert\StringToVisibleConvert.cs" />
     <Compile Include="DataConvert\UnVisivleConvert.cs" />
+    <Compile Include="DataConvert\WidthConvert.cs" />
     <Compile Include="EventAggregators\EditToolsEvent.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="Helper\CacheFilePath.cs" />
     <Compile Include="Helper\ConverterHelper.cs" />
     <Compile Include="Helper\AdvancedInvokeCommandAction.cs" />
     <Compile Include="Helper\ArrowHelper.cs" />
+    <Compile Include="Helper\DragDropHelper.cs" />
     <Compile Include="Helper\HomePageEditHelper.cs" />
     <Compile Include="Helper\PasswordBoxHelper.cs" />
+    <Compile Include="Helper\RichTextBoxHelper.cs" />
     <Compile Include="Helper\SDKLisenceHelper.cs" />
     <Compile Include="Helper\PictureConverter.cs" />
     <Compile Include="Helper\SetterAction.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
     <Compile Include="Model\BOTA\AnnotationHandlerEventArgs.cs" />
+    <Compile Include="Model\AnnotPanel\Stamp.cs" />
+    <Compile Include="Model\BOTA\OutlineNode.cs" />
     <Compile Include="Model\CloudDrive\CloudDriveItem.cs" />
     <Compile Include="Model\CloudDrive\CloudFiles.cs" />
     <Compile Include="Model\DialogNames.cs" />
@@ -284,9 +292,12 @@
     <Compile Include="Model\PageEdit\CustomInsertModel.cs" />
     <Compile Include="Model\PageEdit\CustomPageItem.cs" />
     <Compile Include="Model\PageEdit\ExtractModel.cs" />
+    <Compile Include="Model\PageEdit\PageEditHistory.cs" />
     <Compile Include="Model\PageEdit\PageEditItem.cs" />
+    <Compile Include="Model\PageEdit\PageItemUnits.cs" />
     <Compile Include="Model\ParameterNames.cs" />
     <Compile Include="Model\PDFTool\ToolItem.cs" />
+    <Compile Include="Model\PropertyPanel\AnnotPanel\FontStyleItem.cs" />
     <Compile Include="Model\RegionNames.cs" />
     <Compile Include="CustomControl\SystemControl\TabablzRegionBehavior.cs" />
     <Compile Include="DataConvert\BoolToVisible.cs" />
@@ -304,6 +315,8 @@
     <Compile Include="ViewModels\BOTA\AnnotationListItemViewModel.cs" />
     <Compile Include="ViewModels\BOTA\BookmarkContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\AddAnnotationDialogViewModel.cs" />
+    <Compile Include="ViewModels\BOTA\OutLineControlViewModel.cs" />
+    <Compile Include="ViewModels\BOTA\SearchContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\AddBookmarkDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\BookmarkInfoDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\BOTA\ScreenAnnotationDialogViewModel.cs" />
@@ -332,6 +345,9 @@
     <Compile Include="ViewModels\EditTools\Background\BackgroundTemplateListFileContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\AnnotPanel\CustomCreateDialogViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\AnnotPanel\DynamicPropertyDialogViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
@@ -381,7 +397,6 @@
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SharpsAnnotPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\StampAnnotPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\TextAnnotPropertyViewModel.cs" />
-    <Compile Include="ViewModels\PropertyPanel\AnnotPanel\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PropertyPanelContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadModeContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\SplitScreenContentViewModel.cs" />
@@ -390,6 +405,7 @@
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.Function.cs" />
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.Properties.cs" />
+    <Compile Include="ViewModels\Tools\TextEditToolContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ToolsBarContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Watermark\WatermarkCreateBaseContentViewModel.cs" />
@@ -410,6 +426,12 @@
     <Compile Include="Views\BOTA\BOTAContent.xaml.cs">
       <DependentUpon>BOTAContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\BOTA\OutLineControl.xaml.cs">
+      <DependentUpon>OutLineControl.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\BOTA\SearchContent.xaml.cs">
+      <DependentUpon>SearchContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\BottomToolContent.xaml.cs">
       <DependentUpon>BottomToolContent.xaml</DependentUpon>
     </Compile>
@@ -639,6 +661,12 @@
     <Compile Include="CustomControl\CompositeControl\SlidContentPop.xaml.cs">
       <DependentUpon>SlidContentPop.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\AnnotPanel\CustomCreateDialog.xaml.cs">
+      <DependentUpon>CustomCreateDialog.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\PropertyPanel\AnnotPanel\DynamicPropertyDialog.xaml.cs">
+      <DependentUpon>DynamicPropertyDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\AnnotPanel\FreehandAnnotProperty.xaml.cs">
       <DependentUpon>FreehandAnnotProperty.xaml</DependentUpon>
     </Compile>
@@ -660,15 +688,15 @@
     <Compile Include="Views\PropertyPanel\AnnotPanel\TextAnnotProperty.xaml.cs">
       <DependentUpon>TextAnnotProperty.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\PropertyPanel\AnnotPanel\TextEditProperty.xaml.cs">
-      <DependentUpon>TextEditProperty.xaml</DependentUpon>
-    </Compile>
     <Compile Include="CustomControl\CompositeControl\SlidContent.xaml.cs">
       <DependentUpon>SlidContent.xaml</DependentUpon>
     </Compile>
     <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
       <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\TextEditProperty.xaml.cs">
+      <DependentUpon>TextEditProperty.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml.cs">
       <DependentUpon>ReadModeContent.xaml</DependentUpon>
     </Compile>
@@ -690,6 +718,9 @@
     <Compile Include="Views\Tools\ConverterBarContent.xaml.cs">
       <DependentUpon>ConverterBarContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\Tools\TextEditToolContent.xaml.cs">
+      <DependentUpon>TextEditToolContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\Tools\ToolsBarContent.xaml.cs">
       <DependentUpon>ToolsBarContent.xaml</DependentUpon>
     </Compile>
@@ -772,6 +803,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\OutLineItemStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Styles\PathButtonStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\RadioButtonStyle.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -820,6 +859,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\BOTA\OutLineControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\BOTA\SearchContent.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\BottomToolContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1011,6 +1058,14 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\PropertyPanel\AnnotPanel\CustomCreateDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Views\PropertyPanel\AnnotPanel\DynamicPropertyDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\AnnotPanel\FreehandAnnotProperty.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1071,10 +1126,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\PropertyPanel\AnnotPanel\TextEditProperty.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Views\EditTools\Watermark\WatermarkTemplateListBaseContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1097,6 +1148,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\TextEditProperty.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1211,6 +1266,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\Tools\TextEditToolContent.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\Tools\ToolsBarContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1280,15 +1339,37 @@
     <Resource Include="Resources\HomeIcon\PDFTools\security.png" />
     <Resource Include="Resources\HomeIcon\PDFTools\split.png" />
     <Resource Include="Resources\HomeIcon\PDFTools\watermark.png" />
-    <Resource Include="Resources\PageEdit\GridLine.png">
+    <Resource Include="Resources\StampIcons\Accepted.png" />
+    <Resource Include="Resources\StampIcons\Approved.png" />
+    <Resource Include="Resources\StampIcons\Completed.png" />
+    <Resource Include="Resources\StampIcons\Confidential.png" />
+    <Resource Include="Resources\StampIcons\Draft.png" />
+    <Resource Include="Resources\StampIcons\Empty_stamp.png" />
+    <Resource Include="Resources\StampIcons\Final.png" />
+    <Resource Include="Resources\StampIcons\ForComment.png" />
+    <Resource Include="Resources\StampIcons\ForPublicRelease.png" />
+    <Resource Include="Resources\StampIcons\InformationOnly.png" />
+    <Resource Include="Resources\StampIcons\InitialHere.png" />
+    <Resource Include="Resources\StampIcons\NotApproved.png" />
+    <Resource Include="Resources\StampIcons\NotForPublicRelease.png" />
+    <Resource Include="Resources\StampIcons\PreliminaryResults.png" />
+    <Resource Include="Resources\StampIcons\PrivateMark1.png" />
+    <Resource Include="Resources\StampIcons\PrivateMark2.png" />
+    <Resource Include="Resources\StampIcons\PrivateMark3.png" />
+    <Resource Include="Resources\StampIcons\Rejected.png" />
+    <Resource Include="Resources\StampIcons\revised.png" />
+    <Resource Include="Resources\StampIcons\SignHere.png" />
+    <Resource Include="Resources\StampIcons\Void.png" />
+    <Resource Include="Resources\StampIcons\Witness.png" />
+    <Content Include="Resources\PageEdit\GridLine.jpg">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Resource>
-    <Resource Include="Resources\PageEdit\HorizontalLine.png">
+    </Content>
+    <Content Include="Resources\PageEdit\HorizontalLine.jpg">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Resource>
-    <Resource Include="Resources\PageEdit\Staff.png">
+    </Content>
+    <Content Include="Resources\PageEdit\Staff.jpg">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Resource>
+    </Content>
     <Content Include="source\AnalysisWord\Res\_rels\.rels">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>

PDF Office/Resources/PageEdit/GridLine.png → PDF Office/Resources/PageEdit/GridLine.jpg


PDF Office/Resources/PageEdit/HorizontalLine.png → PDF Office/Resources/PageEdit/HorizontalLine.jpg


PDF Office/Resources/PageEdit/Staff.png → PDF Office/Resources/PageEdit/Staff.jpg


BIN
PDF Office/Resources/StampIcons/Accepted.png


BIN
PDF Office/Resources/StampIcons/Approved.png


BIN
PDF Office/Resources/StampIcons/Completed.png


BIN
PDF Office/Resources/StampIcons/Confidential.png


BIN
PDF Office/Resources/StampIcons/Draft.png


BIN
PDF Office/Resources/StampIcons/Empty_stamp.png


BIN
PDF Office/Resources/StampIcons/Final.png


BIN
PDF Office/Resources/StampIcons/ForComment.png


BIN
PDF Office/Resources/StampIcons/ForPublicRelease.png


BIN
PDF Office/Resources/StampIcons/InformationOnly.png


BIN
PDF Office/Resources/StampIcons/InitialHere.png


BIN
PDF Office/Resources/StampIcons/NotApproved.png


BIN
PDF Office/Resources/StampIcons/NotForPublicRelease.png


BIN
PDF Office/Resources/StampIcons/PreliminaryResults.png


BIN
PDF Office/Resources/StampIcons/PrivateMark1.png


BIN
PDF Office/Resources/StampIcons/PrivateMark2.png


BIN
PDF Office/Resources/StampIcons/PrivateMark3.png


BIN
PDF Office/Resources/StampIcons/Rejected.png


BIN
PDF Office/Resources/StampIcons/SignHere.png


BIN
PDF Office/Resources/StampIcons/Void.png


BIN
PDF Office/Resources/StampIcons/Witness.png


BIN
PDF Office/Resources/StampIcons/revised.png


+ 11 - 5
PDF Office/Styles/CustomListItemStyle.xaml

@@ -45,10 +45,13 @@
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
                     <Border x:Name="Border"
-                                Margin="0,0,0,30"
-                               
-                                Background="AliceBlue"
+                                Margin="0,0,0,16"
+                                BorderThickness="1" 
+                                Background="Transparent"
                                 SnapsToDevicePixels="true">
+                        <Border.BorderBrush>
+                            <SolidColorBrush Color="#000000" Opacity="0.05"/>
+                        </Border.BorderBrush>
                         <ContentPresenter />
                     </Border>
                     <ControlTemplate.Triggers>
@@ -80,9 +83,12 @@
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type customControl:ListItemQuickTool}">
-                    <Border x:Name="Border"  Margin="0,0,0,30"
-                                Background="LightGray"
+                    <Border x:Name="Border" CornerRadius="4" Margin="0,0,0,16" BorderThickness="1" 
+                                Background="Transparent"
                                 SnapsToDevicePixels="False">
+                        <Border.BorderBrush>
+                            <SolidColorBrush Color="#000000" Opacity="0.05"/>
+                        </Border.BorderBrush>
                         <ContentPresenter />
                     </Border>
                     <ControlTemplate.Triggers>

File diff suppressed because it is too large
+ 160 - 0
PDF Office/Styles/OutLineItemStyle.xaml


+ 128 - 0
PDF Office/Styles/PathButtonStyle.xaml

@@ -0,0 +1,128 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
+                    >
+    <Style TargetType="{x:Type customControl:PathButton}">
+        <Setter Property="IconOpacity" Value="1" />
+        <Setter Property="IconMouseOverOpacity" Value="1" />
+        <Setter Property="IconPressOpacity" Value="1" />
+        <Setter Property="IconCheckedOpacity" Value="1" />
+        <Setter Property="IsChecked" Value="false" />
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type customControl:PathButton}">
+
+                    <Border
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}">
+                        <Grid x:Name="grid" Background="{TemplateBinding Background}">
+                            <Border
+                                x:Name="PART_Border"
+                                Background="{TemplateBinding Background}"
+                                BorderBrush="{TemplateBinding BorderBrush}"
+                                BorderThickness="{TemplateBinding BorderThickness}"
+                                CornerRadius="{TemplateBinding CornerRadius}" />
+
+                            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
+                                <StackPanel
+                                    Margin="{TemplateBinding Padding}"
+                                    HorizontalAlignment="Center"
+                                    VerticalAlignment="Center"
+                                    Orientation="{TemplateBinding IconContentOrientation}">
+                                    <Grid HorizontalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
+                                        <Path
+                                            x:Name="PART_Icon"
+                                            Width="{TemplateBinding IconWidth}"
+                                            Height="{TemplateBinding IconHeight}"
+                                            Data="{TemplateBinding Icon}"
+                                            Fill="{TemplateBinding IconFill}"
+                                            Opacity="{TemplateBinding IconOpacity}" />
+                                        <Path
+                                            x:Name="PART_MouseOverIcon"
+                                            Width="{TemplateBinding IconWidth}"
+                                            Height="{TemplateBinding IconHeight}"
+                                            Data="{TemplateBinding IconMouseOver}"
+                                            Fill="{TemplateBinding IconMouseOverFill}"
+                                            Opacity="{TemplateBinding IconMouseOverOpacity}"
+                                            Visibility="Collapsed" />
+                                        <Path
+                                            x:Name="PART_PressIcon"
+                                            Width="{TemplateBinding IconWidth}"
+                                            Height="{TemplateBinding IconHeight}"
+                                            Data="{TemplateBinding IconPress}"
+                                            Fill="{TemplateBinding IconPressFill}"
+                                            Opacity="{TemplateBinding IconPressOpacity}"
+                                            Visibility="Collapsed" />
+                                        <Path
+                                            x:Name="PART_CheckedIcon"
+                                            Width="{TemplateBinding IconWidth}"
+                                            Height="{TemplateBinding IconHeight}"
+                                            Data="{TemplateBinding IconChecked}"
+                                            Fill="{TemplateBinding IconCheckedFill}"
+                                            Opacity="{TemplateBinding IconCheckedOpacity}"
+                                            Visibility="Collapsed" />
+                                    </Grid>
+                                    <TextBlock
+                                        x:Name="PART_Content"
+                                        Margin="{TemplateBinding IconContentMargin}"
+                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                        Foreground="{TemplateBinding Foreground}"
+                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
+                                        Text="{TemplateBinding Content}"
+                                        TextTrimming="CharacterEllipsis" />
+                                </StackPanel>
+                            </Grid>
+                        </Grid>
+                    </Border>
+
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Visible" />
+                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+
+                        <Trigger Property="IsPressed" Value="True">
+                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseDownForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseDownBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseDownBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Visible" />
+                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+
+                        <Trigger Property="IsEnabled" Value="False">
+                            <Setter Property="Opacity" Value="0.5" />
+                        </Trigger>
+
+                        <Trigger Property="IsChecked" Value="True">
+                            <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathButton}}}" />
+                            <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
+                        </Trigger>
+
+                        <Trigger SourceName="PART_Content" Property="Text" Value="">
+                            <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+
+                        <Trigger SourceName="PART_Content" Property="Text" Value="{x:Null}">
+                            <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

+ 45 - 0
PDF Office/Styles/RadioButtonStyle.xaml

@@ -259,4 +259,49 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <!--悬浮灰色背景单选按钮-->
+    <Style x:Key="GreyBgRadioBtnStyle" TargetType="{x:Type RadioButton}">
+        <Setter Property="BorderThickness" Value="1"/>
+        <Setter Property="Foreground" Value="#252629"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type RadioButton}">
+                    <Border x:Name="templateRoot" Background="{TemplateBinding Background}"  CornerRadius="4" SnapsToDevicePixels="True">
+
+                            <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="HasContent" Value="true">
+                            <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
+                            <Setter Property="Padding" Value="4,-1,0,0"/>
+                        </Trigger>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" TargetName="templateRoot" Value="#EDEEF0"/>
+
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="false">
+
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="true">
+
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="true">
+                            <Setter Property="Background" TargetName="templateRoot">
+                                <Setter.Value>
+                                    <SolidColorBrush Color="#CED0D4" Opacity="0.6"/>
+                                </Setter.Value>
+                            </Setter>
+                            <Setter Property="BorderBrush" TargetName="templateRoot" Value="#CED0D4"/>
+                            <Setter Property="Foreground" Value="#616469"/>
+                            <Setter Property="BorderThickness" TargetName="templateRoot" Value="1"/>
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="{x:Null}">
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

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

@@ -65,10 +65,10 @@ namespace PDF_Office.ViewModels.BOTA
         {
             //绑定tabitem名字和对应的View控件名称
             viewNameByTabItem.Add("TabItemThumbnail", "PageEditContent");
-            viewNameByTabItem.Add("TabItemOutLine", "");
+            viewNameByTabItem.Add("TabItemOutLine", "OutLineControl");
             viewNameByTabItem.Add("TabItemBookMark", "BookmarkContent");
-            viewNameByTabItem.Add("TabItemAnnotation", "AnnotationContent");
-            viewNameByTabItem.Add("TabItemSearch", "");
+            viewNameByTabItem.Add("TabItemAnnotation", "");
+            viewNameByTabItem.Add("TabItemSearch", "SearchContent");
             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);
         }

+ 456 - 0
PDF Office/ViewModels/BOTA/OutLineControlViewModel.cs

@@ -0,0 +1,456 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFDocument.Action;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
+using Prism.Commands;
+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;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.ViewModels.BOTA
+{
+    class OutLineControlViewModel : BindableBase, INavigationAware
+    {
+        //缩略图相关全局变量,减少内存申请次数
+        private WriteableBitmap WirteBitmap;
+        private byte[] bmpData;
+
+        private CPDFViewer PDFViewer;
+
+        public ObservableCollection<OutlineNode> Outlinelist { get; set; }
+
+        private bool isInsertHead = false;
+
+        public bool IsInsertHead
+        {
+            get { return isInsertHead; }
+            set
+            {
+                SetProperty(ref isInsertHead, value);
+            }
+        }
+
+        private bool isOnDrop = false;
+
+        public bool IsOnDrop
+        {
+            get { return isOnDrop; }
+            set { isOnDrop = value; }
+        }
+
+        public DelegateCommand<ObservableCollection<OutlineNode>> CollapseAllCommand { get; set; }
+        public DelegateCommand<ObservableCollection<OutlineNode>> ExpandAllCommand { get; set; }
+        public DelegateCommand DeleteAllCommand { get; set; }
+        public DelegateCommand<OutlineNode> DowngradeCommand { get; set; }
+
+        public OutLineControlViewModel()
+        {
+            Outlinelist = new ObservableCollection<OutlineNode>();
+            DeleteAllCommand = new DelegateCommand(DeleteAll);
+            CollapseAllCommand = new DelegateCommand<ObservableCollection<OutlineNode>>(CollapseAll);
+            ExpandAllCommand = new DelegateCommand<ObservableCollection<OutlineNode>>(ExpandAll);
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            return;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer == null)
+            {
+                return;
+            }
+            List<CPDFOutline> datasource = PDFViewer.Document.GetOutlineList();
+            Outlinelist.Clear();
+            foreach (CPDFOutline item in datasource)
+            {
+                OutlineNode dto = ConvertCPDFToOutlineNode(item, null, false);
+                if (dto != null)
+                {
+                    Outlinelist.Add(dto);
+                }
+            }
+            PDFViewer.GetSelectedTextDict();
+        }
+
+        public void Updata(bool IsMoveData)
+        {
+            PDFViewer.Document.ReleaseOutlineList();
+            ObservableCollection<OutlineNode> list = new ObservableCollection<OutlineNode>();
+            List<CPDFOutline> datasource = PDFViewer.Document.GetOutlineList();
+
+            //遍历,转换UI状态存入临时数组
+            foreach (CPDFOutline item in datasource)
+            {
+                OutlineNode dto = ConvertCPDFToOutlineNode(item, null, IsMoveData);
+                if (dto != null)
+                {
+                    list.Add(dto);
+                }
+            }
+
+            //清空绑定数组,并填充新数据
+            Outlinelist.Clear();
+            foreach (OutlineNode item in list)
+            {
+                Outlinelist.Add(item);
+            }
+
+            PDFViewer.UndoManager.CanSave = true;
+        }
+
+        public bool SetTitle(CPDFOutline cPDFOutline, string Title)
+        {
+            if (cPDFOutline == null)
+            {
+                return false;
+            }
+            return cPDFOutline.SetTitle(Title);
+        }
+
+        public void GoToPage(TreeViewItem treeViewItem)
+        {
+            OutlineNode outline = treeViewItem.DataContext as OutlineNode;
+            if (outline == null)
+            {
+                return;
+            }
+            CPDFAction action = outline.Outline.GetAction();
+            if (action != null && action.ActionType != C_ACTION_TYPE.ACTION_TYPE_UNKNOWN)
+                PDFViewer.ProcessAction(action);
+            else
+            {
+                Size size = PDFViewer.Document.GetPageSize(Convert.ToInt32(outline.PageIndex) - 1);
+                PDFViewer.GoToPage(Convert.ToInt32(outline.PageIndex) - 1, new Point(size.Width - outline.PositionX, size.Height - outline.PositionY));
+            }
+        }
+
+        public void CollapseAll(ObservableCollection<OutlineNode> outlineNodes)
+        {
+            foreach (var item in outlineNodes)
+            {
+                item.IsExpanded = false;
+                if (item.Chlidlist.Count > 0)
+                {
+                    CollapseAll(item.Chlidlist);
+                }
+            }
+        }
+
+        public void ExpandAll(ObservableCollection<OutlineNode> outlineNodes)
+        {
+            foreach (var item in outlineNodes)
+            {
+                item.IsExpanded = true;
+                if (item.Chlidlist.Count > 0)
+                {
+                    ExpandAll(item.Chlidlist);
+                }
+            }
+        }
+
+        public void DeleteAll()
+        {
+            foreach (var item in Outlinelist)
+            {
+                item.Outline.RemoveFromParent(this.PDFViewer.Document);
+            }
+            Updata(false);
+        }
+
+        public void Downgrade(OutlineNode outline)
+        {
+            if (outline != null)
+            {
+                CPDFOutline parent = outline.Outline.GetParent();
+                int index = GetOutlinesIndexFormParent(parent, outline.Outline);
+                CPDFOutline newparent = parent.ChildList[index - 2];
+                int insertindex = newparent.ChildList.Count;
+                newparent.MoveChildAtIndex(PDFViewer.Document, outline.Outline, insertindex);
+                Updata(false);
+            }
+        }
+        
+        public void Upgrade(OutlineNode outline)
+        {
+            if (outline != null)
+            {
+                CPDFOutline parent = outline.Outline.GetParent();
+                CPDFOutline newparent = parent.GetParent();
+                int index = GetOutlinesIndexFormParent(parent.GetParent(), parent);
+                newparent.MoveChildAtIndex(PDFViewer.Document, outline.Outline, index);
+                Updata(false);
+            }
+        }
+
+        public void RemoveOutline(OutlineNode outline)
+        {
+            outline.Outline.RemoveFromParent(PDFViewer.Document);
+            Updata(false);
+        }
+
+        /// <summary>
+        /// 插入大纲到目标节点
+        /// </summary>
+        /// <param name="target">目标节点</param>
+        /// <param name="soure">需要插入的数据</param>
+        /// <returns></returns>
+        public bool InsertOutLine(OutlineNode target, OutlineNode soure)
+        {
+            bool Tag = true;
+            if (IsInsertHead)
+            {
+                CPDFOutline root = PDFViewer.Document.GetOutlineRoot();
+                if (root != null)
+                {
+                    Tag = root.MoveChildAtIndex(PDFViewer.Document, soure.Outline, 0);
+                }
+            }
+            else
+            {
+                if (target.IsInsertNextLayer)
+                {
+                    target.IsExpanded = true;
+                    Tag = target.Outline.MoveChildAtIndex(PDFViewer.Document, soure.Outline, target.Outline.ChildList.Count);
+                }
+                else
+                {
+                    CPDFOutline parent = target.Outline.GetParent();
+                    if (parent != null && parent.ChildList.Count > 0)
+                    {
+                        int index = parent.ChildList.IndexOf(target.Outline);
+                        int sourceindex = parent.ChildList.IndexOf(soure.Outline);
+                        //源数据不在目标节点树中的情况
+                        if (sourceindex == -1)
+                        {
+                            Tag = parent.MoveChildAtIndex(PDFViewer.Document, soure.Outline, index + 1);
+                        }
+                        //分向上和向下移动
+                        else if (sourceindex > index)
+                        {
+                            Tag = parent.MoveChildAtIndex(PDFViewer.Document, soure.Outline, index + 1);
+                        }
+                        else
+                        {
+                            Tag = parent.MoveChildAtIndex(PDFViewer.Document, soure.Outline, index);
+                        }
+                    }
+                }
+            }
+            return Tag;
+        }
+
+        /// <summary>
+        /// 获取对应大纲所需的缩略图数据
+        /// </summary>
+        public WriteableBitmap LoadPreview(OutlineNode outlineNode)
+        {
+            CPDFPage page = PDFViewer.Document.PageAtIndex(Convert.ToInt32(outlineNode.PageIndex) - 1);
+            Size size = PDFViewer.Document.GetPageSize(Convert.ToInt32(outlineNode.PageIndex) - 1);
+            Point zoomXY = new Point(outlineNode.PositionX * outlineNode.Zoom, outlineNode.PositionY * outlineNode.Zoom);
+            //数据校验,暂不确定SDK会不会给垃圾值。说是从底层返回的。
+            if (zoomXY.X > size.Width || zoomXY.X < 0)
+            {
+                zoomXY.X = 0;
+            }
+            if (zoomXY.Y > size.Height || zoomXY.Y < 0)
+            {
+                zoomXY.Y = 0;
+            }
+            Size zoomSize = new Size((int)(size.Width * outlineNode.Zoom), (int)(size.Height * outlineNode.Zoom));
+            bmpData = new byte[(int)(zoomSize.Width * zoomSize.Height * 4)];
+            WirteBitmap = new WriteableBitmap((int)zoomSize.Width, (int)zoomSize.Height, 96, 96, PixelFormats.Bgra32, null);
+
+            if (!page.IsValid())
+            {
+                return null;
+            }
+            page.RenderPageBitmapWithMatrix((float)outlineNode.Zoom, new Rect(zoomXY.X, zoomXY.Y, zoomSize.Width, zoomSize.Height), 0xFFFFFFFF, bmpData, 1, true);
+            WirteBitmap.WritePixels(new Int32Rect(0, 0, (int)zoomSize.Width, (int)zoomSize.Height), bmpData, WirteBitmap.BackBufferStride, 0);
+            WirteBitmap.Freeze();
+            return WirteBitmap;
+        }
+
+        /// <summary>
+        /// 将PDF对象转换为自定义数据类型,并存储
+        /// </summary>
+        private OutlineNode ConvertCPDFToOutlineNode(CPDFOutline outline, OutlineNode parent, bool IsMoveData)
+        {
+            OutlineNode node = new OutlineNode();
+            if (outline != null)
+            {
+                node.IsInsertNextLayer = false;
+                node.IsInsertCurrentLayer = false;
+                node.IsExpanded = false;
+                node.IsSelected = false;
+                node.Outline = outline;
+                node.CanUp = outline.Level == 0 ? false : true;
+                node.CanAddParent = outline.Level == 0 ? false : true;
+                CPDFAction action = outline.GetAction();
+                if (action != null)
+                {
+                    if (action.ActionType != C_ACTION_TYPE.ACTION_TYPE_URI)
+                    {
+                        CPDFDestination cPDFDestination = outline.GetDestination(PDFViewer.Document);
+                        if (cPDFDestination != null)
+                        {
+                            //存储大纲相关属性
+                            node.PageIndex = (cPDFDestination.PageIndex + 1).ToString();
+                            node.PositionX = cPDFDestination.Position_X;
+                            node.PositionY = cPDFDestination.Position_Y;
+                            if (cPDFDestination.Zoom <= 0)
+                            {
+                                node.Zoom = 1;
+                            }
+                            else
+                            {
+                                node.Zoom = cPDFDestination.Zoom;
+                            }
+                        }
+                        else
+                        {
+                            node.PageIndex = "";
+                            node.PositionX = 0;
+                            node.PositionY = 0;
+                            node.Zoom = 1;
+                        }
+                    }
+                    else
+                    {
+                        node.PageIndex = "";
+                        node.PositionX = 0;
+                        node.PositionY = 0;
+                        node.Zoom = 1;
+                    }
+
+                }
+                else
+                {
+                    node.PageIndex = "";
+                    node.PositionX = 0;
+                    node.PositionY = 0;
+                    node.Zoom = 1;
+                }
+
+                if (parent != null)
+                {
+                    node.Parent = parent;
+                }
+                if (Outlinelist != null && Outlinelist.Count > 0)
+                {
+                    OutlineNode oldnode = FindOutlineFromDto(Outlinelist, node.Outline, IsMoveData);
+                    if (oldnode != null)
+                    {
+                        node.IsExpanded = oldnode.IsExpanded;
+                        node.IsSelected = oldnode.IsSelected;
+                    }
+                }
+                node.Chlidlist = new ObservableCollection<OutlineNode>();
+                if (outline.ChildList.Count > 0)
+                {
+                    foreach (CPDFOutline item in outline.ChildList)
+                    {
+                        node.Chlidlist.Add(ConvertCPDFToOutlineNode(item, node, IsMoveData));
+                    }
+                }
+                else
+                {
+                    node.CanDown = false;
+                }
+            }
+            return node;
+        }
+
+        public OutlineNode FindOutlineFromDto(ObservableCollection<OutlineNode> list, CPDFOutline outline, bool IsMoveData)
+        {
+            foreach (OutlineNode item in list)
+            {
+                CPDFOutline parent = outline.GetParent();
+                CPDFOutline PARENT = item.Outline.GetParent();
+
+                int i = GetIndexFromParent(parent.ChildList, outline);
+                int I = GetIndexFromParent(PARENT.ChildList, item.Outline);
+                if (IsMoveData)
+                {
+                    if (item.Outline.Title == outline.Title)
+                    {
+                        return item;
+                    }
+                    else if (item.Chlidlist.Count > 0)
+                    {
+                        OutlineNode retdto = FindOutlineFromDto(item.Chlidlist, outline, IsMoveData);
+                        if (retdto != null)
+                        {
+                            return retdto;
+                        }
+                    }
+                }
+                else
+                {
+                    if (item.Outline.Title == outline.Title && i == I && outline.Level == item.Outline.Level && ((parent.Title == PARENT.Title) || (parent.Title == null && PARENT.Title == null)))
+                    {
+                        return item;
+                    }
+                    else if (item.Chlidlist.Count > 0)
+                    {
+                        OutlineNode retdto = FindOutlineFromDto(item.Chlidlist, outline, IsMoveData);
+                        if (retdto != null)
+                        {
+                            return retdto;
+                        }
+                    }
+                }
+            }
+            return null;
+        }
+
+        private int GetIndexFromParent(List<CPDFOutline> parentlist, CPDFOutline outline)
+        {
+            for (int i = 0; i < parentlist.Count; i++)
+            {
+                if (parentlist[i] == outline)
+                {
+                    return i;
+                }
+            }
+            return -1;
+        }
+        private int GetOutlinesIndexFormParent(CPDFOutline parentoutline, CPDFOutline outline)
+        {
+            if (parentoutline != null)
+            {
+                if (parentoutline.ChildList.Count > 0)
+                {
+                    for (int i = 0; i < parentoutline.ChildList.Count; i++)
+                    {
+                        if (parentoutline.ChildList[i] == outline)
+                        {
+                            return i + 1;
+                        }
+                    }
+                }
+                return parentoutline.ChildList.Count;
+            }
+            return 0;
+        }
+    }
+}

+ 203 - 0
PDF Office/ViewModels/BOTA/SearchContentViewModel.cs

@@ -0,0 +1,203 @@
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using PDF_Office.Views.BOTA;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+using System.Windows.Threading;
+
+namespace PDF_Office.ViewModels.BOTA
+{
+
+    class SearchContentViewModel : BindableBase, INavigationAware
+    {
+
+        #region 属性
+
+        public PDFTextSearch textSearch;
+        private ObservableCollection<TextSearchBindItem> _searchResults = new ObservableCollection<TextSearchBindItem>();
+
+        public ObservableCollection<TextSearchBindItem> searchResults
+        {
+            get { return _searchResults; }
+            set { SetProperty(ref _searchResults, value); }
+        }
+        public List<TextSearchBindItem> lists;
+
+        private string _searchContent = "";
+        public string SearchContent
+        {
+            get { return _searchContent; }
+            set { SetProperty(ref _searchContent, value); }
+        }
+
+
+        private int _searchCount = 0;
+        public int SearchCount
+        {
+            get { return _searchCount; }
+            set { SetProperty(ref _searchCount, value); }
+        }
+
+        private bool _isEmpty = true;
+        public bool IsEmpty
+        {
+            get { return _isEmpty; }
+            set { SetProperty(ref _isEmpty, value); }
+        }
+
+        #endregion
+        #region  事件
+        public DelegateCommand<object> SearchTextCommand { get; set; }
+        public DelegateCommand<object> SearchChangedCommand { get; set; }
+
+        #endregion
+
+
+        public SearchContentViewModel()
+        {
+           InitVariable();
+           InitCommand();
+           BindEvent();
+           lists = new List<TextSearchBindItem>();
+        }
+
+        private void InitVariable()
+        {
+            textSearch = new PDFTextSearch();
+          
+            ICollectionView groupView = CollectionViewSource.GetDefaultView(searchResults);
+            groupView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(TextSearchBindItem.ShowPageIndex)));
+        }
+
+        private  void InitCommand()
+        {
+            SearchTextCommand = new DelegateCommand<object>(SearchText);
+            SearchChangedCommand = new DelegateCommand<object>(SearchChanged);
+        }
+
+        private void BindEvent()
+        {
+            textSearch.SearchPercentHandler += TextSearch_SearchPercentHandler;
+            textSearch.SearchCompletedHandler += TextSearch_SearchCompletedHandler;
+        }
+
+        private void TextSearch_SearchCompletedHandler(object sender, TextSearchResult e)
+        {
+            issearched = true;
+            TotalCount = e.TotalCount;
+        }
+        bool issearched = true;
+        int TotalCount = 0;
+        private bool cancelTask = false;
+        private void TextSearch_SearchPercentHandler(object sender, TextSearchResult e)
+        {
+
+            if (cancelTask == false)
+            {
+                string keywords = SearchContent;
+                if (e.Items.ContainsKey(e.CurrentPage))
+                {
+                    {
+                        TextSearchBindItem addItem = new TextSearchBindItem();
+                        addItem.PageCount = e.Items[e.CurrentPage].Count;
+                        addItem.ShowPageIndex = e.CurrentPage;
+                    }
+                    {
+                        foreach (TextSearchItem item in e.Items[e.CurrentPage])
+                        {
+                            TextSearchBindItem addItem = new TextSearchBindItem();
+                            addItem.BindProperty.PageIndex = item.PageIndex;
+                            addItem.BindProperty.TextContent = item.TextContent;
+                            addItem.BindProperty.TextRect = item.TextRect;
+                            addItem.BindProperty.SearchWord = keywords;
+                            addItem.BindProperty.HighLightColor = Color.FromArgb(0x99, 0xFF, 0xF7, 0x00);
+                            addItem.BindProperty.PageRotate = item.PageRotate;
+                            lists.Add(addItem);
+                        }
+                    }
+                }
+              
+            }
+        }
+
+        private async void SearchText(object obj)
+        {
+
+            if (PDFViewer != null && textSearch != null)
+            {
+                issearched = false;
+                C_Search_Options option = C_Search_Options.Search_Case_Insensitive;
+                textSearch.TextSearchDocument = PDFViewer.Document;
+
+                searchResults.Clear();
+                lists.Clear();
+
+                textSearch.SearchText(SearchContent, option);
+            }
+            while (issearched == false)
+                await Task.Delay(10);
+
+            foreach (var item in lists)
+                searchResults.Add(item);
+
+            SearchCount = TotalCount;
+            if (TotalCount == 0)
+                IsEmpty = true;
+            else
+                IsEmpty = false;
+        }
+
+
+        private void SearchChanged(object obj)
+        {
+
+            if (PDFViewer != null && textSearch != null)
+            {
+                TextSearchBindItem currentItem = obj as TextSearchBindItem;
+                if (currentItem != null && PDFViewer != null)
+                {
+                    List<TextSearchItem> pageTextList = new List<TextSearchItem>();
+                    pageTextList.Add(new TextSearchItem()
+                    {
+                        PageIndex = currentItem.BindProperty.PageIndex,
+                        TextRect = currentItem.BindProperty.TextRect,
+                        TextContent = currentItem.BindProperty.TextContent,
+                        PageRotate = currentItem.BindProperty.PageRotate
+                    });
+                    PDFViewer.SetPageSelectText(pageTextList, new SolidColorBrush(Color.FromArgb(0x99, 0xFF, 0xF7, 0x00)));
+                }
+            }
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            return;
+        }
+
+        private CPDFViewer PDFViewer;
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer != null)
+            {
+
+            }
+        }
+    }
+}

+ 22 - 5
PDF Office/ViewModels/Dialog/PageEditDialogs/InsertDialogViewModel.cs

@@ -83,7 +83,18 @@ namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
             }
         }
 
-
+        private int unitsSelectedIndex = 0;
+        /// <summary>
+        /// 单位下拉框的选中项索引
+        /// </summary>
+        public int UnitsSelectedIndex
+        {
+            get { return unitsSelectedIndex; }
+            set
+            {
+                SetProperty(ref unitsSelectedIndex, value);
+            }
+        }
 
 
         /// <summary>
@@ -96,6 +107,7 @@ namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
         /// </summary>
         public List<string> Units { get; set; }
 
+
         public DelegateCommand CancelCommand { get; set; }
 
         public DelegateCommand InsertCommnad { get; set; }
@@ -120,7 +132,10 @@ namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
         /// </summary>
         private  void InitUnits()
         {
-
+            Units = new List<string>();
+            Units.Add("mm");
+            Units.Add("cm");
+            Units.Add("in");
         }
 
         /// <summary>
@@ -130,9 +145,9 @@ namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
         {
             Pages = new ObservableCollection<CustomPageItem>();
             Pages.Add(new CustomPageItem() {Name="空白页",FilePath = ""});
-            Pages.Add(new CustomPageItem() { Name="横线",FilePath= System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\HorizontalLine.png")});
-            Pages.Add(new CustomPageItem() { Name = "五线谱", FilePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\Staff.png") });
-            Pages.Add(new CustomPageItem() { Name = "格子线", FilePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\GridLine.png") });
+            Pages.Add(new CustomPageItem() { Name="横线",FilePath= System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\HorizontalLine.jpg")});
+            Pages.Add(new CustomPageItem() { Name = "五线谱", FilePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\Staff.jpg") });
+            Pages.Add(new CustomPageItem() { Name = "格子线", FilePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Resources\PageEdit\GridLine.jpg") });
         }
 
         /// <summary>
@@ -195,6 +210,8 @@ namespace PDF_Office.ViewModels.Dialog.PageEditDialogs
             {
                 var size = parameters.GetValue<Size>("CurrentPageSize");
                 CurrentPageSize = $"({size.Width.ToString("F2")}mm*{size.Height.ToString("F2")}mm)";
+                CustomWidth = size.Width.ToString("F2");
+                CustomHeight = size.Height.ToString("F2");
                 Model.width = (int)size.Width;
                 Model.height = (int)size.Height;
             }

+ 1 - 3
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveContentViewModel.cs

@@ -11,12 +11,10 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 {
     public class CloudDriveContentViewModel : BindableBase
     {
-
-
         public DelegateCommand<CloudBoxItem> CheckDriveCommand { get; set; }
         public DelegateCommand<CloudBoxItem> CheckDriveLoginUserCommand { get; set; }
 
-        private CloudDriveManager Manager =>CloudDriveManager.GetInstance();
+        private CloudDriveManager Manager =>CloudDriveManager.CloudManager;
         public event EventHandler<bool> IshowContentHandler;
       
         public CloudDriveContentViewModel()

+ 147 - 35
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveManager.cs

@@ -1,4 +1,6 @@
-using PDF_Office.Model.CloudDrive;
+using PDF_Office.Helper;
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.Properties;
 using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
 using System;
 using System.Collections.Generic;
@@ -14,20 +16,17 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
     //单实例化
     public class CloudDriveManager
     {
-      
+
+        #region 云盘类型
         public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
         public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
+       
+        #endregion
+
         public CloudType cloudType;
 
         private static CloudDriveManager instance;
-
-        public static CloudDriveManager GetInstance()
-        {
-            if (instance == null)
-                instance = new CloudDriveManager();
-
-            return instance;
-        }
+        public static CloudDriveManager CloudManager => instance ?? (instance = new CloudDriveManager());
         private CloudDriveManager()
         {
         }
@@ -50,6 +49,96 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
             return false;
         }
 
+        public async Task<ObservableCollection<FilesBaseItem>> OpenFolder(FileOperation fileOperation)
+        {
+            ObservableCollection<FilesBaseItem> FilesList = null;
+            switch (fileOperation.User.cloudType)
+            {
+                case CloudType.GoogleDrive:
+                    {
+                        var list = await GoogleDrive.GetFolder(fileOperation);
+                        FilesList = new ObservableCollection<FilesBaseItem>();
+                        foreach (var item in list)
+                        {
+                            FilesList.Add(item);
+                        }
+                    }
+
+                    break;
+                case CloudType.DropBox:
+                    {
+                        var list = await DropbBox.GetFolder(fileOperation);
+                        FilesList = new ObservableCollection<FilesBaseItem>();
+                        foreach (var item in list)
+                        {
+                            FilesList.Add(item);
+                        }
+                    }
+                    break;
+            }
+
+            return FilesList;
+        }
+
+        public async Task<bool> OpenFile(FileOperation fileOperation)
+        {
+            string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+            string tempPath = "";
+            switch (fileOperation.User.cloudType)
+            {
+                case CloudType.GoogleDrive:
+                    tempPath = await GoogleDrive.DownloadGoogleFile(fileOperation, docPath);
+                    break;
+                case CloudType.DropBox:
+                    tempPath = await DropbBox.DownloadFile(fileOperation, docPath);
+                    break;
+            }
+
+            if(string.IsNullOrEmpty(tempPath) == false)
+            {
+                string[] filePaths = { tempPath };
+                await Task.Delay(3);
+                LoadPdfViewer(filePaths);
+            }
+
+            return false;
+        }
+
+        public void LoadPdfViewer(string[] filePaths)
+        {
+            var content = App.mainWindowViewModel.SelectedItem.DataContext as MainContentViewModel;
+            if (filePaths.Count() == 1)
+            {
+                if (App.OpenedFileList.Contains(filePaths[0]))
+                {
+                    App.mainWindowViewModel.SelectItem(filePaths[0]);
+                }
+                else
+                {
+                    content.OpenFile(filePaths[0]);
+                }
+                ToolMethod.SetFileThumbImg(filePaths[0]);
+            }
+            else
+            {
+                var fileList = filePaths.ToList().Where(x => !App.OpenedFileList.Exists(y => y == x)).ToList();
+                if (fileList.Count <= 0)
+                    return;
+
+                content.OpenFile(filePaths[0]);
+                for (int i = 1; i < fileList.Count(); i++)
+                {
+                    if (!App.OpenedFileList.Contains(fileList[i]))
+                    {
+                        App.mainWindowViewModel.AddTabItem(fileList[i]);
+                    }
+                    ToolMethod.SetFileThumbImg(fileList[i]);
+                }
+            }
+
+            Settings.Default.Save();
+        }
+
         public bool LoadedUsers()
         {
             bool isUsers = false;
@@ -62,45 +151,68 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
         /// <summary>
         /// 移除用户
         /// </summary>
-        public async Task<bool> RemoveUser()
+        public async Task<bool> RemoveUser(UserBaseItem user)
         {
-            GoogleDriveUserItem userIttem = null;
-            switch (cloudType)
+            bool result = false;
+            switch (user.cloudType)
             {
-                case CloudType.OneDrive:
-                    return await GoogleDrive.RemoveUser(userIttem);
+                case CloudType.GoogleDrive:
+                    {
+                        var googleUser = user as GoogleDriveUserItem;
+                        if(googleUser != null)
+                        {
+                            result = await GoogleDrive.RemoveUser(googleUser);
+                        }
+                    }
+                    break;
+                   
+                case CloudType.DropBox:
+                    {
+                        var dropBoxUser = user as DropbBoxUserItem;
+                        if (dropBoxUser != null)
+                        {
+                            result = await DropbBox.RemoveUser(dropBoxUser);
+                        }
+                    }
+                    break;
             }
-            return false;
-        }
-
-        /// <summary>
-        /// 切换用户
-        /// </summary>
-        public void SwitchUser()
-        {
 
+            return result;
         }
 
-
         #endregion
 
 
         #region 文件
 
-        public void GetFiles()
-        {
-
-        }
-
-        public void GetFolders()
-        {
-
-        }
-
-        public void UpLoad()
+        public async Task<bool> UpLoadFile(FileOperation fileOperation)
         {
+            bool result = false;
+            switch (fileOperation.User.cloudType)
+            {
+                case CloudType.GoogleDrive:
+                    {
+                        var googleUser = fileOperation.User as GoogleDriveUserItem;
+                        if (googleUser != null)
+                        {
+                            result = await GoogleDrive.UpLoadFile(fileOperation);
+                        }
+                    }
+                    break;
 
+                case CloudType.DropBox:
+                    {
+                        var dropBoxUser = fileOperation.User as DropbBoxUserItem;
+                        if (dropBoxUser != null)
+                        {
+                            result = await DropbBox.UpLoadFile(fileOperation);
+                        }
+                    }
+                    break;
+            }
+            return result;
         }
+     
         #endregion
 
     }

+ 42 - 35
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxManager.cs

@@ -15,7 +15,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
         private static DropbBoxManager instance;
         public static DropbBoxManager DropbBox => instance ?? (instance = new DropbBoxManager());
 
-        public DropbBoxManager()
+        private DropbBoxManager()
         {
         }
 
@@ -30,63 +30,70 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
         {
             bool result = false;
             DropbBoxUserItem dropbBoxUserItem = new DropbBoxUserItem();
+            dropbBoxUserItem.cloudType = CloudType.DropBox;
             result = await dropbBoxUserItem.LoginUser();
-            if(result)
-            {
-                dropbBoxUserItem.cloudType = CloudType.DropBox;
-                   UserInfo user = new UserInfo();
-                user.Name = "DropBox测试" + (Cloud.CloudLists.Count + 1).ToString();
-                dropbBoxUserItem.userInfo = user;
-
-                Cloud.CloudLists.Add(dropbBoxUserItem);
-
-            }
             return result;
         }
 
         /// <summary>
         /// 移除用户
         /// </summary>
-        public void RemoveUser()
+        public async Task<bool> RemoveUser(DropbBoxUserItem user)
         {
-
-        }
-
-        /// <summary>
-        /// 切换用户
-        /// </summary>
-        public void SwitchUser()
-        {
-
+            var result = await user.RemoveUser();
+            if(result == true)
+            {
+                Cloud.CloudLists.Remove(user);
+            }
+            return result;
         }
 
-
         #endregion
 
 
         #region 文件
 
-        public void GetFiles()
+        public async Task<List<DropbBoxFiles>> GetFolder(FileOperation fileOperation)
         {
-
+            var user = fileOperation.User as DropbBoxUserItem;
+            if (user != null)
+            {
+                if (fileOperation.DoFile == null)
+                {
+                    return await user.RefreshList();
+                }
+                else
+                {
+                    return await user.RefreshList((fileOperation.DoFile as DropbBoxFiles).Id);
+                }
+              
+            }
+            return null;
         }
 
-        public void GetFolders()
+        public async Task<bool> UpLoadFile(FileOperation fileOperation)
         {
-
+            bool result = false;
+            var user = fileOperation.User as DropbBoxUserItem;
+            if (user != null && fileOperation.DoFile as DropbBoxFiles != null)
+            {
+                var pathDisplay = (fileOperation.DoFile as DropbBoxFiles).PathDisplay;
+                result = await user.UpLoadFile(fileOperation.SourceFile, fileOperation.SourceFileName,pathDisplay);
+            }
+            return result;
         }
 
-        public void UpLoad()
+        public async Task<string> DownloadFile(FileOperation fileOperation, string savePath)
         {
-
+            string result = "";
+            var user = fileOperation.User as DropbBoxUserItem;
+            if (user != null)
+            {
+                result = await user.Download((fileOperation.DoFile as DropbBoxFiles).Name, savePath);
+               
+            }
+            return result;
         }
         #endregion
-
-
-
-
-
-
-
     }
 }

+ 54 - 41
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxUserItem.cs

@@ -26,25 +26,62 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
             if (client == null)
                 return false;
             else
+            {
+                UserInfo user = new UserInfo();
+                user.UserAccount = "DropBox测试" + (Cloud.CloudLists.Count + 1).ToString();
+                userInfo = user;
+
+                Cloud.CloudLists.Add(this);
                 return true;
+            }
+                
         }
 
         public async Task<List<DropbBoxFiles>> RefreshList(string path = "")
         {
             var files = await client.Files.ListFolderAsync(path);
-            DropbBoxFiles dropbBoxFiles = new DropbBoxFiles();
+           
             List<DropbBoxFiles> FileList = new List<DropbBoxFiles>();
             foreach (var file in files.Entries)
             {
-                dropbBoxFiles.Name = file.Name;
-                FileList.Add(dropbBoxFiles);
+                if(file.Name.ToLower().EndsWith(".pdf") == true || file.IsFolder == true)
+                {
+                    DropbBoxFiles dropbBoxFiles = new DropbBoxFiles();
+                    dropbBoxFiles.Name = file.Name;
+                    dropbBoxFiles.IsFolder = file.IsFolder;
+                    dropbBoxFiles.PathDisplay = file.PathDisplay;
+                    if (file.IsFolder)
+                    {
+                        if(file.AsFolder != null)
+                        dropbBoxFiles.Id = file.AsFolder.Id;
+                        dropbBoxFiles.MimeType = ".pdf";
+                    }
+                    else
+                    {
+                        if(file.AsFile != null)
+                        dropbBoxFiles.Id = file.AsFile.Id;
+                        dropbBoxFiles.MimeType = ".pdf";
+                    }
+                   
+                    FileList.Add(dropbBoxFiles);
+                }
             }
             MetadataList = (List<Metadata>)files.Entries;
             this.FilesList = FileList;
             return FileList;
         }
 
+        public async Task<bool> RemoveUser()
+        {
+            bool result = true;
+            if (result == true)
+            {
+                MetadataList.Clear();
+            }
+
 
+            return result;
+        }
 
         public async Task<string> Download(string name, string savePath)
         {
@@ -103,47 +140,23 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
             return memoryStream;
         }
 
-        private void Upload()
+        public async Task<bool> UpLoadFile(string sourceFilePath,string sourceFileName,string pathDisplay)
         {
-            //if (ItemList.SelectedItem != null)
-            //{
-            //    var item = ItemList.SelectedItem as Metadata;
-            //    if (item.IsFolder)
-            //        return;
-
-            //OpenFileDialog openFileDialog = new OpenFileDialog();
-            //if ((bool)openFileDialog.ShowDialog())
-            //{
-            //    string folder = currentFolder; /*= item.PathDisplay.Replace("/" + item.Name, "");*/
-            //    using (var stream = System.IO.File.OpenRead(openFileDialog.FileName))
-            //    {
-            //        await client.Files.UploadAsync(folder + "/" + openFileDialog.SafeFileName, WriteMode.Overwrite.Instance, body: stream);
-            //    }
-            //    MessageBox.Show("上传完成");
-            //    RefreshList(folder);
-            //}
-            //}
-        }
 
-        private void Loaded()
-        {
-            //var text = sender as TextBlock;
-            //if (text == null)
-            //    return;
-            //if (text.DataContext is Metadata)
-            //{
-            //    var data = (text.DataContext as Metadata);
-            //    if (data.IsFile)
-            //    {
-            //        text.Text = "File";
-            //    }
-            //    if (data.IsFolder)
-            //    {
-            //        text.Text = "Folder";
-            //    }
-            //}
-        }
+            if (string.IsNullOrEmpty(pathDisplay) == false)
+            {
+                using (var stream = System.IO.File.OpenRead(sourceFilePath))
+                {
+                    await client.Files.UploadAsync(pathDisplay + "/" + sourceFileName, WriteMode.Overwrite.Instance, body: stream);
+                }
+                return true;
+            }
+            else
+            {
+                return false;
+            }
 
+        }
 
     }
 

+ 51 - 2
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveManager.cs

@@ -28,7 +28,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
         #region   请求身份验证
 
         /// <summary>
-        /// 获取登录过的用户
+        /// 预留需求:获取登录过的用户
         /// </summary>
         public async Task<bool> GetHistoryUsers()
         {
@@ -94,9 +94,58 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
 
         public async Task<bool> RemoveUser(GoogleDriveUserItem userIttem)
         {
-           return await userIttem.RemoveUser();
+            var result = await userIttem.RemoveUser();
+            if (result == true)
+            {
+                Cloud.CloudLists.Remove(userIttem);
+            }
+            return result;
         }
 
         #endregion
+
+        #region  文件
+
+        public async Task<bool> UpLoadFile(FileOperation fileOperation)
+        {
+            bool result = false;
+            var user = fileOperation.User as GoogleDriveUserItem;
+            if (user != null)
+            {
+                if (fileOperation.DoFile != null)
+                    result = await user.FileUpload(fileOperation.SourceFile, fileOperation.DoFile.Id);
+                else
+                    result = await user.FileUpload(fileOperation.SourceFile,"");
+
+            }
+            return result;
+        }
+
+        public async Task<string> DownloadGoogleFile(FileOperation fileOperation, string savePath)
+        {
+            string result = "";
+            var user = fileOperation.User as GoogleDriveUserItem;
+            if(user != null)
+            {
+                result = await user.DownloadGoogleFile(fileOperation.DoFile as GoogleDriveFiles, savePath);
+            }
+            return result;
+        }
+        
+        public async Task<List<GoogleDriveFiles>> GetFolder(FileOperation fileOperation)
+        {
+            var user = fileOperation.User as GoogleDriveUserItem;
+            if (user != null)
+            {
+                if (fileOperation.DoFile == null)
+                {
+                    return await user.GetDriveFiles(user.Service);
+                }
+                else
+                    return await user.GetDriveFiles(user.Service, (fileOperation.DoFile as GoogleDriveFiles).Id);
+            }
+            return null;
+        }
+        #endregion
     }
 }

+ 76 - 36
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveUserItem.cs

@@ -7,6 +7,7 @@ using Google.Apis.Util.Store;
 using PDF_Office.Model.CloudDrive;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -24,13 +25,12 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
        
         public  DriveService Service { get; set; }//Google提供服务
         private List<GoogleDriveFiles> FilesList = new List<GoogleDriveFiles>();//文件
-
+      //  private List<GoogleDriveFolder> FolderList = new List<GoogleDriveFolder>();//文件
         public UserCredential CurrentCredential { get; set; }//当前用户访问令牌
 
         public GoogleDriveUserItem()
         {
-         //   User = new User();
-            
+
         }
       
         #region   对用户账号处理
@@ -68,7 +68,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
                 userInfo = new UserInfo();
                 var about = Service.About.Get();
                 about.Fields = "user";
-                var uss = await about.ExecuteAsync();
+                var uss =  about.Execute();
                 User user = uss.User;
                 userInfo.UserAccount = user.EmailAddress;
                 userInfo.Name = user.DisplayName;
@@ -89,58 +89,92 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
 
         #endregion
 
-
-        #region   文件夹
-
-
-
-        #endregion
-
-        #region  文件
+        #region  文件夹、文件
 
         /// <summary>
         /// 对单个用户,获取文件列表
         /// </summary>
-        public async Task<List<GoogleDriveFiles>> GetDriveFiles(DriveService service = null)
+        /// <param name="service"></param>
+        /// <param name="parentFilesId">文件夹ID:file.Id</param>
+        /// <returns></returns>
+        public async Task<List<GoogleDriveFiles>> GetDriveFiles(DriveService service = null, string  parentFilesId = null)
         {
             if (service == null)
                 return null;
-
-            // define parameters of request.
-            FilesResource.ListRequest FileListRequest = service.Files.List(); 
-
+          
+            FilesResource.ListRequest FileListRequest = service.Files.List();
             //listRequest.PageSize = 10;
             //listRequest.PageToken = 10;
-            FileListRequest.Fields = "nextPageToken, files(id, name, size, version, createdTime)";
+            if (parentFilesId == null)
+                //FileListRequest.Q = "'root' in parents or sharedWithMe = true";
+                FileListRequest.Q = "'root' in parents";
+            else
+                FileListRequest.Q = "'" + parentFilesId + "' in parents";
+            // FileListRequest.Fields = "nextPageToken, files(mimeType, id, name, size, version, createdTime)";
+            // FileListRequest.Fields = "nextPageToken, files(id, name)";
+            FileListRequest.Fields = "nextPageToken,kind,files(mimeType,id,kind,size,name,appProperties,webViewLink,webContentLink,createdTime,modifiedTime,ownedByMe,trashed,owners,lastModifyingUser,sharedWithMeTime,parents)";
+            FileListRequest.PageSize = 1000;
+             FileList result = FileListRequest.Execute();
 
             //get file list.
-            IList<Google.Apis.Drive.v3.Data.File> files = FileListRequest.Execute().Files;
-            List<GoogleDriveFiles> FileList = new List<GoogleDriveFiles>();
+            // String pageToken = null;
+            List<GoogleDriveFiles> filelist = new List<GoogleDriveFiles>();
+
+            IList<Google.Apis.Drive.v3.Data.File> files = result.Files;
+
 
             if (files != null && files.Count > 0)
             {
                 foreach (var file in files)
                 {
-                       GoogleDriveFiles File = new GoogleDriveFiles
+                    if (file.MimeType.EndsWith(GoogleDriveStatic.MimeType) == true || file.MimeType.EndsWith(GoogleDriveStatic.FolderType) == true)
                     {
-                        Id = file.Id,
-                        Name = file.Name,
-                        Size = file.Size,
-                        Version = file.Version,
-                        CreatedTime = file.CreatedTime
-                    };
-                    FileList.Add(File);
+                        bool isFolder = (file.MimeType == GoogleDriveStatic.FolderType ? true : false);
+                        GoogleDriveFiles File = new GoogleDriveFiles
+                        {
+                            Id = file.Id,
+                            MimeType = file.MimeType,
+                            IsFolder = isFolder,
+                            Name = file.Name,
+                            Size = file.Size,
+                            Version = file.Version,
+                            CreatedTime = file.CreatedTime
+                        };
+                        int level = 0;
+                        if (isFolder)
+                        {
+                            if (file.Parents != null)
+                            {
+                                level = file.Parents.Count;
+                                //var folderItem = new GoogleDriveFolder();
+                                //folderItem.Level = level;
+                                //folderItem.fileId = file.Id;
+                                //FolderList.Add(folderItem);
+                            }
+                        }
+                        else
+                        {
+                            level = -1;
+                        }
+
+                        File.Level = level;
+                        filelist.Add(File);
+                    }
+
                 }
-                this.FilesList = FileList;
+
             }
-            return FileList;
+            this.FilesList.Clear();
+            this.FilesList = filelist;
+            return filelist;
         }
 
+
         /// <summary>
         /// 上传文件
         /// </summary>
         /// <param name="filepath">本地文件路径</param>
-        public  async Task<bool> FileUpload(string filepath)
+        public  async Task<bool> FileUpload(string filepath,string desFolderId)
         {
             if (Service == null)
                 return false;
@@ -150,7 +184,12 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
             var str2 = filepath.Substring(str + 1, filepath.Length - str - 1);
 
             FileMetaData.Name = str2;
-            FileMetaData.MimeType = "";
+            FileMetaData.MimeType =GoogleDriveStatic.MimeType;
+
+            if (string.IsNullOrEmpty(desFolderId) == false)
+            {
+                FileMetaData.Parents = new List<string> { desFolderId };
+            }
 
             FilesResource.CreateMediaUpload request;
             try
@@ -161,7 +200,6 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
                     request.Fields = "id";
                     request.Upload();
                 }
-
                 return true;
             }
             catch
@@ -242,12 +280,14 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
         #endregion
     }
 
-
     public static class GoogleDriveStatic
     {
         public static string[] Scopes = { DriveService.Scope.Drive };
         //Google Drive应用名称
         private static readonly string GoogleDriveAppName = "PDF Office";
+        public static readonly string MimeType = "application/pdf";
+        public static readonly string FolderType = "application/vnd.google-apps.folder";
+        
         //请求应用进行身份验证的信息
         public static string CredentialsPath { get; private set; }
 
@@ -296,15 +336,15 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
                         CancellationToken.None,
                         new FileDataStore(FilePath, true)).Result;
                 }
-
+                
                 //create Drive API service.
                 DriveService service = new DriveService(new BaseClientService.Initializer()
                 {
                     HttpClientInitializer = credential,
                     ApplicationName = GoogleDriveAppName
                 });
-
                 return tuple = new Tuple<DriveService, UserCredential>(service, credential);
+                
             }
             catch (Exception e)
             {

+ 173 - 62
PDF Office/ViewModels/HomePanel/CloudDrive/CloudFilesContentViewModel.cs

@@ -1,4 +1,7 @@
-using PDF_Office.Model.CloudDrive;
+using Microsoft.Win32;
+using PDF_Office.Helper;
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.Properties;
 using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -8,126 +11,234 @@ using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 
 namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 {
+
     //各云盘事件
     public class CloudFilesContentViewModel : BindableBase
     {
-     
-        public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
-        public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
-        public DelegateCommand OpenCloudDriveCommand { get; set; }
-        public DelegateCommand CheckDriveUsersCommand { get; set; }
-
-        public DelegateCommand<CloudBoxItem> CheckDriveCommand { get; set; }
-        
-        public CloudFilesContentViewModel()
+        #region 云盘变量
+        public CloudDriveManager CloudManager => CloudDriveManager.CloudManager;
+        private ObservableCollection<FolderBaseItem> _folderItems = new ObservableCollection<FolderBaseItem>();
+        public ObservableCollection<FolderBaseItem> FolderItems
         {
-            OpenCloudDriveCommand = new DelegateCommand(OpenCloudDrive_Click);
-            OpenCloudDriveCommand = new DelegateCommand(CheckDriveUsers);
-
-            CheckDriveCommand = new DelegateCommand<CloudBoxItem>(CheckDrive);
+            get { return _folderItems; }
+            set { SetProperty (ref _folderItems, value); }
         }
-
-        public async void CheckDrive(CloudBoxItem cloudDriveItem)
+        private ObservableCollection<FilesBaseItem> _filesList = new ObservableCollection<FilesBaseItem>();
+        public ObservableCollection<FilesBaseItem> FilesList
         {
-            switch (cloudDriveItem.CloudDiskType)
-            {
-                case CloudType.GoogleDrive:
-                     await GoogleDrive.LoginUserCount();
-                    break;
-                case CloudType.DropBox:
-                     await DropbBox.LoginUser();
-                    break;
-            }
+            get { return _filesList; }
+            set { SetProperty(ref _filesList, value); }
+        }
+      
+        private CloudType _currentCloudType = CloudType.GoogleDrive;
+        public CloudType CurrentCloudType
+        {
+            get { return _currentCloudType; }
+            set { SetProperty(ref _currentCloudType, value); }
         }
+        #endregion
 
-        #region 云盘公用接口
+        #region  事件
+        /// <summary>
+        /// 根据目录,更新文件列表
+        /// </summary>
+        public DelegateCommand<FileOperation> OpenFolderCommand { get; set; }
 
-        public async void CheckDriveUsers()
-        {
-            //   var result = await GetHistoryUser();
-            //    isFoundUserHandler?.Invoke(null, result);
-         // await  GoogleDrive.LoginUderCount();
+        /// <summary>
+        /// 选中文件夹,更新指定文件夹里的文件列表
+        /// </summary>
+        public DelegateCommand<FolderBaseItem> SelectedFolderCommand { get; set; }
+        /// <summary>
+        /// 下载并打开文件
+        /// </summary>
+        public DelegateCommand<FileOperation> OpenFileCommand { get; set; }
 
-        }
+        /// <summary>
+        /// 上传文件
+        /// </summary>
+        public DelegateCommand<FileOperation> UpLoadFileCommand { get; set; }
+
+        public DelegateCommand<CloudBoxItem> LoginCommand { get; set; }
+        public DelegateCommand<UserBaseItem> RemoveUserCommand { get; set; }
 
         #endregion
-        public void OpenCloudDrive_Click()
-        {
 
+        public CloudFilesContentViewModel()
+        {
+            InitVariable();
+            InitCommand();
         }
 
 
-        #region 谷歌云盘
-
-        public void LoginUser_Click()
+        private void InitVariable()
         {
 
         }
 
-        public async Task<bool> GetHistoryUser()
+        private void InitCommand()
         {
-            bool isFound = false;
+            OpenFolderCommand = new DelegateCommand<FileOperation>(OpenFolder);
+            SelectedFolderCommand = new DelegateCommand<FolderBaseItem>(SelectedFolder);
 
-            //if (await GoogleDrive.GetHistoryUsers())
-            //{
-            //    isFound = true;
-            //}
-            return isFound;
+            OpenFileCommand = new DelegateCommand<FileOperation>(OpenFile);
+            UpLoadFileCommand = new DelegateCommand<FileOperation>(UpLoadFile);
 
-        }
-
-        #endregion
+            LoginCommand = new DelegateCommand<CloudBoxItem>(LoginUser);
+            RemoveUserCommand = new DelegateCommand<UserBaseItem>(RemoveUser);
 
+        }
 
+        #region 云盘公用接口
 
+        #endregion
 
         #region 用户帐号
 
         /// <summary>
         /// 登录
         /// </summary>
-        public void LoginUser()
+        private async void LoginUser(CloudBoxItem cloudDriveItem)
         {
-           
+            if (cloudDriveItem != null)
+                await CloudManager.LoginUser(cloudDriveItem.CloudDiskType);
+            
         }
 
         /// <summary>
         /// 移除用户
         /// </summary>
-        public void RemoveUser()
+        private async void RemoveUser(UserBaseItem user)
         {
+            if(user != null)
+            {
+              var result =  await CloudManager.RemoveUser(user);
+                if(result)
+                {
+                    FilesList.Clear();
+                    FolderItems.Clear();
+                }
+            }
+        }
 
+        #endregion
+
+
+        #region 文件
+
+        private async void OpenFolder(FileOperation fileOperation)
+        {
+            FilesList = await CloudManager.OpenFolder(fileOperation);
+            AddFolder(fileOperation);
         }
 
         /// <summary>
-        /// 切换用户
+        /// 在文件夹列表,选择文件夹
         /// </summary>
-        public void SwitchUser()
+        private void SelectedFolder(FolderBaseItem obj)
         {
-
+            if (obj != null)
+            {
+                var objIndex = FolderItems.IndexOf(obj);
+                var count = FolderItems.Count;
+
+                if (objIndex == count - 1)
+                    return;
+
+                if (obj.Level == -1)
+                {
+
+                    for (int i = 1; i < count; i++)
+                    {
+                        FolderItems.RemoveAt(i);
+                    }
+                }
+                else
+                {
+                    if (objIndex != -1)
+                    {
+                        for (int i = count - 1; i > objIndex; i--)
+                        {
+                            FolderItems.Remove(FolderItems[i]);
+                        }
+                    }
+                }
+
+                SelectedFolder(obj.Operation);
+            }
         }
 
+        /// <summary>
+        /// 在文件列表点击文件夹,而更新文件列表
+        /// </summary>
+        /// <param name="fileOperation"></param>
+        private async void SelectedFolder(FileOperation fileOperation)
+        {
+            FilesList = await CloudManager.OpenFolder(fileOperation);
+        }
 
-        #endregion
-
-
-        #region 文件
-        
-        public void GetFiles()
+        private void AddFolder(FileOperation folder)
         {
 
+            if (folder != null)
+            {
+                if (folder.DoFile != null)
+                {
+                    FolderBaseItem folderItem = new FolderBaseItem();
+                    folderItem.FolderName = folder.DoFile.Name;
+                    folderItem.Level = folder.DoFile.Level;
+                    folderItem.Operation = folder;
+                    FolderItems.Add(folderItem);
+                }
+                else
+                {
+                    FolderItems.Clear();
+                    FolderBaseItem folderItem = new FolderBaseItem();
+                    folderItem.FolderName = "云文档";
+                    folderItem.Level = -1;
+                    folderItem.Operation = folder;
+                    FolderItems.Add(folderItem);
+                }
+            }
         }
 
-        public void GetFolders()
+        /// <summary>
+        /// 下载并打开文件
+        /// </summary>
+        private async void OpenFile(FileOperation fileOperation)
         {
-
+            await CloudManager.OpenFile(fileOperation);
         }
 
-        public void UpLoad()
+        /// <summary>
+        /// 上传文件
+        /// </summary>
+        private async void UpLoadFile(FileOperation fileOperation)
         {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = Properties.Resources.OpenDialogFilter;
+            openFileDialog.Multiselect = true;
+            if ((bool)openFileDialog.ShowDialog())
+            {
+                if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
+                {
+                    fileOperation.SourceFile = openFileDialog.FileName;
+                    fileOperation.SourceFileName = openFileDialog.SafeFileName;
+                    var result = await CloudManager.UpLoadFile(fileOperation);
+                    if (result)
+                    {
+                        FilesList = await CloudManager.OpenFolder(fileOperation);
+                        MessageBox.Show("文件上传完成");
+                    }
+                    else
+                    {
+                        MessageBox.Show("文件上传失败");
+                    }
+                }
+            }
 
         }
         #endregion

+ 0 - 1
PDF Office/ViewModels/HomePanel/HomeCloudContentViewModel.cs

@@ -31,7 +31,6 @@ namespace PDF_Office.ViewModels.HomePanel
                     case CloudType.DropBox:
                         break;
                     case CloudType.GoogleDrive:
-                        //    isSccuess = await googleDriveViewModel.LoginUser();
                         break;
                     case CloudType.OneDrive:
                         break;

+ 11 - 11
PDF Office/ViewModels/HomePanel/HomeGuidContentViewModel.cs

@@ -38,11 +38,11 @@ namespace PDF_Office.ViewModels.HomePanel
             System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
             dlg.Multiselect = false;
             dlg.Filter = "PDF|*.pdf;*.PDF;";
-            if (toolItem.Tag == (int)PDFToolType.Compress || toolItem.Tag == (int)PDFToolType.Security)
+            if (toolItem.FnType == (int)PDFFnType.Compress || toolItem.FnType == (int)PDFFnType.Security)
             {
                 dlg.Multiselect = true;
             }
-                if (toolItem.Tag == (int)PDFToolType.Merge)
+                if (toolItem.FnType == (int)PDFFnType.Merge)
             {
                 dlg.Multiselect = true;
                 dlg.Filter = "Picture|*.png;*.PNG;*.jpg;*.JPG;*bmp;*jpeg;*gif;*tiff;";
@@ -51,9 +51,9 @@ namespace PDF_Office.ViewModels.HomePanel
             {
                 CPDFViewer viewer = new CPDFViewer();
                 
-                switch ((PDFToolType)toolItem.Tag)
+                switch ((PDFFnType)toolItem.FnType)
                 {
-                    case PDFToolType.Split:
+                    case PDFFnType.Split:
                         
                         viewer.InitDocument(dlg.FileName);
                         DialogParameters splitvalue = new DialogParameters();
@@ -62,7 +62,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePageSplitDialog, splitvalue, e => { });
                         break;
 
-                    case PDFToolType.Extract:
+                    case PDFFnType.Extract:
                         viewer.InitDocument(dlg.FileName);
                         DialogParameters extractvalue = new DialogParameters();
                         extractvalue.Add(ParameterNames.PDFViewer, viewer);
@@ -70,7 +70,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePageExtractDialog, extractvalue, e => { });
                         break;
 
-                    case PDFToolType.Insert:
+                    case PDFFnType.Insert:
                         viewer.InitDocument(dlg.FileName);
                         DialogParameters insertvalue = new DialogParameters();
                         insertvalue.Add(ParameterNames.PDFViewer, viewer);
@@ -78,7 +78,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePageInsertDialog, insertvalue, e => { });
                         break;
 
-                    case PDFToolType.Compress:
+                    case PDFFnType.Compress:
                         DialogParameters compresspdf = new DialogParameters();
                         compresspdf.Add(ParameterNames.BatchProcessing_Name, "1");
                         HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
@@ -87,13 +87,13 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, compresspdf, e => { });
                         break;
 
-                    case PDFToolType.Merge:
+                    case PDFFnType.Merge:
                         DialogParameters picturetopdf = new DialogParameters();
                         picturetopdf.Add(ParameterNames.FilePath, dlg.FileNames);
                         dialogs.ShowDialog(DialogNames.HomePagePictureToPDFDialog, picturetopdf, e => { });
                         break;
 
-                    case PDFToolType.Print:
+                    case PDFFnType.Print:
                         viewer.InitDocument(dlg.FileName);
                         DialogParameters printvalue = new DialogParameters();
                         printvalue.Add(ParameterNames.PDFViewer, viewer);
@@ -101,7 +101,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePagePrinterDialog, printvalue, e => { });
                         break;
 
-                    case PDFToolType.Security:
+                    case PDFFnType.Security:
                         DialogParameters securitypdf = new DialogParameters();
                         securitypdf.Add(ParameterNames.BatchProcessing_Name, "2");
                         HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();
@@ -110,7 +110,7 @@ namespace PDF_Office.ViewModels.HomePanel
                         dialogs.ShowDialog(DialogNames.HomePageBatchProcessingDialog, securitypdf, e => { });
                         
                         break;
-                    case PDFToolType.ConvertPDF:
+                    case PDFFnType.ConvertPDF:
                         DialogParameters convertpdf = new DialogParameters();
                         convertpdf.Add(ParameterNames.BatchProcessing_Name, "0");
                         HomePageBatchProcessingDialogModel.FilePaths = dlg.FileNames.ToList();

File diff suppressed because it is too large
+ 651 - 153
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs


+ 220 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/CustomCreateDialogViewModel.cs

@@ -0,0 +1,220 @@
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
+{
+    class CustomCreateDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => ".";
+
+        public event Action<IDialogResult> RequestClose;
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand CreateCommnad { get; set; }
+
+        public DelegateCommand UpDataDynamicCommnad { get; set; }
+
+        public DelegateCommand<object> KeyDown { get; set; }
+
+        private BitmapSource imageSource;
+        public BitmapSource ImageSource
+        {
+            get { return imageSource; }
+            set
+            {
+                SetProperty(ref imageSource, value);
+            }
+        }
+        private string stampText = "Stamp Text";
+
+        public string StampText
+        {
+            get { return stampText; }
+            set
+            {
+                SetProperty(ref stampText, value);
+            }
+        }
+        private bool isCheckedDate;
+
+        public bool IsCheckedDate
+        {
+            get { return isCheckedDate; }
+            set
+            {
+                SetProperty(ref isCheckedDate, value);
+                UpDataStamp();
+            }
+        }
+        private bool isCheckedTime;
+
+        public bool IsCheckedTime
+        {
+            get { return isCheckedTime; }
+            set
+            {
+                SetProperty(ref isCheckedTime, value);
+                UpDataStamp();
+            }
+        }
+
+        private C_TEXTSTAMP_SHAPE shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
+
+        public C_TEXTSTAMP_SHAPE Shape
+        {
+            get { return shape; }
+            set { shape = value; }
+        }
+
+        private C_TEXTSTAMP_COLOR color = C_TEXTSTAMP_COLOR.TEXTSTAMP_RED;
+
+        public C_TEXTSTAMP_COLOR Color
+        {
+            get { return color; }
+            set { color = value; }
+        }
+
+
+        public void SetStampStyle(int index)
+        {
+            switch (index)
+            {
+                case 1:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_WHITE;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_NONE;
+                    break;
+                case 2:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_WHITE;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
+                    break;
+                case 3:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
+                    break;
+                case 4:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_RED;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
+                    break;
+                case 5:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_BLUE;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT;
+                    break;
+                case 6:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_LEFT_TRIANGLE;
+                    break;
+                case 7:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_RED;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_LEFT_TRIANGLE;
+                    break;
+                case 8:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_BLUE;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_LEFT_TRIANGLE;
+                    break;
+                case 9:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RIGHT_TRIANGLE;
+                    break;
+                case 10:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_RED;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RIGHT_TRIANGLE;
+                    break;
+                case 11:
+                    Color = C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN;
+                    Shape = C_TEXTSTAMP_SHAPE.TEXTSTAMP_RIGHT_TRIANGLE;
+                    break;
+                default:
+                    break;
+            }
+            UpDataStamp();
+        }
+
+        public CustomCreateDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(Cancel);
+            CreateCommnad = new DelegateCommand(Create);
+            UpDataDynamicCommnad = new DelegateCommand(UpDataStamp);
+            KeyDown = new DelegateCommand<object>(PreviewKeyDown);
+        }
+        private void Cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void Create()
+        {
+
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true; 
+        }
+
+        public void OnDialogClosed()
+        {
+            return;
+        }
+        private void PreviewKeyDown(object e)
+        {
+            var args = e as KeyEventArgs;
+            if (args == null)
+            {
+                return;
+            }
+            if (args.Key == Key.Enter)
+            {
+                StampText = (args.OriginalSource as TextBox).Text;
+                UpDataStamp();
+            }
+        }
+        private void UpDataStamp()
+        {
+            string date = "";
+            string dateType = "";
+            if (IsCheckedDate)
+            {
+                dateType = "yyyy-MM-dd";
+            }
+            if (IsCheckedTime)
+            {
+                dateType= dateType+ " HH:mm:ss";
+            }
+            if (!String.IsNullOrEmpty(dateType))
+            {
+                date = DateTime.Now.ToString(dateType);
+            }
+            
+            var bytes = CPDFStampAnnotation.GetTempTextStampImage(StampText, date,
+            Shape, Color, out int stampWidth, out int stampHeight, out int width, out int height);
+            if (bytes.Length > 0)
+            {
+                PixelFormat fmt = PixelFormats.Bgra32;
+                BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, bytes, (width * fmt.BitsPerPixel + 7) / 8);
+                ImageSource = bps;
+            }
+            else
+            {
+                ImageSource = null;
+            }
+        }
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            UpDataStamp();
+            return;
+        }
+    }
+}

+ 105 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/DynamicPropertyDialogViewModel.cs

@@ -0,0 +1,105 @@
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
+{
+    class DynamicPropertyDialogViewModel : BindableBase, IDialogAware
+    {
+        public string Title => ".";
+
+        public event Action<IDialogResult> RequestClose;
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand ApplyCommnad { get; set; }
+        public ObservableCollection<string> DateFormatList { get; set; }
+
+
+        private bool isChecked = true;
+
+        public bool IsChecked
+        {
+            get { return isChecked; }
+            set
+            {
+                SetProperty(ref isChecked, value);
+            }
+        }
+        private string author = "Kdan";
+
+        public string Author
+        {
+            get { return author; }
+            set
+            {
+                SetProperty(ref author, value);
+            }
+        }
+
+        private int selectedIndex = 0;
+
+        public int SelectedIndex
+        {
+            get { return selectedIndex; }
+            set
+            {
+                SetProperty(ref selectedIndex, value);
+            }
+        }
+
+
+
+        public DynamicPropertyDialogViewModel()
+        {
+            CancelCommand = new DelegateCommand(Cancel);
+            ApplyCommnad = new DelegateCommand(Apply);
+            DateFormatList = new ObservableCollection<string> 
+            { 
+                "Defualt", 
+                "M/d", "M/d/yy", "M/d/yyyy", "MM/dd/yy","MM/dd/yyyy",
+                "d/M/y","d/M/yyy","dd/MM/yy","dd/MM/yyy","MM/yy","MM/yyyy",
+                "M.d.y","M.d.yyyy","MM.dd.yy","MM.dd.yyyy","MM/yy","MM/yyyy",
+                "d.M.y","d.M.yyyy","dd.MM.yy","dd.MM.yyyy","yy-MM-dd","yyyy-MM-dd"
+            };
+        }
+        private void Cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void Apply()
+        {
+            DialogParameters valuePairs = new DialogParameters();
+            valuePairs.Add(ParameterNames.DataModel, this);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
+        }
+
+        public bool CanCloseDialog()
+        {
+            return true;
+        }
+
+        public void OnDialogClosed()
+        {
+            return;
+        }
+
+        public void OnDialogOpened(IDialogParameters parameters)
+        {
+            return;
+        }
+    }
+}

+ 9 - 0
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using PDF_Office.Model;
+using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -92,6 +93,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+      
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
@@ -113,6 +115,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             SelectedValueChangedCommand = new DelegateCommand<object>(SelectedValueChanged_Command);
             SelectPenThickChangedCommand = new DelegateCommand<object>(SelectPenThickChanged_Command);
             SetEraserThickCommand = new DelegateCommand<object>(SelectEraserThickChanged_Command);
+
+            InitVariable();
+        }
+
+        private void InitVariable()
+        {
+
         }
 
         private void SelectEraserThickChanged_Command(object obj)

+ 85 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -1,6 +1,7 @@
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using PDF_Office.Model;
+using PDF_Office.Model.PropertyPanel.AnnotPanel;
 using PDF_Office.ViewModels.Tools;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -28,7 +29,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-        private Brush selectColor = new SolidColorBrush(Colors.Transparent);
+        private Brush selectColor = new SolidColorBrush(Colors.Black);
         public Brush SelectColor
         {
             get { return selectColor; }
@@ -93,7 +94,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        private List<FontStyleItem> fontStyleList = new List<FontStyleItem>();
+        public List<FontStyleItem> FontStyleList
+        {
+            get { return fontStyleList; }
+            set
+            {
+                SetProperty(ref fontStyleList, value);
+            }
+        }
 
+        public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
+        public DelegateCommand<object> SelectedFontStyleCommand { get; set; }
         public DelegateCommand<object> SelectedColorCommand { get; set; }
         public DelegateCommand<object> SelectedFillColorCommand { get; set; }
         public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
@@ -105,14 +117,60 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
         public event EventHandler<object> LoadPropertyHandler;
         public FreetextAnnotPropertyViewModel()
         {
+            SelectedFillOpacityCommand = new DelegateCommand<object>(SelectedFillOpacity);
+            SelectedFontStyleCommand = new DelegateCommand<object>(SelectedFontStyle);
             SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
             SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
             FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged_Command);
             FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged_Command);
             FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged_Command);
             TextAlignChecked = new DelegateCommand<object>(TextAlign_Checked);
+            InitVariable();
+        }
+
+        private void InitVariable()
+        {
+            InitFontStyles();
         }
 
+        private void InitFontStyles()
+        {
+            FontStyleItem custom = new FontStyleItem();
+            custom.mFontSize = 32;
+            custom.mFontStyleName = "自定义";
+
+            FontStyleItem h1 = new FontStyleItem();
+            h1.mFontSize = 24;
+            h1.mFontStyleName = "H1大标题";
+
+            FontStyleItem h2 = new FontStyleItem();
+            h2.mFontSize = 16;
+            h2.mFontStyleName = "h2(标准)";
+
+            FontStyleItem h3 = new FontStyleItem();
+            h3.mFontSize = 10;
+            h3.mFontStyleName = "H3小标题";
+
+            FontStyleItem b1 = new FontStyleItem();
+            b1.mFontSize = 8;
+            b1.mFontStyleName = "B1标题";
+
+            FontStyleItem b2 = new FontStyleItem();
+            b2.mFontSize = 6;
+            b2.mFontStyleName = "B2标题";
+
+            FontStyleItem b3 = new FontStyleItem();
+            b3.mFontSize = 4;
+            b3.mFontStyleName = "B3标题";
+
+            FontStyleList.Add(custom);
+            FontStyleList.Add(h1);
+            FontStyleList.Add(h2);
+            FontStyleList.Add(h3);
+            FontStyleList.Add(b1);
+            FontStyleList.Add(b2);
+            FontStyleList.Add(b3);
+        }
         private void TextAlign_Checked(object obj)
         {
             if (obj != null && (string)obj != null)
@@ -135,6 +193,31 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
+        private void SelectedFontStyle(object obj)
+        {
+            if (obj != null && (FontStyleItem)obj != null)
+            {
+                var item = (FontStyleItem)obj;
+
+                AnnotEvent?.UpdateAttrib(AnnotAttrib.FontSize, item.mFontSize);
+
+                AnnotEvent?.UpdateAnnot();
+
+            }
+        }
+
+        private void SelectedFillOpacity(object obj)
+        {
+            if (obj != null)
+            {
+                FillOpacity = (double)obj;
+                SelectColor.Opacity = FillOpacity;
+
+                AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
+                AnnotEvent?.UpdateAnnot();
+            }
+        }
+
         private void FontSizeChanged_Command(object obj)
         {
             if (obj != null)
@@ -144,6 +227,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                 if (content != null)
                 {
                     var intData = int.Parse(content);
+                    TextFontSize = intData;
                     AnnotEvent?.UpdateAttrib(AnnotAttrib.FontSize, intData);
                    
                     AnnotEvent?.UpdateAnnot();

+ 363 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StampAnnotPropertyViewModel.cs

@@ -1,12 +1,373 @@
-using System;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using PDF_Office.Model.AnnotPanel;
+using Prism.Commands;
+using Prism.Mvvm;
+using Prism.Regions;
+using Prism.Services.Dialogs;
+using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using static Dropbox.Api.Files.FileCategory;
 
 namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
 {
-    internal class StampAnnotPropertyViewModel
+    internal class StampAnnotPropertyViewModel : BindableBase, INavigationAware
     {
+        #region 标准图章相关默认配置(如果需要修改,要留意按顺序一一对应的,如果要支持多语,Path则需要替换成SDK获取图片的方法,并修改对应参数与实现代码)
+
+        List<string> Path = new List<string>
+        {
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Approved.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/NotApproved.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Completed.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Final.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Draft.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Confidential.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/ForPublicRelease.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/NotForPublicRelease.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/ForComment.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Void.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/PreliminaryResults.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/InformationOnly.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Accepted.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Rejected.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/Witness.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/InitialHere.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/SignHere.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/revised.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/PrivateMark1.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/PrivateMark2.png",
+            "pack://application:,,,/PDF Office;component/Resources/StampIcons/PrivateMark3.png",
+        };
+        List<string> StampText = new List<string>
+        {
+            "Approved","NotApproved","Completed","Final","Draft","Confidential","ForPublicRelease","NotForPublicRelease",
+            "ForComment","Void","PreliminaryResults","InformationOnly","Accepted","Rejected","Witness","InitialHere","SignHere",
+            "revised","PrivateMark#1","PrivateMark#2","PrivateMark#3"
+        };
+        List<int> MaxWidth = new List<int>
+        {
+            218,292,234,130,150,280,386,461,282,121,405,366,30,30,133,133,133,173,30,30,30
+        };
+        List<int> MaxHeight = new List<int>
+        {
+           66,66,66,66,66,66,66,66,66,66,66,66,30,30,39,39,39,66,30,30,30
+        };
+
+        #endregion
+
+        #region 动态图章相关配置(需要支持多语则修改DynamicStampText的内容)
+
+        List<string> DynamicStampText = new List<string>
+        {
+            "REVISED","REVIEWED","Completed","RECEIVED","APPROVED","CONFIDENTIAL"
+        };
+        List<C_TEXTSTAMP_COLOR> DynamicColor = new List<C_TEXTSTAMP_COLOR>
+        {
+          C_TEXTSTAMP_COLOR.TEXTSTAMP_RED,  C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,
+          C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,
+          C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN,C_TEXTSTAMP_COLOR.TEXTSTAMP_RED,
+        };
+
+        #endregion
+
+        private string author = "12312";
+
+        public string Author
+        {
+            get { return author; }
+            set
+            {
+                SetProperty(ref author, value);
+            }
+        }
+
+        private bool isSetAuthor = false;
+
+        public bool IsSetAuthor
+        {
+            get { return isSetAuthor; }
+            set
+            {
+                SetProperty(ref isSetAuthor, value);
+            }
+        }
+
+        private int tabControlSelectedIndex = 0;
+
+        public int TabControlSelectedIndex
+        {
+            get { return tabControlSelectedIndex; }
+            set
+            {
+                SetProperty(ref tabControlSelectedIndex, value);
+                if (tabControlSelectedIndex == 0)
+                {
+                    UnStandard = false;
+                }
+                else
+                {
+                    UnStandard = true;
+                }
+            }
+        }
+
+        private bool unStandard;
+        /// <summary>
+        /// 判断当前是否为非标准图章,控制UI展示
+        /// </summary>
+        public bool UnStandard
+        {
+            get { return unStandard; }
+            set
+            {
+                SetProperty(ref unStandard, value);
+            }
+        }
+        /// <summary>
+        /// 日期格式
+        /// </summary>
+        private string dateType = "F";
+
+        private IDialogService dialogs;
+
+        public DelegateCommand ShowDialogCommand { get; set; }
+
+        private CPDFViewer PDFViewer;
+        public ObservableCollection<Stamp> StandardStampList { get; set; }
+        public ObservableCollection<Stamp> DynamicStampList { get; set; }
+        public ObservableCollection<Stamp> CustomStampList { get; set; }
+
+        public StampAnnotPropertyViewModel(IDialogService dialogService)
+        {
+            dialogs = dialogService;
+            StandardStampList = new ObservableCollection<Stamp>();
+            DynamicStampList = new ObservableCollection<Stamp>();
+            CustomStampList = new ObservableCollection<Stamp>();
+            ShowDialogCommand = new DelegateCommand(ShowDialog);
+            InitStandardStamp();
+            UpDataDynamicStampList();
+            //CPDFDocument doc = CPDFDocument.CreateDocument();
+            //bool tt= doc.InsertPage(0, 300, 500, Path[0]);
+            //doc.WriteToFilePath("D:\\fafdas.pdf");
+            //doc.Release();
+        }
+
+        /// <summary>
+        /// 初始化标准图章相关内容
+        /// </summary>
+        private void InitStandardStamp()
+        {
+            for (int i = 0; i < Path.Count; i++)
+            {
+                Stamp standardStamp = new Stamp();
+                standardStamp.Author = "";
+                standardStamp.Opacity = 1;
+                standardStamp.SourcePath = Path[i];
+                standardStamp.StampText = StampText[i];
+                standardStamp.MaxWidth = MaxWidth[i];
+                standardStamp.MaxHeight = MaxHeight[i];
+                standardStamp.Type = StampType.STANDARD_STAMP;
+                StandardStampList.Add(standardStamp);
+            }
+        }
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            return;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer == null)
+            {
+                return;
+            }
+        }
+
+        /// <summary>
+        /// 在PDFView上创建图章的统一方法
+        /// </summary>
+        /// <param name="stamp"></param>
+        public void SetStamp(Stamp stamp)
+        {
+            StampAnnotArgs Args = new StampAnnotArgs();
+            Args.StampText = stamp.StampText;
+            Args.Author = stamp.Author;
+            Args.Opacity = stamp.Opacity;
+            Args.MaxWidth = stamp.MaxWidth;
+            Args.MaxHeight = stamp.MaxHeight;
+            Args.StampTextDate = stamp.StampTextDate;
+            Args.TextColor = stamp.TextColor;
+            if (!string.IsNullOrEmpty(stamp.SourcePath))
+            {
+                BitmapImage image = new BitmapImage(new Uri(stamp.SourcePath));
+                Args.ImageArray = new byte[image.PixelWidth * image.PixelHeight * 4];
+                image.CopyPixels(Args.ImageArray, image.PixelWidth * 4, 0);
+                Args.ImageHeight = image.PixelHeight;
+                Args.ImageWidth = image.PixelWidth;
+            }
+            else
+            {
+                Args.ImageArray = new byte[stamp.ImageSource.PixelWidth * stamp.ImageSource.PixelHeight * 4];
+                stamp.ImageSource.CopyPixels(Args.ImageArray, stamp.ImageSource.PixelWidth * 4, 0);
+                Args.ImageHeight = stamp.ImageSource.PixelHeight;
+                Args.ImageWidth = stamp.ImageSource.PixelWidth;
+            }
+            Args.Type = stamp.Type;
+            PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+            PDFViewer.SetToolParam(Args);
+        }
+
+        /// <summary>
+        /// 更新动态图章对象相关属性
+        /// </summary>
+        public void UpDataDynamicStampList()
+        {
+            CPDFDocument doc = CPDFDocument.CreateDocument();
+            bool tt = doc.InsertPage(0, 300, 500, null);
+            CPDFPage docPage = doc.PageAtIndex(0);
+            CPDFStampAnnotation stampCore = docPage.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_STAMP) as CPDFStampAnnotation;
+            var x = stampCore.GetTextAttribute();
+            DynamicStampList.Clear();
+            for (int i = 0; i < DynamicStampText.Count; i++)
+            {
+                string date = "";
+                //区分机密(CONFIDENTIAL)和其他动态图章的区别
+                if (i < DynamicStampText.Count - 1)
+                {
+                    date = System.DateTime.Now.ToString(dateType);
+                }
+
+                Stamp standardStamp = new Stamp();
+                if (IsSetAuthor && !string.IsNullOrEmpty(Author))
+                {
+                    standardStamp.Author = Author;
+                    if (i < DynamicStampText.Count - 1)
+                    {
+                        standardStamp.StampTextDate = "By " + Author + " at " + date;
+                    }
+                    else
+                    {
+                        standardStamp.StampTextDate = Author;
+                    }
+
+                }
+                else
+                {
+                    standardStamp.StampTextDate = date;
+                    standardStamp.Author = "";
+                }
+
+                var bytes = CPDFStampAnnotation.GetTempTextStampImage(DynamicStampText[i], standardStamp.StampTextDate,
+                C_TEXTSTAMP_SHAPE.TEXTSTAMP_RECT, DynamicColor[i], out int stampWidth, out int stampHeight, out int width, out int height);
+                PixelFormat fmt = PixelFormats.Bgra32;
+                BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, bytes, (width * fmt.BitsPerPixel + 7) / 8);
+
+
+
+                standardStamp.Opacity = 1;
+                standardStamp.SourcePath = "";
+                standardStamp.StampText = DynamicStampText[i];
+                standardStamp.MaxWidth = stampWidth;
+                standardStamp.MaxHeight = stampHeight;
+                standardStamp.Type = StampType.TEXT_STAMP;
+                standardStamp.ImageSource = bps;
+                switch (DynamicColor[i])
+                {
+                    case C_TEXTSTAMP_COLOR.TEXTSTAMP_WHITE:
+                        break;
+                    case C_TEXTSTAMP_COLOR.TEXTSTAMP_RED:
+                        standardStamp.TextColor = TextStampColor.TEXTSTAMP_RED;
+                        break;
+                    case C_TEXTSTAMP_COLOR.TEXTSTAMP_GREEN:
+                        standardStamp.TextColor = TextStampColor.TEXTSTAMP_GREEN;
+                        break;
+                    case C_TEXTSTAMP_COLOR.TEXTSTAMP_BLUE:
+                        break;
+                    default:
+                        break;
+                }
+                DynamicStampList.Add(standardStamp);
+            }
+        }
+
+        private void ShowDialog()
+        {
+            switch (TabControlSelectedIndex)
+            {
+                case 1:
+                    ShowDynamicPropertyDialog();
+                    break;
+                case 2:
+                    ShowCustomCreateDialog();
+                    break;
+                default:
+                    break;
+            }
+
+        }
+        private void ShowDynamicPropertyDialog()
+        {
+            bool result = true;
+            dialogs.ShowDialog(DialogNames.DynamicPropertyDialog, null, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                DynamicPropertyDialogViewModel DynamicVM = e.Parameters.GetValue<DynamicPropertyDialogViewModel>(ParameterNames.DataModel);
+                if (DynamicVM != null)
+                {
+                    Author = DynamicVM.Author;
+                    IsSetAuthor = DynamicVM.IsChecked;
+                    //需要加多语判断
+                    dateType = DynamicVM.SelectedIndex == 0 ? "F" : DynamicVM.DateFormatList[DynamicVM.SelectedIndex] + " HH:mm:ss";
+                    UpDataDynamicStampList();
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
+
+        private void ShowCustomCreateDialog()
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.CustomCreateDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                CustomCreateDialogViewModel CustomVM = e.Parameters.GetValue<CustomCreateDialogViewModel>(ParameterNames.DataModel);
+                if (CustomVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
     }
 }

+ 0 - 12
PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextEditPropertyViewModel.cs

@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
-{
-    internal class TextEditPropertyViewModel
-    {
-    }
-}

+ 32 - 0
PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs

@@ -0,0 +1,32 @@
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.PropertyPanel
+{
+    public class TextEditPropertyViewModel : BindableBase, INavigationAware
+    {
+        public TextEditPropertyViewModel()
+        {
+
+        }
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+
+        }
+    }
+}

+ 8 - 3
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -357,7 +357,6 @@ namespace PDF_Office.ViewModels.Tools
             stickyAnnotArgs.Color = Color.FromRgb(0xFF, 0x81, 0x33);
             stickyAnnotArgs.StickyNote = string.Empty;
             stickyAnnotArgs.Transparency = 1;
-
             DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotSticky);
             if (annotProperty != null)
             {
@@ -562,7 +561,7 @@ namespace PDF_Office.ViewModels.Tools
             stampAnnotArgs.Type = StampType.STANDARD_STAMP;
 
             annotAttribsList[AnnotAttrib.Transparency] = stampAnnotArgs.Opacity;
-
+             
             AddToPropertyPanel(stampAnnotArgs, null, "StampAnnotProperty", annotAttribsList);
             return stampAnnotArgs;
         }
@@ -587,7 +586,13 @@ namespace PDF_Office.ViewModels.Tools
             return stampArgs;
         }
 
-
+        /// <summary>
+        /// 添加到属性面板
+        /// </summary>
+        /// <param name="annot"></param>
+        /// <param name="toolTag">导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线</param>
+        /// <param name="viewContent">对应的注释面板</param>
+        /// <param name="annotAttribsList">更改注释属性的键值对,更改值后会自动记录undoRedo容器里</param>
         private void AddToPropertyPanel(AnnotHandlerEventArgs annot, string toolTag, string viewContent, Dictionary<AnnotAttrib, object> annotAttribsList)
         {
             if (string.IsNullOrEmpty(toolTag) == false)

+ 6 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -13,7 +13,7 @@ namespace PDF_Office.ViewModels.Tools
 { 
 
     /// <summary>
-    /// 改变工具栏注释属性值
+    /// 改变工具栏注释属性值,主要用来传参数:注释属性和同步工具栏对应图标的属性(颜色)
     /// </summary>
     public class AnnotPropertyPanel
     {
@@ -24,6 +24,11 @@ namespace PDF_Office.ViewModels.Tools
         public event EventHandler<object> DefaultStored;
         public AnnotPropertyPanel(){ }
 
+        /// <summary>
+        /// 触发到工具栏注释工具,改变工具图标下的颜色值
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="keyValues"></param>
         public void DataChangedInvoke(object sender, Dictionary<AnnotArgsType, object> keyValues)
         {
             DataChanged?.Invoke(sender, keyValues);

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

@@ -115,7 +115,12 @@ namespace PDF_Office.ViewModels.Tools
                     annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
-                   
+                }
+                else
+                {
+                    PDFViewer.SetMouseMode(MouseModes.PanTool);
+                    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                    ShowPropertyPanel(false);
                 }
                 ShowPropertyPanel();
 

+ 29 - 0
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -0,0 +1,29 @@
+using Prism.Commands;
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.Tools
+{
+    public class TextEditToolContentViewModel: BindableBase
+    {
+       private ComPDFKitViewer.PDFEditEvent TextEditEvent;
+        public DelegateCommand<object> AddContentCommand { get; set; }
+        public TextEditToolContentViewModel()
+        {
+            AddContentCommand = new DelegateCommand<object>(AddContent);
+        }
+
+        public void AddContent(object obj)
+        {
+           if(TextEditEvent != null)
+            {
+
+            }
+        }
+
+    }
+}

+ 104 - 155
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -23,7 +23,6 @@ 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
 {
@@ -31,7 +30,7 @@ namespace PDF_Office.ViewModels
     {
         #region 属性、变量
 
-        public CPDFViewer PDFViewer { get; set; }
+        private CPDFViewer PDFViewer { get; set; }
 
         private MainContentViewModel mainViewModel { get; set; }
 
@@ -52,7 +51,8 @@ namespace PDF_Office.ViewModels
         public string ReadModeRegionName { get; set; }
 
         public string ConverterBarContentRegionName { get; set; }
-
+        public string TextEditContentRegionName { get; set; }
+        
         public string BackgroundContentRegionName { get; set; }
 
         /// <summary>
@@ -61,22 +61,19 @@ 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; }
@@ -217,6 +214,22 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private Visibility textEditToolContentVisible = Visibility.Collapsed;
+
+        /// <summary>
+        /// 控制ToolsBarContent的显示
+        /// 留意:显示前需要先注入内容、设置好行和跨行数
+        /// </summary>
+        public Visibility TextEditToolContentVisible
+        {
+            get { return textEditToolContentVisible; }
+            set
+            {
+                SetProperty(ref textEditToolContentVisible, value);
+            }
+        }
+
+
         private bool isPorpertyOpen = false;
 
         /// <summary>
@@ -403,6 +416,7 @@ namespace PDF_Office.ViewModels
             ToolContentRegionName = Guid.NewGuid().ToString();
             ToolsBarContentRegionName = Guid.NewGuid().ToString();
             ConverterBarContentRegionName = Guid.NewGuid().ToString();
+            TextEditContentRegionName = Guid.NewGuid().ToString();
 
             ToolContentVisible = Visibility.Collapsed;
             ToolsBarContentVisible = Visibility.Collapsed;
@@ -430,7 +444,7 @@ namespace PDF_Office.ViewModels
             dictionary.Add("TabItemAnnotation", ToolsBarContentRegionName);
             dictionary.Add("TabItemConvert", ConverterBarContentRegionName);
             dictionary.Add("TabItemScan", ToolsBarContentRegionName);
-            dictionary.Add("TabItemEdit", ToolsBarContentRegionName);
+            dictionary.Add("TabItemEdit", TextEditContentRegionName);
             dictionary.Add("TabItemForm", ToolsBarContentRegionName);
             dictionary.Add("TabItemFill", ToolsBarContentRegionName);
         }
@@ -442,7 +456,7 @@ namespace PDF_Office.ViewModels
             dictionary.Add("TabItemAnnotation", "AnnotToolContent");
             dictionary.Add("TabItemConvert", "ConverterBarContent");
             dictionary.Add("TabItemScan", "");
-            dictionary.Add("TabItemEdit", "");
+            dictionary.Add("TabItemEdit", "TextEditToolContent");
             dictionary.Add("TabItemForm", "");
             dictionary.Add("TabItemFill", "FillAndSignContent");
         }
@@ -452,16 +466,25 @@ namespace PDF_Office.ViewModels
             ToolContentVisible = Visibility.Collapsed;
             ToolsBarContentVisible = Visibility.Collapsed;
             ConverterBarContentVisible = Visibility.Collapsed;
+            TextEditToolContentVisible = Visibility.Collapsed;
+
             switch (currentBar)
             {
                 case "TabItemAnnotation":
                 case "TabItemScan":
                 case "TabItemTool":
                 case "TabItemForm":
-                case "TabItemEdit":
                     ToolsBarContentVisible = Visibility.Visible;
                     break;
-
+                case "TabItemEdit":
+                    TextEditToolContentVisible = Visibility.Visible;
+                    IsPropertyOpen = true;
+                    if (IsPropertyOpen == true)
+                    {
+                        PDFViewer.SetMouseMode(MouseModes.PDFEdit);
+                        SelectedPrpoertyPanel("TextEditProperty", null);
+                    }
+                    break;
                 case "TabItemConvert":
                     ConverterBarContentVisible = Visibility.Visible;
                     break;
@@ -471,7 +494,6 @@ namespace PDF_Office.ViewModels
                 case "BackgroundContent":
                     ToolContentVisible = Visibility.Visible;
                     break;
-
                 default:
                     break;
             }
@@ -630,31 +652,37 @@ 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");
+            }
+            ));
         }
 
+        /// <summary>
+        /// 各个注释(选中和创建注释)导航到对应注释的属性面板
+        /// </summary>
+        /// <param name="Content"></param>
+        /// <param name="annotPropertyPanel"></param>
         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>
@@ -719,48 +747,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
                 {
@@ -805,7 +833,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;
             }
@@ -973,85 +1001,6 @@ namespace PDF_Office.ViewModels
             }
         }
 
-        public async void RbtnReadMode(ViewContent viewContent)
-        {
-            App.IsBookMode = true;
-            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;
-            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 方法
     }
 }

+ 138 - 0
PDF Office/Views/BOTA/OutLineControl.xaml

@@ -0,0 +1,138 @@
+<UserControl x:Class="PDF_Office.Views.BOTA.OutLineControl"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
+             xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
+             xmlns:model="clr-namespace:PDF_Office.Model.BOTA"
+             xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA" d:DataContext="{d:DesignInstance Type=bota:OutLineControlViewModel}"
+             mc:Ignorable="d" 
+             x:Name="ttt">
+    <UserControl.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/OutLineItemStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+
+        </ResourceDictionary>
+    </UserControl.Resources>
+    <Grid  Background="Transparent">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="40"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <Grid x:Name="Header">
+            <TextBlock x:Name="TxtTitle" Margin="12,0,0,0" HorizontalAlignment="Left"
+                    VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold" Text="Outline" />
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                <customcontrol:PathButton
+            Height="24" Width="24"  IconHeight="20"  IconWidth="20" 
+            Icon="{StaticResource Ic_AddButtonPath}"  IconFill="Red"
+            IconPress="{StaticResource Ic_AddButtonPath}" IconPressFill="#C04CF8"
+            IconMouseOver="{StaticResource Ic_AddButtonPath}" IconMouseOverFill="#C04CF8" />
+                <customcontrol:PathButton
+                    x:Name="BtnMore"
+                    Click="BtnMore_Click"
+            Height="24" Width="24"  IconHeight="20"  IconWidth="20" 
+            Icon="{StaticResource Ic_MoreButtonPath}"  IconFill="Red"
+            IconPress="{StaticResource Ic_MoreButtonPath}" IconPressFill="#C04CF8"
+            IconMouseOver="{StaticResource Ic_MoreButtonPath}" IconMouseOverFill="#C04CF8" >
+                    <customcontrol:PathButton.ContextMenu>
+                        <ContextMenu
+                            Name="MenuMore">
+                            <ContextMenu.ItemContainerStyle>
+                                <Style TargetType="MenuItem">
+                                    <Setter Property="Padding" Value="-25,7,-40,7" />
+                                    <Setter Property="VerticalContentAlignment" Value="Center" />
+                                </Style>
+                            </ContextMenu.ItemContainerStyle>
+                            <MenuItem
+                                Name="MenuDeleteAll"
+                                Command="{Binding DeleteAllCommand}"
+                                Header="Delete All Outline" />
+                            <MenuItem
+                                Name="MenuExpandAll"
+                                Command="{Binding ExpandAllCommand}"
+                                CommandParameter="{Binding Outlinelist}"
+                                Header="一键展开" />
+                            <MenuItem
+                                Name="MenuCollapseAll"
+                               Command="{Binding CollapseAllCommand}"
+                                CommandParameter="{Binding Outlinelist}"
+                                Header="一键折叠" />
+                        </ContextMenu>
+                    </customcontrol:PathButton.ContextMenu>
+                </customcontrol:PathButton>
+            </StackPanel>
+        </Grid>
+
+        <StackPanel Margin="10,0" x:Name="FirstOulineLine" Orientation="Horizontal"  VerticalAlignment="Bottom" Visibility="{Binding IsInsertHead,Converter={StaticResource BoolToVisible}}">
+            <Ellipse Width="8" Height="8" Fill="White" Stroke="#FF0078D7" StrokeThickness="1.5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
+            <Rectangle Margin="-1,0,0,2" Width="{Binding ElementName=Header,Path=ActualWidth}" HorizontalAlignment="Stretch" Height="1.5" StrokeDashArray="2" VerticalAlignment="Bottom" Fill="#FF0078D7"/>
+        </StackPanel>
+        <Grid Grid.Row="1"
+               DragOver="Grid_DragOver"
+              DragLeave="Grid_DragLeave">
+            <TreeView x:Name="OutlineView" Grid.Row="1" ItemsSource="{Binding Outlinelist}"
+                BorderThickness="0" AllowDrop="True"
+                VirtualizingPanel.ScrollUnit="Pixel"
+                Drop="OutlineView_Drop"
+                PreviewMouseMove="OutlineView_PreviewMouseMove" 
+                PreviewMouseLeftButtonUp="OutlineView_PreviewMouseLeftButtonUp"
+                PreviewMouseDoubleClick="OutlineView_PreviewMouseDoubleClick"
+                ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+                <TreeView.ItemTemplate>
+                    <HierarchicalDataTemplate  DataType="{x:Type model:OutlineNode}" ItemsSource="{Binding Path=Chlidlist}">
+                        <Grid>
+                            <Grid.ContextMenu>
+                                <ContextMenu>
+                                    <MenuItem Header="添加条目"/>
+                                    <MenuItem Header="添加子条目"/>
+                                    <MenuItem Header="添加上一级条目" IsEnabled="{Binding CanAddParent}"/>
+                                    
+                                    <MenuItem x:Name="DeleteMenu" Click="DeleteMenu_Click" Header="删除"/>
+
+                                    <MenuItem x:Name="RenameMenu" Click="RenameMenu_Click" Header="重命名"/>
+                                    <MenuItem x:Name="ChangeDestinationMenu" Click="ChangeDestinationMenu_Click" Header="更改目标位置"/>
+
+                                    <MenuItem x:Name="UpgradeMenu" Click="UpgradeMenu_Click" Header="升级" IsEnabled="{Binding CanUp}"/>
+                                    <MenuItem x:Name="DowngradeMenu" Click="DowngradeMenu_Click" Header="降级" IsEnabled="{Binding CanDown}"/>
+                                </ContextMenu>
+                            </Grid.ContextMenu>
+                            <Grid x:Name="ContentPanel" >
+                                <Grid.ToolTip>
+                                    <ToolTip  Opened="ToolTip_Opened" Closed="ToolTip_Closed" >
+                                        <customcontrol:CustomImageControl Width="400" Height="120" />
+                                    </ToolTip>
+                                </Grid.ToolTip>
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition />
+                                    <ColumnDefinition Width="auto" />
+                                </Grid.ColumnDefinitions>
+                                <TextBlock x:Name="Content" Text="{Binding Outline.Title}" Visibility="{Binding IsReName,Mode=TwoWay}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
+                                <TextBlock x:Name="PageIndex" Grid.Column="1" HorizontalAlignment="Right"  VerticalAlignment="Center" Text="{Binding PageIndex}"/>
+                            </Grid>
+
+                            <StackPanel  Orientation="Horizontal" HorizontalAlignment="Stretch" Visibility="{Binding IsInsertNextLayer, Converter={StaticResource BoolToVisible}}" >
+                                <Ellipse Margin="0,0,0,0" Width="8" Height="8" Fill="White" Stroke="#FF0078D7"  StrokeThickness="1.5" VerticalAlignment="Bottom"/>
+                                <Line Margin="-1,0,0,2" X1="0"  X2="{Binding ElementName=ContentPanel,Path=ActualWidth}" HorizontalAlignment="Stretch" StrokeThickness="1.5" StrokeDashArray="2" Stroke="#FF0078D7" VerticalAlignment="Bottom"/>
+                            </StackPanel>
+                            <Grid x:Name="RenameGrid"
+                                  LostFocus="RenameGrid_LostFocus"
+                                  Visibility="{Binding ElementName=Content,Path=Visibility,Mode=TwoWay,Converter={StaticResource UnVisivleConvert}}">
+                                <TextBox x:Name="ReName" HorizontalAlignment="Left" VerticalAlignment="Center" 
+                                         IsVisibleChanged="ReName_IsVisibleChanged"/>
+                            </Grid>
+                        </Grid>
+                    </HierarchicalDataTemplate>
+                </TreeView.ItemTemplate>
+                <TreeView.ItemContainerStyle>
+                    <Style BasedOn="{StaticResource OutLineItemStyle}" TargetType="TreeViewItem">
+                        <EventSetter Event="PreviewMouseLeftButtonUp" Handler="TreeViewItem_PreviewMouseLeftButtonUp"/>
+                    </Style>
+                </TreeView.ItemContainerStyle>
+            </TreeView>
+        </Grid>
+    </Grid>
+</UserControl>

+ 366 - 0
PDF Office/Views/BOTA/OutLineControl.xaml.cs

@@ -0,0 +1,366 @@
+using ComPDFKit.PDFDocument;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model.BOTA;
+using PDF_Office.ViewModels.BOTA;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+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>
+    /// OutLineControl.xaml 的交互逻辑
+    /// </summary>
+    public partial class OutLineControl : UserControl
+    {
+        /// <summary>
+        /// 当前显示了线段的Item
+        /// </summary>
+        private TreeViewItem Treeviewitem = null;
+        /// <summary>
+        /// 需要重命名的Item的DataContext
+        /// </summary>
+        private OutlineNode ReNameOutlineNode = null;
+        public OutLineControl()
+        {
+            InitializeComponent();
+        }
+
+        private void BtnMore_Click(object sender, RoutedEventArgs e)
+        {
+            MenuMore.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
+            MenuMore.PlacementTarget = BtnMore;
+            MenuMore.IsOpen = true;
+        }
+        private void OutlineView_PreviewMouseMove(object sender, MouseEventArgs e)
+        {
+            if (e.LeftButton == MouseButtonState.Pressed)
+            {
+                var pos = e.GetPosition(OutlineView);
+                HitTestResult result = VisualTreeHelper.HitTest(OutlineView, pos);
+                if (result == null)
+                {
+                    return;
+                }
+                var treeViewItem = CommonHelper.FindVisualParent<TreeViewItem>(result.VisualHit);
+                if (treeViewItem == null)
+                {
+                    return;
+                }
+                DataObject dataObj = new DataObject(treeViewItem);
+                DragDrop.DoDragDrop(OutlineView, dataObj, DragDropEffects.Move);
+                return;
+            }
+        }
+
+        /// <summary>
+        /// 拖拽判断区域以及显示什么线
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void Grid_DragOver(object sender, DragEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).IsOnDrop = true;
+            TreeViewItem sourceitem = e.Data.GetData(typeof(TreeViewItem)) as TreeViewItem;
+            if (sourceitem == null)
+            {
+                return;
+            }
+            Point pos = e.GetPosition(OutlineView);
+            HitTestResult result = VisualTreeHelper.HitTest(OutlineView, pos);
+            if (result != null)
+            {
+                TreeViewItem treeviewitem = CommonHelper.FindVisualParent<TreeViewItem>(result.VisualHit);
+                if (treeviewitem != null)
+                {
+                    //控制最顶端的线
+                    if (pos.Y <= 9)
+                    {
+                        if (Treeviewitem == null)
+                        {
+                            Treeviewitem = treeviewitem;
+                        }
+                        (DataContext as OutLineControlViewModel).IsInsertHead = true;
+                        (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
+                        (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
+                    }
+                    else
+                    {
+                        (DataContext as OutLineControlViewModel).IsInsertHead = false;
+
+                        if (Treeviewitem == null)
+                        {
+                            Treeviewitem = treeviewitem;
+                        }
+                        else if (!Treeviewitem.Equals(treeviewitem))
+                        {
+                            (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
+                            (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
+                            Treeviewitem = treeviewitem;
+                        }
+                        else
+                        {
+                            (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
+                            (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
+                        }
+                        if (Treeviewitem.Equals(sourceitem))
+                        {
+                            return;
+                        }
+
+                        //鼠标位于上半部分显示实线,下半部分显示虚线
+                        Point p = treeviewitem.TranslatePoint(new Point(0, 0), OutlineView);
+                        if (pos.Y < p.Y + 16)
+                        {
+                            (treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = true;
+                        }
+                        else
+                        {
+                            (treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = true;
+                        }
+                    }
+                }
+            }
+        }
+
+        private void Grid_DragLeave(object sender, DragEventArgs e)
+        {
+            HiddenaAllLine();
+        }
+
+        private void OutlineView_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            TextBlock text = e.OriginalSource as TextBlock;
+            if (text == null || text.Name == "PageIndex")
+            {
+                return;
+            }
+            TreeView tree = sender as TreeView;
+            if (tree == null)
+            {
+                return;
+            }
+            OutlineNode viewitem = tree.SelectedItem as OutlineNode;
+            if (viewitem == null)
+            {
+                return;
+            }
+            ReNameOutlineNode = viewitem;
+            ReNameOutlineNode.IsReName = Visibility.Collapsed;
+            e.Handled = true;
+        }
+
+        private void OutlineView_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).IsInsertHead = false;
+            if (Treeviewitem != null)
+            {
+                (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
+                (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
+                Treeviewitem = null;
+            }
+        }
+
+        private void OutlineView_Drop(object sender, DragEventArgs e)
+        {
+            TreeViewItem souredata = e.Data.GetData(typeof(TreeViewItem)) as TreeViewItem;
+            OutlineNode soureoutlineNode = souredata.DataContext as OutlineNode;
+            Point pos = e.GetPosition(OutlineView);
+            HitTestResult result = VisualTreeHelper.HitTest(OutlineView, pos);
+            if (result == null)
+            {
+                HiddenaAllLine();
+                return;
+            }
+            TreeViewItem targetitem = CommonHelper.FindVisualParent<TreeViewItem>(result.VisualHit);
+            if (targetitem == null)
+            {
+                HiddenaAllLine();
+                return;
+            }
+            OutlineNode targetoutlineNode = targetitem.DataContext as OutlineNode;
+            if (soureoutlineNode.Equals(targetoutlineNode))
+            {
+                HiddenaAllLine();
+                return;
+            }
+           (DataContext as OutLineControlViewModel).InsertOutLine(targetoutlineNode, soureoutlineNode);
+
+            HiddenaAllLine();
+            (DataContext as OutLineControlViewModel).Updata(true);
+        }
+
+        /// <summary>
+        /// 清理线条显示,以及相关缓存对象
+        /// </summary>
+        private void HiddenaAllLine()
+        {
+            (DataContext as OutLineControlViewModel).IsOnDrop = false;
+            (DataContext as OutLineControlViewModel).IsInsertHead = false;
+            if (Treeviewitem != null)
+            {
+                (Treeviewitem.DataContext as OutlineNode).IsInsertCurrentLayer = false;
+                (Treeviewitem.DataContext as OutlineNode).IsInsertNextLayer = false;
+                Treeviewitem = null;
+            }
+        }
+
+        private void ReName_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+        {
+            TextBox ReNameText = sender as TextBox;
+            if (ReNameText == null)
+            {
+                return;
+            }
+            if (ReNameText.Visibility == Visibility.Visible)
+            {
+                if (ReNameOutlineNode != null)
+                {
+                    ReNameText.Text = ReNameOutlineNode.Outline.Title;
+                }
+                ReNameText.Focus();
+                ReNameText.SelectAll();
+            }
+        }
+
+        private void RenameGrid_LostFocus(object sender, RoutedEventArgs e)
+        {
+            TextBox newdto = e.OriginalSource as TextBox;
+            if (newdto == null)
+            {
+                return;
+            }
+            string newtitle = string.IsNullOrEmpty(newdto.Text) ? "" : newdto.Text;
+            Grid senderdto = sender as Grid;
+            if (senderdto == null)
+            {
+                return;
+            }
+            senderdto.Visibility = Visibility.Collapsed;
+            if (ReNameOutlineNode != null)
+            {
+                CPDFOutline result = ReNameOutlineNode.Outline;
+                if (result != null)
+                {
+                    if (newtitle == result.Title)
+                    {
+                        return;
+                    }
+                    (DataContext as OutLineControlViewModel).SetTitle(result, newtitle);
+                }
+                (DataContext as OutLineControlViewModel).Updata(false);
+            }
+        }
+
+        private void ToolTip_Opened(object sender, RoutedEventArgs e)
+        {
+            CustomImageControl imageControl = CommonHelper.FindVisualChild<CustomImageControl>(sender as ToolTip);
+           
+            OutlineNode outline = imageControl.DataContext as OutlineNode;
+            if (outline == null || string.IsNullOrEmpty(outline.PageIndex))
+            {
+                return;
+            }
+            //开始绘制
+            DrawingContext drawDc = imageControl.OpenDraw();
+            WriteableBitmap imageData = (DataContext as OutLineControlViewModel).LoadPreview(outline);
+            if (imageData == null)
+            {
+                imageControl.CloseDraw();
+                return;
+            }
+            drawDc.DrawImage(imageData, new Rect(0, 0, imageControl.Width, imageControl.Height));
+            imageControl.CloseDraw();
+        }
+
+        private void ToolTip_Closed(object sender, RoutedEventArgs e)
+        {
+            CustomImageControl imageControl = CommonHelper.FindVisualChild<CustomImageControl>(sender as ToolTip);
+            //清空绘制上下文数据
+            imageControl.OpenDraw();
+            imageControl.CloseDraw();
+        }
+
+        private void TreeViewItem_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            if (e.ClickCount == 1)
+            {
+                TreeViewItem content = sender as TreeViewItem;
+                if (content == null)
+                    return;
+                Point p = e.GetPosition(OutlineView);
+                HitTestResult result = VisualTreeHelper.HitTest(OutlineView, p);
+                if (result != null)
+                {
+                    //点击部位为箭头时,不跳转
+                    ToggleButton button = CommonHelper.FindVisualParent<ToggleButton>(result.VisualHit);
+                    if (button != null)
+                        return;
+                    Button btn = CommonHelper.FindVisualParent<Button>(result.VisualHit);
+                    if (btn != null)
+                        return;
+                    (DataContext as OutLineControlViewModel).GoToPage(content);
+                }
+            }
+        }
+
+        private void MenuCollapseAll_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).CollapseAll(OutlineView.ItemsSource as ObservableCollection<OutlineNode>);
+        }
+
+        private void MenuExpandAll_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).ExpandAll(OutlineView.ItemsSource as ObservableCollection<OutlineNode>);
+        }
+
+        private void MenuDeleteAll_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).DeleteAll();
+        }
+
+        private void DowngradeMenu_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).Downgrade((sender as MenuItem).DataContext as OutlineNode);
+        }
+
+        private void UpgradeMenu_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).Upgrade((sender as MenuItem).DataContext as OutlineNode);
+        }
+
+        private void DeleteMenu_Click(object sender, RoutedEventArgs e)
+        {
+            (DataContext as OutLineControlViewModel).RemoveOutline((sender as MenuItem).DataContext as OutlineNode);
+        }
+
+        private void RenameMenu_Click(object sender, RoutedEventArgs e)
+        {
+            ReNameOutlineNode = (sender as MenuItem).DataContext as OutlineNode;
+            ReNameOutlineNode.IsReName = Visibility.Collapsed;
+        }
+
+        private void ChangeDestinationMenu_Click(object sender, RoutedEventArgs e)
+        {
+            AlertsMessage alertsMessage = new AlertsMessage();
+            alertsMessage.ShowDialog("提示", "确定要将选定大纲的目标位置设置为当前位置吗?", "Cancel", "OK");
+            if (alertsMessage.result == ContentResult.Ok)
+            {
+            }
+        }
+    }
+}

+ 200 - 0
PDF Office/Views/BOTA/SearchContent.xaml

@@ -0,0 +1,200 @@
+<UserControl x:Class="PDF_Office.Views.BOTA.SearchContent"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.BOTA"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:bota="clr-namespace:PDF_Office.ViewModels.BOTA"
+             d:DataContext="{d:DesignInstance Type=bota:SearchContentViewModel}"
+             xmlns:helper="clr-namespace:PDF_Office.Helper"
+              xmlns:convert="clr-namespace:PDF_Office.DataConvert"
+             xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+   
+    <UserControl.Resources>
+        <convert:WidthConvert x:Key="WidthConvert"/>
+        <convert:BoolToVisible x:Key="BoolToVisible"/>
+        <convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
+
+        <Style x:Key="ListViewItemGraySelectStyle" TargetType="{x:Type ListViewItem}">
+            <Setter Property="UIElement.SnapsToDevicePixels"
+            Value="True" />
+            <Setter Property="Control.Padding"
+            Value="4,1" />
+            <Setter Property="Control.HorizontalContentAlignment">
+                <Setter.Value>
+                    <Binding Path="HorizontalContentAlignment"
+                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Control.VerticalContentAlignment">
+                <Setter.Value>
+                    <Binding Path="VerticalContentAlignment"
+                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ItemsControl, AncestorLevel=1}" />
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Panel.Background"
+            Value="#00FFFFFF" />
+            <Setter Property="Border.BorderBrush"
+            Value="#00FFFFFF" />
+            <Setter Property="Border.BorderThickness"
+            Value="1" />
+            <Setter Property="FrameworkElement.FocusVisualStyle">
+                <Setter.Value>
+                    <Style TargetType="{x:Type IFrameworkInputElement}">
+                        <Setter Property="Control.Template">
+                            <Setter.Value>
+                                <ControlTemplate>
+                                    <Rectangle Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
+                                       StrokeThickness="1"
+                                       StrokeDashArray="1 2"
+                                       Margin="2"
+                                       SnapsToDevicePixels="True" />
+                                </ControlTemplate>
+                            </Setter.Value>
+                        </Setter>
+                    </Style>
+                </Setter.Value>
+            </Setter>
+            <Setter Property="Control.Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type ListViewItem}">
+                        <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        Padding="{TemplateBinding Control.Padding}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}"
+                        Name="Bd"
+                        SnapsToDevicePixels="True">
+                            <ContentPresenter Content="{TemplateBinding ContentControl.Content}"
+                                      ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
+                                      ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
+                                      HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
+                                      VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
+                                      SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
+                        </Border>
+                        <ControlTemplate.Triggers>
+                            <MultiTrigger>
+                                <MultiTrigger.Conditions>
+                                    <Condition Property="UIElement.IsMouseOver" Value="True" />
+                                </MultiTrigger.Conditions>
+                                <Setter Property="Panel.Background" TargetName="Bd" Value="#1A000000" />
+                                <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A000000" />
+                            </MultiTrigger>
+                            <MultiTrigger>
+                                <MultiTrigger.Conditions>
+                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
+                                    <Condition Property="Selector.IsSelected" Value="True" />
+                                </MultiTrigger.Conditions>
+                                <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
+                                <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
+                            </MultiTrigger>
+                            <MultiTrigger>
+                                <MultiTrigger.Conditions>
+                                    <Condition Property="Selector.IsSelectionActive" Value="True" />
+                                    <Condition Property="Selector.IsSelected" Value="True" />
+                                </MultiTrigger.Conditions>
+                                <Setter Property="Panel.Background" TargetName="Bd" Value="#1A477EDE" />
+                                <Setter Property="Border.BorderBrush" TargetName="Bd" Value="#1A477EDE" />
+                            </MultiTrigger>
+                            <Trigger Property="UIElement.IsEnabled"  Value="False">
+                                <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
+                            </Trigger>
+                        </ControlTemplate.Triggers>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid Background="#F3F3F3" Width="200">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"/>
+            <RowDefinition Height="auto"/>
+            <RowDefinition Height="auto"/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+
+        <Grid Height="48" Margin="10,0,10,0">
+            <TextBlock Text="查找"  HorizontalAlignment="Left" VerticalAlignment="Center"/>
+            <Button Content="完成" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding SearchTextCommand}"/>
+        </Grid>
+
+        <TextBox Grid.Row="1" Margin="0,0,0,10" Width="180" Height="32" HorizontalAlignment="Center" 
+               Text="{Binding SearchContent,Mode=TwoWay}"
+                 />
+
+        <Grid Grid.Row="2" Margin="10,0,10,0" Visibility="{Binding IsEmpty ,Converter={StaticResource InvertBoolToVisibleConvert}}">
+            <TextBlock  Margin="0,0,0,10"  Text="All Result" VerticalAlignment="Center" HorizontalAlignment="Left"/>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                <TextBlock  Margin="0,0,0,10"  Text="Results:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
+                <TextBlock x:Name="TbCount"  Margin="0,0,0,10"  Text="{Binding SearchCount}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
+            </StackPanel>
+            
+        </Grid>
+        <Grid Grid.Row="3">
+            <ListView  Name="SearchResultList" VirtualizingPanel.IsVirtualizingWhenGrouping="True" 
+                              ItemsSource="{Binding searchResults,Mode=OneWay}"
+                              BorderThickness="0" ItemContainerStyle="{StaticResource ListViewItemGraySelectStyle}"
+                              Visibility="{Binding IsEmpty ,Converter={StaticResource InvertBoolToVisibleConvert}}"
+                              SelectionChanged="SearchResultList_SelectionChanged"
+                              ScrollViewer.HorizontalScrollBarVisibility="Hidden">
+                <ListView.GroupStyle>
+                    <GroupStyle>
+                        <GroupStyle.HeaderTemplate>
+                            <DataTemplate>
+                                <Grid Background="#E2E3E6" Height="24" >
+                                    <TextBlock Padding="0,4,12,4" VerticalAlignment="Stretch" TextAlignment="Center" HorizontalAlignment="Center" FontWeight="SemiBold" FontSize="12" Text="{Binding Name}" 
+                                                        FontFamily="Segoe UI" Foreground="#666666 "/>
+                                    <customControl:CustomIconToggleBtn x:Name="BtnExptend" Height="24" Click="BtnExptend_Click" 
+                                                                       HorizontalAlignment="Right"
+                                                                      Style="{StaticResource ToggleBtnViewModeStyle}">
+                                        <TextBlock Text="展开" VerticalAlignment="Center"/>
+                                    </customControl:CustomIconToggleBtn>
+                                </Grid>
+                            </DataTemplate>
+                        </GroupStyle.HeaderTemplate>
+                        <GroupStyle.Panel>
+                            <ItemsPanelTemplate>
+                                <VirtualizingStackPanel/>
+                            </ItemsPanelTemplate>
+                        </GroupStyle.Panel>
+                    </GroupStyle>
+                </ListView.GroupStyle>
+                <ListView.ItemsPanel>
+                    <ItemsPanelTemplate>
+                        <VirtualizingStackPanel Background="White" Margin="-5,0,0,0"></VirtualizingStackPanel>
+                    </ItemsPanelTemplate>
+                </ListView.ItemsPanel>
+                <ListView.ItemTemplate>
+                    <ItemContainerTemplate>
+                        <StackPanel>
+                            <RichTextBox Background="Transparent" Foreground="#000000" FontFamily="Segoe UI" FontSize="14" IsReadOnly="True" BorderThickness="0" 
+                                                 Padding="12,6,10,6" VerticalContentAlignment="Center" VerticalAlignment="Center"
+                                         helper:RichTextBoxHelper.DocumentBind="{Binding BindProperty}"
+                                         Width="{Binding ElementName=SearchResultList,Path=ActualWidth,Converter={StaticResource WidthConvert}}"
+                                                  IsHitTestVisible="False" >
+                            </RichTextBox>
+                        </StackPanel>
+                    </ItemContainerTemplate>
+                </ListView.ItemTemplate>
+
+                <i:Interaction.Triggers>
+                    <i:EventTrigger EventName="SelectionChanged">
+                        <i:InvokeCommandAction Command="{Binding SearchChangedCommand}" CommandParameter="{Binding ElementName=SearchResultList,Path=SelectedItem}"/>
+                    </i:EventTrigger>
+                </i:Interaction.Triggers>
+            </ListView>
+        </Grid>
+
+        <Grid Grid.Row="0" Grid.RowSpan="4" Visibility="{Binding IsEmpty ,Converter={StaticResource BoolToVisible}}">
+            <StackPanel VerticalAlignment="Center" >
+                <Rectangle Margin="0,0,0,10" Width="140" Height="140" Fill="#D9D9D9" />
+                <TextBlock Text="Clik the XXX button below to create a XXX" Foreground="#94989C" Width="180" FontFamily="SF Pro Text" LineHeight="22" FontSize="14" TextAlignment="Center" TextWrapping="Wrap"/>
+            </StackPanel>
+            
+        </Grid>
+    </Grid>
+</UserControl>

+ 102 - 0
PDF Office/Views/BOTA/SearchContent.xaml.cs

@@ -0,0 +1,102 @@
+using PDF_Office.CustomControl;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+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
+{
+    public class TextSearchBindItem : INotifyPropertyChanged
+    {
+        public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
+        public TextBindProperty BindProperty { get; set; }
+        public TextSearchBindItem()
+        {
+            BindProperty = new TextBindProperty();
+        }
+
+        public int PageCount { get; set; }
+        private int _pageMaxCount;
+        public int PageMaxCount { get { return _pageMaxCount; } set { _pageMaxCount = value; OnPropertyChanged("Percent"); } }
+
+        public double Percent { get { if (PageMaxCount > 0 && PageCount >= 0) return (double)PageCount / (double)PageMaxCount; return 0; } }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
+    }
+
+
+    public class TextBindProperty
+    {
+        public int PageIndex { get; set; }
+        public string TextContent { get; set; }
+        public Color HighLightColor { get; set; }
+        public string SearchWord { get; set; }
+        public Rect TextRect { get; set; }
+        public int PageRotate { get; set; }
+    }
+    /// <summary>
+    /// SearchContent.xaml 的交互逻辑
+    /// </summary>
+    public partial class SearchContent : UserControl
+    {
+       // private ObservableCollection<TextSearchBindItem> searchResults;
+        public SearchContent()
+        {
+            InitializeComponent();
+       //     searchResults = new ObservableCollection<TextSearchBindItem>();
+        //    ICollectionView groupView = CollectionViewSource.GetDefaultView(searchResults);
+        //    groupView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(TextSearchBindItem.ShowPageIndex)));
+        }
+
+        private void SearchResultList_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
+
+        private void BtnExptend_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            if (btn == null) return;
+
+
+            var item = (sender as FrameworkElement).DataContext as CollectionViewGroup;
+            if(item != null)
+            {
+                foreach (var item2 in item.Items)
+                {
+                    var item3 = item2 as TextSearchBindItem;
+
+                    var listBoxItem = SearchResultList.ItemContainerGenerator.ContainerFromItem(item3) as ListViewItem;
+                    if (listBoxItem != null)
+                    {
+                       if(btn.IsChecked == true)
+                        {
+                            listBoxItem.Visibility = Visibility.Collapsed;
+                        }
+                       else
+                        {
+                            listBoxItem.Visibility = Visibility.Visible;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 42 - 9
PDF Office/Views/Dialog/PageEditDialogs/InsertDialog.xaml

@@ -24,18 +24,33 @@
             <convert:FileToImageSourceConvert x:Key="FileToImageSourceConvert" />
             <DataTemplate x:Key="CustomItem" DataType="{x:Type model:CustomPageItem}">
                 <StackPanel HorizontalAlignment="Center">
-                    <Border>
-                        <Image
-                            Width="208"
-                            Height="230"
-                            Source="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
+                    <Border
+                        Name="BdBorder"
+                        Width="104"
+                        Height="64"
+                        BorderBrush="#A0A2AE"
+                        BorderThickness="1"
+                        CornerRadius="6">
+                        <Border.Background>
+                            <ImageBrush ImageSource="{Binding FilePath, Converter={StaticResource FileToImageSourceConvert}}" />
+                        </Border.Background>
                     </Border>
                     <Label
+                        Name="LbPageNum"
                         Width="auto"
                         Margin="0,4,0,0"
+                        HorizontalAlignment="Center"
+                        Background="Transparent"
                         Content="{Binding Name}"
                         FontSize="12" />
                 </StackPanel>
+                <DataTemplate.Triggers>
+                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
+                        <Setter TargetName="BdBorder" Property="BorderBrush" Value="#118AFF" />
+                        <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
+                        <Setter TargetName="LbPageNum" Property="Foreground" Value="#118AFF" />
+                    </DataTrigger>
+                </DataTemplate.Triggers>
             </DataTemplate>
         </ResourceDictionary>
     </UserControl.Resources>
@@ -48,10 +63,18 @@
                     <RowDefinition Height="auto" />
                 </Grid.RowDefinitions>
                 <ListBox
+                    Padding="0,16,0,0"
+                    HorizontalAlignment="Center"
                     BorderThickness="0"
                     ItemTemplate="{StaticResource CustomItem}"
                     ItemsSource="{Binding Pages}"
                     SelectedIndex="{Binding ItemSelectedIndex, Mode=TwoWay}">
+                    <ListBox.ItemContainerStyle>
+                        <Style TargetType="{x:Type ListBoxItem}">
+                            <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
+                            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+                        </Style>
+                    </ListBox.ItemContainerStyle>
                     <ListBox.ItemsPanel>
                         <ItemsPanelTemplate>
                             <WrapPanel />
@@ -83,16 +106,19 @@
                     </StackPanel>
                     <StackPanel Margin="0,12" Orientation="Horizontal">
                         <RadioButton
+                            Name="RbtnStandard"
                             VerticalAlignment="Center"
                             Content="标准"
                             GroupName="PageSize" />
                         <ComboBox
                             Width="228"
                             Height="32"
-                            Margin="8,0" />
+                            Margin="8,0"
+                            IsEnabled="{Binding ElementName=RbtnStandard, Path=IsChecked}" />
                     </StackPanel>
                     <StackPanel Margin="0,0,0,12" Orientation="Horizontal">
                         <RadioButton
+                            Name="RbtnCustom"
                             VerticalAlignment="Center"
                             Content="自定义"
                             GroupName="PageSize" />
@@ -100,16 +126,23 @@
                             Width="80"
                             Height="32"
                             Margin="8,0"
-                            VerticalAlignment="Center"
+                            VerticalContentAlignment="Center"
+                            IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
                             Text="{Binding CustomWidth, Mode=TwoWay}" />
                         <TextBlock VerticalAlignment="Center" Text="X" />
                         <TextBox
                             Width="80"
                             Height="32"
                             Margin="8,0"
-                            VerticalAlignment="Center"
+                            VerticalContentAlignment="Center"
+                            IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
                             Text="{Binding CustomHeight, Mode=TwoWay}" />
-                        <ComboBox Width="80" />
+                        <ComboBox
+                            Width="80"
+                            VerticalContentAlignment="Center"
+                            IsEnabled="{Binding ElementName=RbtnCustom, Path=IsChecked}"
+                            ItemsSource="{Binding Units}"
+                            SelectedIndex="{Binding UnitsSelectedIndex}" />
                     </StackPanel>
                 </StackPanel>
                 <StackPanel Grid.Row="2" Margin="16,0">

+ 11 - 6
PDF Office/Views/HomePanel/CloudDrive/CloudDriveContent.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.CloudDrive"
+             
              xmlns:prism ="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
@@ -11,8 +12,7 @@
     <Grid  Margin="44,38,0,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="auto"/>
-            <RowDefinition Height="129.367"/>
-            <RowDefinition Height="67.633"/>
+            <RowDefinition />
         </Grid.RowDefinitions>
 
         <Grid>
@@ -27,7 +27,7 @@
                 </ComboBox.ItemTemplate>
             </ComboBox>
         </Grid>
-        <ListBox x:Name="ListCloudDrive" Grid.Row="1" Grid.RowSpan="2">
+        <ListBox x:Name="ListCloudDrive" Background="Transparent" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" VerticalAlignment='Top' BorderThickness="0">
              
             <ListBox.ItemsPanel>
                 <ItemsPanelTemplate>
@@ -37,14 +37,19 @@
 
             <ListBox.ItemTemplate>
                 <DataTemplate>
-                    <Border Background="#DBDBDB" Width="218" Height="172">
-                        <TextBlock Text="{Binding DriveName}"/>
-                    </Border>
+                    <StackPanel Width="218" Height="192">
+                        <Rectangle  Fill="#DBDBDB" Width="218" Height="172"/>
+                        <TextBlock Grid.Row="1" Text="{Binding DriveName}" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
+                    </StackPanel>
                 </DataTemplate>
             </ListBox.ItemTemplate>
 
             <ListBox.ItemContainerStyle>
                 <Style TargetType="{x:Type ListBoxItem}">
+                    <Setter Property="Margin" Value="0,0,8,0"/>
+                    <Setter Property="Width" Value="218"/>
+                    <Setter Property="Height" Value="192"/>
+                    <Setter Property="Padding" Value="0"/>
                     <EventSetter Event="PreviewMouseLeftButtonUp" 
                                  Handler="SelectCloudDrive_Click"
                                  />

+ 77 - 18
PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml

@@ -3,14 +3,17 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:DataConvert ="clr-namespace:PDF_Office.DataConvert"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
              xmlns:prism ="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.CloudDrive"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <UserControl.Resources>
-        <ContextMenu x:Key="FlyoutMenu" FontSize="14"
-                         >
+        <DataConvert:BoolToVisible x:Key="BoolToVisible"/>
+        <DataConvert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert"/>
+        <ContextMenu x:Key="FlyoutMenu" FontSize="14">
             <ContextMenu.ItemContainerStyle>
                 <Style TargetType="MenuItem">
                     <Setter Property="Padding" Value="0,7,0,7"/>
@@ -26,12 +29,36 @@
                     </Path>
                 </MenuItem.Icon>
             </MenuItem>
-   
+        </ContextMenu>
 
+        <ContextMenu x:Key="UserFlyoutMenu" FontSize="14">
+            <ContextMenu.ItemContainerStyle>
+                <Style TargetType="MenuItem">
+                    <Setter Property="Padding" Value="0,7,0,7"/>
+                    <Setter Property="VerticalContentAlignment" Value="Center"/>
+                </Style>
+            </ContextMenu.ItemContainerStyle>
+            <MenuItem Name="RemoveUserMenuItem" Header="移除帐户" IsEnabled="True" Click="RemoveUserMenuItem_Click">
+                <MenuItem.Icon>
+                    <Path Fill="Black" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z">
+                        <Path.RenderTransform>
+                            <TranslateTransform X="5.0000" Y="0"/>
+                        </Path.RenderTransform>
+                    </Path>
+                </MenuItem.Icon>
+            </MenuItem>
         </ContextMenu>
 
+
         <Style x:Key="itemstyle" TargetType="{x:Type ListViewItem}">
-            <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"></Setter>
+            <EventSetter Event="PreviewMouseRightButtonDown"
+                             Handler="ListViewItem_PreviewMouseRightButtonDown"/>
+            <EventSetter Event="PreviewMouseDoubleClick"
+                             Handler="ListViewItem_PreviewMouseDoubleClick"/>
+        </Style>
+        <Style x:Key="useritemstyle" TargetType="{x:Type ListViewItem}">
+            <EventSetter Event="PreviewMouseRightButtonDown"
+                             Handler="userItem_PreviewMouseRightButtonDown"/>
         </Style>
     </UserControl.Resources>
     <Grid>
@@ -44,15 +71,31 @@
                 <ColumnDefinition />
                 <ColumnDefinition Width="auto"/>
             </Grid.ColumnDefinitions>
-            <ListBox x:Name="ListFolder">
+            <ListBox x:Name="ListFolder" ItemsSource="{Binding FolderItems}">
+                <ListBox.ItemTemplate>
+                    <DataTemplate>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="{Binding FolderName}" HorizontalAlignment="Left"/>
+                            <TextBlock Text=" >" HorizontalAlignment="Left"/>
+                        </StackPanel>
+                    </DataTemplate>
+                </ListBox.ItemTemplate>
                 <ListBox.ItemsPanel>
                     <ItemsPanelTemplate>
                         <WrapPanel Orientation="Horizontal"/>
                     </ItemsPanelTemplate>
                 </ListBox.ItemsPanel>
+                <ListBox.ItemContainerStyle>
+                    <Style TargetType="{x:Type ListBoxItem}">
+    
+                        <EventSetter Event="PreviewMouseLeftButtonUp" 
+                                 Handler="SelectListFolder_Click"
+                                 />
+                    </Style>
+                </ListBox.ItemContainerStyle>
             </ListBox>
             <StackPanel Grid.Column="1" Orientation="Horizontal">
-                <ComboBox x:Name="combCloudDrive" Grid.Column="1" Width="115" Height="32" Background="Wheat" HorizontalAlignment="Right" SelectionChanged="combCloudDrive_SelectionChanged">
+                <ComboBox x:Name="combCloudDrive" Grid.Column="1" Width="115" Height="32" Background="Wheat" HorizontalAlignment="Right">
                     <ComboBox.ItemTemplate>
                         <DataTemplate>
                             <Border Background="#DBDBDB">
@@ -60,8 +103,13 @@
                             </Border>
                         </DataTemplate>
                     </ComboBox.ItemTemplate>
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="SelectionChanged">
+                            <i:InvokeCommandAction Command="{Binding LoginCommand}"  CommandParameter="{Binding ElementName=combCloudDrive,Path=SelectedItem}"/>
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
                 </ComboBox>
-                <Button Content="Test" Click="Button_Click"/>
+                <Button x:Name="UpLoadFileBtn" Content="上传文件" Click="UpLoadFileBtn_Click"/>
             </StackPanel>
            
         </Grid>
@@ -72,30 +120,41 @@
                 <ColumnDefinition/>
             </Grid.ColumnDefinitions>
 
-            <ListView x:Name="Listusers" Width="220"  SelectionChanged="Listusers_SelectionChanged" VerticalAlignment="Top">
+            <ListView x:Name="Listusers" Width="220"  SelectionChanged="Listusers_SelectionChanged" VerticalAlignment="Top"
+                      ItemContainerStyle="{StaticResource useritemstyle}"
+                      >
                 <ListView.ItemTemplate>
                     <DataTemplate>
                         <Grid Height="50" >
-                            <TextBlock VerticalAlignment="Center" Text="{Binding user.UserAccount}"/>
+                            <TextBlock VerticalAlignment="Center" Text="{Binding userInfo.UserAccount}"/>
                         </Grid>
-                       
                     </DataTemplate>
                 </ListView.ItemTemplate>
             </ListView>
 
-            <ListView x:Name="ListvmFiles" Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemContainerStyle="{StaticResource itemstyle}">
+            <ListView x:Name="ListvmFiles" Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto" 
+                      ItemsSource="{Binding FilesList}"
+                      ItemContainerStyle="{StaticResource itemstyle}">
                 <ListView.ItemTemplate>
                     <DataTemplate>
-                        <StackPanel Margin="0,5,0,5">
-                            <StackPanel Orientation="Horizontal">
-                                <TextBlock Text="Id:"/>
-                                <TextBlock Text="{Binding Id}"/>
+                        <Grid>
+                            <StackPanel Margin="0,5,0,5" Visibility="{Binding IsFolder,Converter={StaticResource InvertBoolToVisibleConvert}}">
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="Id:"/>
+                                    <TextBlock Text="{Binding Id}"/>
+                                </StackPanel>
+                                <StackPanel Orientation="Horizontal">
+                                    <TextBlock Text="文件名:"/>
+                                    <TextBlock Text="{Binding Name}"/>
+                                </StackPanel>
                             </StackPanel>
-                            <StackPanel Orientation="Horizontal">
-                                <TextBlock Text="文件名:"/>
+                            <StackPanel Visibility="{Binding IsFolder,Converter={StaticResource BoolToVisible}}" Background="YellowGreen">
+                                <TextBlock Text="文件:"/>
                                 <TextBlock Text="{Binding Name}"/>
                             </StackPanel>
-                        </StackPanel>
+                           
+                        </Grid>
+                       
                     </DataTemplate>
                 </ListView.ItemTemplate>
             </ListView>

+ 96 - 76
PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml.cs

@@ -27,14 +27,15 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
     {
      
         private CloudFilesContentViewModel ViewModel => DataContext as CloudFilesContentViewModel;
-
+        private ContextMenu FlyoutMenu;
+        private ContextMenu UserFlyoutMenu;
         private List<CloudBoxItem> CloudeDrives = new List<CloudBoxItem>();
 
-        private CloudType cloudType;
         public CloudFilesContent()
         {
             InitializeComponent();
             InitCloudDrive();
+            this.Loaded -= usercontrol_Loaded;
             this.Loaded += usercontrol_Loaded;
         }
 
@@ -43,37 +44,24 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
             CloudeDrives = Cloud.InitCloudBoxs();
             combCloudDrive.ItemsSource = CloudeDrives;
             combCloudDrive.SelectedIndex = 0;
+            FlyoutMenu = Resources["FlyoutMenu"] as ContextMenu;
+            UserFlyoutMenu = Resources["UserFlyoutMenu"] as ContextMenu;
+            
         }
 
         private void usercontrol_Loaded(object sender, RoutedEventArgs e)
         {
           if(ViewModel != null)
             {
-                ViewModel.CheckDriveUsers();
                 if (Listusers.ItemsSource == null)
                     Listusers.ItemsSource = Cloud.CloudLists;
             }
         }
 
-        private void combCloudDrive_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            var cloudDriveItem = combCloudDrive.SelectedItem as CloudBoxItem;
-            if (cloudDriveItem != null)
-            {
-                ViewModel.CheckDriveCommand.Execute(cloudDriveItem);
-            }
-        }
-
-
-        private void Button_Click(object sender, RoutedEventArgs e)
-        {
-
-         
-        }
 
         private UserBaseItem CurrentUser;
 
-        private async void Listusers_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void Listusers_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var cloudFileUser = Listusers.SelectedItem as UserBaseItem;
             if(cloudFileUser != null)
@@ -83,93 +71,125 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
                 switch(cloudFileUser.cloudType)
                 {
                     case CloudType.GoogleDrive:
-                        if ((CurrentUser as GoogleDriveUserItem) != null)
                         {
-                            var item = CurrentUser as GoogleDriveUserItem;
-                            var files = await item.GetDriveFiles(item.Service);
-                            ObservableCollection<GoogleDriveFiles> filesList = new ObservableCollection<GoogleDriveFiles>();
-                            foreach (var file in files)
-                            {
-                                if (file.Name.EndsWith(".pdf") == true)
-                                {
-                                    filesList.Add(file);
-                                }
-                            }
-                            ListvmFiles.ItemsSource = filesList;
+                            FileOperation fileOperation = new FileOperation(cloudFileUser, null);
+                            ViewModel?.OpenFolderCommand?.Execute(fileOperation);
                         }
                         break;
 
                     case CloudType.DropBox:
-                        if ((CurrentUser as DropbBoxUserItem) != null)
                         {
-                            var item = CurrentUser as DropbBoxUserItem;
-                            var files = await item.RefreshList();
-                            ObservableCollection<DropbBoxFiles> filesList = new ObservableCollection<DropbBoxFiles>();
-                            foreach (var file in files)
-                            {
-                                if (file.Name.EndsWith(".pdf") == true)
-                                {
-                                    filesList.Add(file);
-                                }
-                            }
-                            ListvmFiles.ItemsSource = filesList;
+                            FileOperation fileOperation = new FileOperation(cloudFileUser, null);
+                            ViewModel?.OpenFolderCommand?.Execute(fileOperation);
                         }
                         break;
+                }
+            }
+        }
 
+        private void OpenDocMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var menuItem = sender as MenuItem;
+            if (menuItem == null)
+                return;
+
+            var file = menuItem.DataContext as FilesBaseItem;
+            if (file != null)
+            {
+                var cloudFileUser = Listusers.SelectedItem as UserBaseItem;
+                if (cloudFileUser != null)
+                {
+                    FileOperation fileOperation = new FileOperation(cloudFileUser, file);
+                    ViewModel?.OpenFileCommand?.Execute(fileOperation);
                 }
-               
+
             }
+
+
         }
 
-        private async void OpenDocMenuItem_Click(object sender, RoutedEventArgs e)
+        private void RemoveUserMenuItem_Click(object sender, RoutedEventArgs e)
         {
             var menuItem = sender as MenuItem;
             if (menuItem == null)
                 return;
 
-            string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+            var user = menuItem.DataContext as UserBaseItem;
+            if (user != null)
+            {
+                ViewModel?.RemoveUserCommand?.Execute(user);
 
-            switch (CurrentUser.cloudType)
+            }
+        }
+        private void SelectListFolder_Click(object sender, MouseButtonEventArgs e)
+        {
+            var folderItem = (sender as FrameworkElement).DataContext as FolderBaseItem;
+            if (folderItem != null)
             {
-                case CloudType.GoogleDrive:
-               
-                    var item = menuItem.DataContext as GoogleDriveFiles;
-                    if (menuItem == null || item == null)
-                        return;
-
-                    var googleItem = CurrentUser as GoogleDriveUserItem;
-                    var filename = await googleItem.DownloadGoogleFile(item, docPath);
-                    if (filename != null)
-                    {
-                        string[] filePaths = { filename };
-                        await Task.Delay(3);
-                        MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
-                        parentWindow.LoadPdfViewer(filePaths);
-                    }
-                    break;
+                ViewModel?.SelectedFolderCommand?.Execute(folderItem);
+            }
 
-                case CloudType.DropBox:
+        }
 
-                    var file = menuItem.DataContext as DropbBoxFiles;
-                    var dropBoxItem = CurrentUser as DropbBoxUserItem;
+        private void ListViewItem_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            var frame = sender as FrameworkElement;
+            if (frame != null && frame.DataContext as FilesBaseItem != null)
+            {
+                var file = frame.DataContext as FilesBaseItem;
+                if ((file == null || file.IsFolder == false) && FlyoutMenu != null)
+                {
+                    FlyoutMenu.DataContext = file;
+                    FlyoutMenu.IsOpen = true;
+                }
+            }
+        }
 
-                    var dropBoxFileName = await dropBoxItem.Download(file.Name, docPath);
-                    if (dropBoxFileName != null)
+        /// <summary>
+        /// 打开文件夹,显示文件列表内容
+        /// </summary>
+        private void ListViewItem_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
+        {
+            var frame = sender as FrameworkElement;
+            if (frame != null && frame.DataContext as FilesBaseItem != null)
+            {
+                var file = frame.DataContext as FilesBaseItem;
+                if (file != null && file.IsFolder == true)
+                {
+                    var cloudFileUser = Listusers.SelectedItem as UserBaseItem;
+                    if (cloudFileUser != null)
                     {
-                        string[] filePaths = { dropBoxFileName };
-                        await Task.Delay(3);
-                        MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
-                        parentWindow.LoadPdfViewer(filePaths);
+                        FileOperation fileOperation = new FileOperation(cloudFileUser, file);
+                        ViewModel?.OpenFolderCommand?.Execute(fileOperation);
                     }
-                    break;
 
+                }
             }
+        }
 
+        private void userItem_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            var frame = sender as FrameworkElement;
+            if (frame != null && frame.DataContext as UserBaseItem != null)
+            {
+                var user = frame.DataContext as UserBaseItem;
+                if (user != null && UserFlyoutMenu != null)
+                {
+                    UserFlyoutMenu.DataContext = user;
+                    UserFlyoutMenu.IsOpen = true;
+                }
+            }
+        }
 
+        private void UpLoadFileBtn_Click(object sender, RoutedEventArgs e)
+        {
+            var folder = ListFolder.Items[ListFolder.Items.Count - 1] as FolderBaseItem;
+            if (folder != null && folder.Operation != null)
+            {
+                FileOperation fileOperation = new FileOperation(CurrentUser, folder.Operation.DoFile);
+                ViewModel?.UpLoadFileCommand?.Execute(fileOperation);
+            }
 
-           
         }
-
-       
     }
 }

+ 6 - 6
PDF Office/Views/HomePanel/PDFTools/PDFToolItem.xaml

@@ -11,12 +11,12 @@
         <convert:BoolToVisible x:Key="boolToVisible"/>
         <convert:InvertBoolToVisibleConvert x:Key="invertBoolToVisibleConvert"/>
     </UserControl.Resources>
-    <Grid  Margin="1,1,1,1">
+    <Grid  Margin="1,1,1,1" Background="White">
 
-        <Border x:Name="BorderExtend" Height="108"  CornerRadius="8" Background="White" BorderThickness="2" 
-                Visibility="{Binding IsShowConciseContent,Converter={StaticResource invertBoolToVisibleConvert}}">
+        <Border x:Name="BorderExtend" Height="108"  Background="White"
+                Visibility="{Binding IsShowConciseContent,Converter={StaticResource invertBoolToVisibleConvert},Mode=OneWay}">
 
-            <Grid  Background="Transparent" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
+            <Grid   MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
                 <Grid Margin="10">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="auto"></ColumnDefinition>
@@ -44,8 +44,8 @@
             </Grid>
         </Border>
 
-        <Border x:Name="BorderConcise" Height="64"  CornerRadius="8" Background="White" BorderThickness="2" BorderBrush="#04000000" 
-                Visibility="{Binding IsShowConciseContent,Converter={StaticResource boolToVisible}}">
+        <Border x:Name="BorderConcise" Height="64" 
+                Visibility="{Binding IsShowConciseContent,Converter={StaticResource boolToVisible},Mode=OneWay}">
             <Grid Background="Transparent" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="auto"/>

+ 1 - 1
PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml

@@ -7,7 +7,7 @@
       xmlns:customControl="clr-namespace:PDF_Office.CustomControl"
       xmlns:converter="clr-namespace:PDF_Office.DataConvert"
       Background="White"  MinWidth="540" MinHeight="460"
-      mc:Ignorable="d" 
+      mc:Ignorable="d"  Loaded="Page_Loaded"
       d:DesignHeight="450" d:DesignWidth="800"
      >
     <UserControl.Resources>

+ 43 - 39
PDF Office/Views/HomePanel/PDFTools/PDFToolsContent.xaml.cs

@@ -48,8 +48,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         public PDFToolsContent()
         {
             InitializeComponent();
-            PDFtools = new PDFToolsHelper();
-
+            PDFtools = PDFToolsHelper.GetInstance();
 
             #region ListBox
 
@@ -74,17 +73,15 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         {
             quickTools = PDFtools.QuickTools;
             allTools = PDFtools.AllTools;
-
+            moreTools = PDFtools.MoreTools;
             ListShortCuts.ItemsSource = quickTools;
-            //对比两个集合,取差值
-            moreTools = allTools.Except(quickTools).ToList();
-
             ListMoreCuts.ItemsSource = moreTools;
-
+           
         }
 
         private void Page_Loaded(object sender, RoutedEventArgs e)
         {
+            UpdateExptend();
         }
 
         private void ListBoxMoreCuts_PreviewMouseMove(object sender, MouseEventArgs e)
@@ -239,7 +236,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 quickTools.Insert(targetIndex, source);
 
                 ListMoreCuts.Items.Refresh();
-                ListShortCuts.Items.Refresh();
+                ListShortCuts.Items.Refresh(); 
 
                 sourceImage.Visibility = Visibility.Hidden;
                 targetListItem.IsOverModular = false;
@@ -497,35 +494,6 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             }
         }
 
-        ///// <summary>
-        ///// 扩展收缩UI
-        ///// </summary>
-        ///// <param name="IsShowConciseContent">是否收缩</param>
-        //private void ShowToolsUI(ListBoxEx list,bool IsShowConciseContent)
-        //{
-        //    foreach (var item in list.Items)
-        //    {
-
-        //        var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
-        //        if (listBoxItem != null)
-        //        {
-
-        //            var viewItem = listBoxItem.ContentTemplate;
-        //            var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
-        //            var obj = viewItem.FindName("data", myContentPresenter);
-
-        //            var checkNum = obj as PDFToolItem;
-
-        //            if (checkNum != null)
-        //            {
-        //                checkNum.IsShowConciseContent = IsShowConciseContent;
-        //            }
-
-        //        }
-        //    }
-
-        //}
-
 
         private void ListBoxShortCuts_SizeChanged(object sender, SizeChangedEventArgs e)
         {
@@ -572,13 +540,22 @@ namespace PDF_Office.Views.HomePanel.PDFTools
 
 
         private void BtnExptend_Click(object sender, RoutedEventArgs e)
+        {
+            UpdateExptend();
+        }
+
+        private void UpdateExptend()
         {
             foreach (var item in allTools)
             {
-                item.IsShowConciseContent = (bool)BtnExptend.IsChecked;
+                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
             }
-        }
 
+            foreach (var item in quickTools)
+            {
+                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
+            }
+        }
 
         //自适应流式布局,以防改需求备用
         //private void ListBoxMoreCutsWidthChanged()
@@ -608,7 +585,34 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         //    }
         //}
 
+        ///// <summary>
+        ///// 扩展收缩UI
+        ///// </summary>
+        ///// <param name="IsShowConciseContent">是否收缩</param>
+        //private void ShowToolsUI(ListBoxEx list,bool IsShowConciseContent)
+        //{
+        //    foreach (var item in list.Items)
+        //    {
+
+        //        var listBoxItem = list.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+        //        if (listBoxItem != null)
+        //        {
+
+        //            var viewItem = listBoxItem.ContentTemplate;
+        //            var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
+        //            var obj = viewItem.FindName("data", myContentPresenter);
+
+        //            var checkNum = obj as PDFToolItem;
 
+        //            if (checkNum != null)
+        //            {
+        //                checkNum.IsShowConciseContent = IsShowConciseContent;
+        //            }
+
+        //        }
+        //    }
+
+        //}
     }
 
 }

+ 8 - 4
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml

@@ -10,6 +10,7 @@
     xmlns:pDFTools="clr-namespace:PDF_Office.Views.HomePanel.PDFTools"
     d:DesignHeight="450"
     d:DesignWidth="800"
+    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -36,7 +37,7 @@
                        Orientation="Horizontal" />
             </ItemsPanelTemplate>
 
-            <Style x:Key="QuickToolsListBoxItemStyle" BasedOn="{StaticResource MoreListBoxItemStyle}"
+            <Style x:Key="QuickToolsListBoxItemStyle" BasedOn="{StaticResource ListBoxItemStyle}"
                TargetType="{x:Type customControl:ListItemQuickTool}">
                 <EventSetter Event="PreviewMouseLeftButtonUp"
                              Handler="QuickTools_Click"/>
@@ -73,14 +74,17 @@
                 Width="68"
                 Height="28"
                 Margin="0,0,0,0"
-                Background="#FFFFFF"
                 Content="Tools"
                 Click="BtnTools_Click"
                >
 
             </Button>
 
-
+            <customControl:CustomIconToggleBtn x:Name="BtnExptend"  Click="BtnExptend_Click"
+                                                        Style="{StaticResource ToggleBtnViewModeStyle}"
+                                                       >
+                <TextBlock Text="展开"/>
+            </customControl:CustomIconToggleBtn>
             <Button
                 x:Name="BtnMore"
                 Width="28"
@@ -101,7 +105,7 @@
             <customControl:ListBoxEx x:Name="ListBoxToolBars" HorizontalAlignment="Stretch"  MinWidth="540" 
                         Grid.Row="3"
                         AllowDrop="True"
-                        BorderThickness="0"
+                        BorderThickness="0" Background="Transparent"
                         SizeChanged="ListBoxShortCuts_SizeChanged"
                         ItemContainerStyle="{StaticResource QuickToolsListBoxItemStyle}"
                         ItemTemplate="{StaticResource DataTemplate}"

+ 32 - 39
PDF Office/Views/HomePanel/PDFTools/QuickToolsContent.xaml.cs

@@ -21,56 +21,38 @@ namespace PDF_Office.Views.HomePanel.PDFTools
         public QuickToolsContent()
         {
             InitializeComponent();
-            PDFtools = new PDFToolsHelper();
+            PDFtools = PDFToolsHelper.GetInstance();
             ListBoxToolBars.ItemsSource = PDFtools.QuickTools;
         }
    
 
         private void BtnMore_Click(object sender, RoutedEventArgs e)
         {
-            if (GridAllTools.Height != 270)
+        }
+
+        private void BtnExptend_Click(object sender, RoutedEventArgs e)
+        {
+            UpdateExptendUI();
+        }
+
+        private void UpdateExptendUI()
+        {
+            if ((bool)BtnExptend.IsChecked)
             {
                 GridAllTools.Height = 270;
-                ShowToolsUI(false);
             }
             else
             {
-                GridAllTools.Height = 184;
-                ShowToolsUI(true);
+                GridAllTools.Height = 174;
             }
-               
-        }
 
-        /// <summary>
-        /// 扩展收缩UI
-        /// </summary>
-        /// <param name="IsShowConciseContent">是否收缩</param>
-        private void ShowToolsUI(bool IsShowConciseContent)
-        {
-            //foreach (var item in ListBoxToolBars.Items)
-            //{
-               
-            //    var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
-            //    if (listBoxItem != null)
-            //    {
-                   
-            //        var viewItem = listBoxItem.ContentTemplate;
-            //        var myContentPresenter = CommonHelper.FindVisualChild<ContentPresenter>(listBoxItem);
-            //        var obj = viewItem.FindName("data", myContentPresenter);
-
-            //        var checkNum = obj as PDFToolItem;
-
-            //        if (checkNum != null)
-            //        {
-            //            checkNum.IsShowConciseContent = IsShowConciseContent;
-            //        }
-
-            //    }
-            //}
-            
+            foreach (var item in PDFtools.QuickTools)
+            {
+                item.IsShowConciseContent = !(bool)BtnExptend.IsChecked;
+            }
         }
 
-      
+
 
         /// <summary>
         /// 编辑工具
@@ -96,20 +78,20 @@ namespace PDF_Office.Views.HomePanel.PDFTools
             foreach (var item in ListBoxToolBars.Items)
             {
                 i++;
-                var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
+               var listBoxItem = ListBoxToolBars.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem;
                 if (listBoxItem != null)
                 {
                     if (i % 4 != 0)
                     {
-                        listBoxItem.Margin = new Thickness(0, 0, margin, 20);
+                        listBoxItem.Margin = new Thickness(0, 0, margin, 0);
 
                     }
                     else
                     {
-                        listBoxItem.Margin = new Thickness(0, 0, 0, 20);
+                        listBoxItem.Margin = new Thickness(0, 0, 0, 0);
                     }
                     listBoxItem.Width = widthItem;
-                }
+                } 
             }
         }
 
@@ -127,6 +109,17 @@ namespace PDF_Office.Views.HomePanel.PDFTools
                 veiwModel.QuickToolsCommand.Execute(toolItem);
             }
         }
+
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            if(ListBoxToolBars.Items != null)
+            {
+                UpdateExptendUI();
+                ListBoxToolBars.Items.Refresh();
+                ListBoxToolBarsWidthChanged();
+            }
+           
+        }
     }
 
 }

+ 41 - 18
PDF Office/Views/PageEdit/PageEditContent.xaml

@@ -13,6 +13,7 @@
     xmlns:pageedit="clr-namespace:PDF_Office.Model.PageEdit"
     xmlns:pageedit1="clr-namespace:PDF_Office.ViewModels.PageEdit"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:viewmodel="clr-namespace:PDF_Office.ViewModels.PageEdit"
     xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
     Name="PageEdit"
     d:DataContext="{d:DesignInstance Type=pageedit1:PageEditContentViewModel}"
@@ -25,8 +26,9 @@
     <UserControl.Resources>
         <ResourceDictionary>
             <convert:BoolToVisible x:Key="BoolToVisibleConvert" />
+            <convert:UnVisivleConvert x:Key="UnVisibleConvert" />
             <DataTemplate x:Key="PageEditListBoxItemTemplate" DataType="{x:Type pageedit:PageEditItem}">
-                <StackPanel>
+                <StackPanel AllowDrop="True">
                     <Border
                         Name="BdBorder"
                         VerticalAlignment="Top"
@@ -84,7 +86,7 @@
                     <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
                         <Setter TargetName="BdBorder" Property="BorderBrush" Value="Blue" />
                         <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
-                        <Setter TargetName="BdPageNum" Property="Background" Value="Blue" />
+                        <Setter TargetName="BdPageNum" Property="Background" Value="blue" />
                         <Setter TargetName="BdPageNum" Property="CornerRadius" Value="4" />
                     </DataTrigger>
                     <MultiDataTrigger>
@@ -93,36 +95,56 @@
                             <Condition Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="False" />
                         </MultiDataTrigger.Conditions>
                         <MultiDataTrigger.Setters>
-                            <Setter TargetName="BdBorder" Property="BorderBrush" Value="Blue" />
+                            <Setter TargetName="BdBorder" Property="BorderBrush" Value="#68ACF8" />
                             <Setter TargetName="BdBorder" Property="CornerRadius" Value="4" />
                         </MultiDataTrigger.Setters>
                     </MultiDataTrigger>
                 </DataTemplate.Triggers>
             </DataTemplate>
 
-            <ContextMenu x:Key="ListBoxItemMenu">
+            <ContextMenu x:Key="ListBoxItemMenu" DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
                 <MenuItem Header="插入页面">
-                    <MenuItem Header="插入文件" />
-                    <MenuItem Header="插入空白页" />
-                    <MenuItem Header="插入自定义页面" />
+                    <MenuItem
+                        Command="{Binding InsertCommand}"
+                        CommandParameter="{x:Static model:ParameterNames.InsertType_File}"
+                        Header="插入文件" />
+                    <MenuItem
+                        Command="{Binding InsertCommand}"
+                        CommandParameter="{x:Static model:ParameterNames.InsertType_Blank}"
+                        Header="插入空白页" />
+                    <MenuItem
+                        Command="{Binding InsertCommand}"
+                        CommandParameter="{x:Static model:ParameterNames.InsertType_Custom}"
+                        Header="插入自定义页面" />
                 </MenuItem>
-                <MenuItem Header="提取页面" />
-                <MenuItem Header="替换页面" />
-                <MenuItem Header="删除页面" />
-                <MenuItem Header="删除页面" />
-                <MenuItem Header="顺时针旋转页面" />
-                <MenuItem Header="逆时针旋转页面" />
+                <MenuItem Command="{Binding ExtractCommand}" Header="提取页面" />
+                <MenuItem Command="{Binding ReplaceCommand}" Header="替换页面" />
+                <MenuItem Command="{Binding DeleteCommand}" Header="删除页面" />
+                <MenuItem Command="{Binding RightRotateCommand}" Header="顺时针旋转页面" />
+                <MenuItem Command="{Binding LeftRotateCommand}" Header="逆时针旋转页面" />
                 <MenuItem Header="复制" />
                 <MenuItem Header="剪切" />
                 <MenuItem Header="粘贴" />
-                <MenuItem Header="显示页面大小" />
+                <MenuItem
+                    Command="{Binding ShowPageSizeCommand}"
+                    Header="显示页面大小"
+                    Visibility="{Binding Source={x:Reference Name=MenuHidePageSize}, Path=Visibility, Converter={StaticResource UnVisibleConvert}}" />
+                <MenuItem
+                    Name="MenuHidePageSize"
+                    Command="{Binding ShowPageSizeCommand}"
+                    Header="隐藏页面大小"
+                    Visibility="{Binding HasShowPageSize}" />
                 <MenuItem Header="打印页面" />
             </ContextMenu>
         </ResourceDictionary>
     </UserControl.Resources>
 
     <Border BorderBrush="#F2F2F2" BorderThickness="0,1,0,0">
-        <Grid DragOver="Grid_DragOver">
+        <Grid
+            DragLeave="Grid_DragLeave"
+            DragOver="Grid_DragOver"
+            Drop="Grid_Drop"
+            PreviewDragEnter="Grid_PreviewDragEnter">
             <Grid.RowDefinitions>
                 <RowDefinition Height="auto" />
                 <RowDefinition />
@@ -318,12 +340,13 @@
                         <Setter Property="Template" Value="{StaticResource ListBoxItemControlTemplate}" />
                         <Setter Property="Margin" Value="0,10" />
                         <Setter Property="Visibility" Value="{Binding Visible}" />
-                        <Setter Property="IsSelected" Value="{Binding Selected, Mode=TwoWay}" />
+                        <Setter Property="IsSelected" Value="{Binding Selected, Mode=OneWayToSource}" />
                         <Setter Property="HorizontalAlignment" Value="Center" />
                         <Setter Property="VerticalAlignment" Value="Center" />
                         <Setter Property="HorizontalContentAlignment" Value="Center" />
                         <Setter Property="VerticalContentAlignment" Value="Center" />
                         <Setter Property="ContextMenu" Value="{StaticResource ListBoxItemMenu}" />
+                        <EventSetter Event="DragLeave" Handler="ListBoxItem_DragLeave"/>
                         <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
                         <EventSetter Event="PreviewMouseDoubleClick" Handler="ListBoxItem_PreviewMouseDoubleClick" />
                     </Style>
@@ -381,7 +404,7 @@
                 Grid.Row="1"
                 Width="auto"
                 Height="auto"
-                Margin="0,0,0,200"
+                Margin="0,0,0,100"
                 VerticalAlignment="Bottom"
                 Background="#89000000"
                 BeginTime="0:0:0:3"
@@ -389,7 +412,7 @@
                 FontSize="14"
                 Foreground="White"
                 StringContent="{Binding ToastText}"
-                Visibility="{Binding ShowTip}"
+                Visibility="{Binding ShowTip, Mode=TwoWay}"
                 Duration="0:0:0:3" />
             <ProgressBar
                 Grid.Row="1"

+ 155 - 319
PDF Office/Views/PageEdit/PageEditContent.xaml.cs

@@ -75,18 +75,13 @@ namespace PDF_Office.Views.PageEdit
         //拖动的Item
         private PageEditItem tempItem;
 
-        ///鼠标是否停留在item前半部
-        ///显示在前半部时,获取的index为实际索引值
-        ///显示在后半部时,获取的index需要+1
-        private bool isFrontHalf = false;
-
         /// <summary>
         /// 是否正在拖拽排序中,通过该变量避免单击触发拖动
         /// </summary>
         private bool isDraging = false;
 
         //是否正在从外部拖入文件
-        private bool isDragingEnter = false;
+        public bool isDragingEnter { get; set; } = false;
 
         /// <summary>
         /// 是否需要自动滚动
@@ -105,7 +100,7 @@ namespace PDF_Office.Views.PageEdit
         }
 
 
-        public PageEditContent(IEventAggregator eventAggregator) :this()
+        public PageEditContent(IEventAggregator eventAggregator) : this()
         {
             eventor = eventAggregator;
             unicode = App.mainWindowViewModel.SelectedItem.Unicode;
@@ -153,15 +148,15 @@ namespace PDF_Office.Views.PageEdit
         }
 
 
-            #region UI事件
-            /// <summary>
-            /// 每次显示的时候就触发事件,刷新所有图片
-            /// </summary>
-            /// <param name="sender"></param>
-            /// <param name="e"></param>
-            private void PageEdit_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+        #region UI事件
+        /// <summary>
+        /// 每次显示的时候就触发事件,刷新所有图片
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void PageEdit_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
         {
-            if((bool)e.NewValue)
+            if ((bool)e.NewValue)
             {
                 //当前页面没有发生变化时,刷新图片 这种情况下会拿两次图,需要留意
                 PulishEvent();
@@ -287,7 +282,7 @@ namespace PDF_Office.Views.PageEdit
         /// <param name="e"></param>
         private void TextBox_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
         {
-            if((bool)e.NewValue)
+            if ((bool)e.NewValue)
             {
                 (sender as Control).Focus();
             }
@@ -320,6 +315,7 @@ namespace PDF_Office.Views.PageEdit
                     if (pos.Y < 0 || pos.Y > ListPageEdit.ActualHeight)
                     {
                         LineInset.Visibility = Visibility.Collapsed;
+                        ImgPicture.Visibility = Visibility.Collapsed;
                         return;
                     }
                     HitTestResult result = VisualTreeHelper.HitTest(ListPageEdit, pos);
@@ -359,7 +355,8 @@ namespace PDF_Office.Views.PageEdit
             }
             catch
             {
-               LineInset.Visibility = Visibility.Collapsed;
+                LineInset.Visibility = Visibility.Collapsed;
+                ImgPicture.Visibility = Visibility.Collapsed;
             }
         }
 
@@ -425,7 +422,7 @@ namespace PDF_Office.Views.PageEdit
 
             //更改系统默认的选中规则,多选后,鼠标单击抬起后再选中单个
             //拖拽框选之后的抬起鼠标不进入处理
-            if (!startChoose&&!Keyboard.IsKeyDown(Key.LeftCtrl) && !Keyboard.IsKeyDown(Key.LeftShift))
+            if (!startChoose && !Keyboard.IsKeyDown(Key.LeftCtrl) && !Keyboard.IsKeyDown(Key.LeftShift))
             {
                 ListPageEdit.SelectedItems.Clear();
                 ListPageEdit.SelectedItem = listBoxItem;
@@ -488,152 +485,13 @@ namespace PDF_Office.Views.PageEdit
             return;
         }
 
-        /// <summary>
-        /// 计算插入标记线和虚影显示
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ListPageEdit_DragOver(object sender, DragEventArgs e)
-        {
-            try
-            {
-                //ctrl建按下 不显示插入标记和虚影  因为释放不会响应drop事件
-                if (e.KeyStates == (DragDropKeyStates.ControlKey | DragDropKeyStates.LeftMouseButton) || e.KeyStates == (DragDropKeyStates.ShiftKey | DragDropKeyStates.LeftMouseButton | DragDropKeyStates.ControlKey))
-                    return;
-
-                //滚动后有 位置不准确 要减去滚动偏移量
-                //控制线的位置
-                var pos = e.GetPosition(ListPageEdit);
-                var result = VisualTreeHelper.HitTest(ListPageEdit, pos);
-                if (result == null)
-                {
-                    //MidLane.Visibility = Visibility.Collapsed;
-                    //return;
-                }
-
-                //获取当前鼠标指针下的容器
-                var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (listBoxItem == null)
-                {
-                    //MidLane.Visibility = Visibility.Collapsed;
-                    //return;
-                }
-
-                #region  计算虚影位置
-                //xaml层 要设置 虚影控件为左上
-                double xPos = 0;
-                double yPos = 0;
-                //内部拖动
-                if (!isDragingEnter)
-                {
-                    //Viewbox viewBox = (tempItem.Content as StackPanel).Children[0] as Viewbox;//获取item宽度
-
-                    ImgPicture.Width = tempItem.ItemSize.Width;
-                    ImgPicture.Height = tempItem.ItemSize.Height;
-                    ImgPicture.Source = tempItem.Image;
-                    xPos = e.GetPosition(ListPageEdit).X - item_x;
-                    yPos = e.GetPosition(ListPageEdit).Y - item_y;
-                }
-                //else
-                //{
-                //    //从外部拖入的逻辑
-                //    //var pic = ToBitmapSource(dragingEnterPath);
-                //    //ShadowPicture.Width = pic.Width;
-                //    //ShadowPicture.Height = pic.Height;
-                //    //ShadowPicture.Source = pic;
-                //    //xPos = e.GetPosition(ListPageEdit).X - pic.Width / 2;
-                //    //yPos = e.GetPosition(ListPageEdit).Y - pic.Height / 2;
-                //}
-
-                ImgPicture.Margin = new Thickness(xPos, yPos, 0, 0);
-                #endregion
-
-                #region 计算插入标记位置
-                var scroll = GetScrollHost(ListPageEdit);
-                if (listBoxItem != null)
-                {
-                    //虚拟化影响到该值计算
-                    var p = VisualTreeHelper.GetOffset(listBoxItem);//计算控件在容器中的偏移(位置)
-                    LineInset.Visibility = Visibility.Visible;
-
-                    var panel = GetWrapPanel(ListPageEdit);
-                    var item = (ListPageEdit.ItemContainerGenerator.ContainerFromIndex(0) as ListBoxItem).DesiredSize.Width;
-
-                    int count = (int)(panel.ViewportWidth / item);
-                    var gap = (panel.ViewportWidth - count * item) / (count + 1) * 1.0;
-
-                    LineInset.X2 = LineInset.X1 = p.X + gap / 2 + listBoxItem.DesiredSize.Width;
-
-                    if (pos.X < p.X + gap / 2 + listBoxItem.ActualWidth / 2)
-                    {
-                        isFrontHalf = true;//前半部 线条出现在位置前 
-                        LineInset.X2 = LineInset.X1 = p.X - gap / 2;
-                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem);
-                    }
-                    else
-                    {
-                        isFrontHalf = false;
-                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem) + 1;
-                    }
-                    //MidLane.Y1 = p.Y - scroll.VerticalOffset;//向下滑动后要减去滑动值
-                    LineInset.Y1 = p.Y;
-                    if (LineInset.Y1 < 0)//避免超出上边界
-                    {
-                        LineInset.Y1 = 0;
-                    }
-                    //MidLane.Y2 = p.Y + listBoxItem.ActualHeight - scroll.VerticalOffset;//仿智能滚动后可能会导致 垂直滚动偏量不准确
-                    LineInset.Y2 = p.Y + listBoxItem.ActualHeight;
-                    if (LineInset.Y2 < 0)
-                    {
-                        LineInset.Y2 = 0;
-                    }
-                }
-                #endregion
-
-                //暂时处理  鼠标移出边框时,虚影的显示问题
-                if (pos.Y <= 30 || pos.Y >= ListPageEdit.ActualHeight - 10)
-                {
-                    LineInset.Visibility = Visibility.Collapsed;
-                    needScroll = false;
-                }
-
-                if (pos.X <= 40 || pos.X >= scroll.ViewportWidth - 50)
-                {
-                    LineInset.Visibility = Visibility.Collapsed;
-                    needScroll = false;
-                }
-
-                #region 靠近上下边界时,自动滚动,离边界越近,滚动速度越快
-                //speed = 0;
-                //if (pos.Y >= PageEditListBox.ActualHeight - 30)
-                //{
-                //    speed = 30 - (int)(PageEditListBox.ActualHeight - pos.Y);
-                //    needScroll = true;
-                //}
-                //else if (pos.Y <= 30)
-                //{
-                //    speed = (int)(pos.Y - 30);
-                //    needScroll = true;
-                //}
-                //else
-                //    needScroll = false;
-
-                //var v = scroll.VerticalOffset;
-                //scroll.ScrollToVerticalOffset(v + speed);//触发连续滚动
-                #endregion
-            }
-            catch (Exception ex)
-            {
-
-            }
-        }
-
         /// <summary>
         /// 退出拖拽模式
         /// </summary>
         private void ExitDraging()
         {
             LineInset.Visibility = Visibility.Collapsed;
+            ImgPicture.Visibility = Visibility.Collapsed;
             isDraging = false;
         }
 
@@ -642,13 +500,14 @@ namespace PDF_Office.Views.PageEdit
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void ListPageEdit_Drop(object sender, DragEventArgs e)
+        private async void ListPageEdit_Drop(object sender, DragEventArgs e)
         {
             needScroll = false;
             if (!isDraging)
             {
                 //未拖拽时隐藏插入标记和虚影
                 LineInset.Visibility = Visibility.Collapsed;
+                ImgPicture.Visibility = Visibility.Collapsed;
                 return;
             }
             #region 功能付费锁
@@ -662,73 +521,44 @@ namespace PDF_Office.Views.PageEdit
             #endregion
 
             #region  从外部拖拽插入文件
-            //if (isDragingEnter)
-            //{
-
-
-            //    //在当前位置插入整个pdf
-            //    CPDFDocument dragDoc = CPDFDocument.InitWithFilePath(dragingEnterPath);
-            //    if (dragDoc.IsLocked)
-            //    {
-            //        VerifyPasswordDialog dialog = new VerifyPasswordDialog(dragDoc);
-            //        dialog.ShowDialog();
-            //        if (dragDoc.IsLocked)
-            //            return;
-            //    }
-            //    if (dragingEnterPath.Substring(dragingEnterPath.LastIndexOf(".")).ToLower() == ".pdf")
-            //    {
-            //        if (dragDoc != null)
-            //        {
-            //            int index = InsertIndex == -1 ? 0 : InsertIndex;
-            //            pdfViewer.Document.ImportPagesAtIndex(dragDoc, "1-" + dragDoc.PageCount, index);
-            //            PopulateThumbnailList();
-            //            ItemsInViewHitTest();
-
-            //            pdfViewer.UndoManager.ClearHistory();
-            //            pdfViewer.UndoManager.CanSave = true;
-            //            pdfViewer.ReloadDocument();
-            //            PageEditListBox.ScrollIntoView(PageEditListBox.SelectedItem as ListBoxItem);
-            //            PageMoved.Invoke(this, new RoutedEventArgs());
-            //            PDFViewerCtrl viewerCtrl = ParentPage?.GetCurrentViewer();
-            //            if (viewerCtrl != null)
-            //            {
-            //                viewerCtrl.IsPageEdit = true;
-            //            }
-            //            dragDoc.Release();
-            //        }
-            //        else
-            //        {
-            //            MessageBoxEx.Show(App.MainPageLoader.GetString("Merge_FileCannotOpenedWarningd"));
-            //        }
-            //        //提示文档损坏无法打开
-            //    }
-            //    else if (!string.IsNullOrEmpty(dragingEnterPath))
-            //    {
-            //        //其他文件  则新增一个页签打开
-            //        //    DragAddTab.Invoke(dragingEnterPath, new RoutedEventArgs());//底层库需要加一个  Load(TPDFDocument)的接口
-            //    }
-            //    MidLane.Visibility = Visibility.Collapsed;
-            //    isDragingEnter = false;
-            //    dragingEnterPath = null;
-            //    return;
-            //}
+            if (isDragingEnter)
+            {
+                var files = (string[])e.Data.GetData(DataFormats.FileDrop);
+                Array.Reverse(files);
+                foreach(string file in files)
+                {
+                    System.IO.FileInfo info = new System.IO.FileInfo(file);
+                    if(System.IO.Path.GetExtension(file).ToLower()==".pdf"&&info.Length>0)
+                    {
+                        int index = InsertIndex == -1 ? 0 : InsertIndex;
+                        viewModel.InsertFromFile(index, file);
+                        viewModel.ReloadAfterOption(true,true,new Tuple<int, int>(0,ListPageEdit.Items.Count));
+                    }
+                }
+                //其他文件  则新增一个页签打开
+                //    DragAddTab.Invoke(dragingEnterPath, new RoutedEventArgs());//底层库需要加一个  Load(TPDFDocument)的接口
+                LineInset.Visibility = Visibility.Collapsed;
+                ImgPicture.Visibility = Visibility.Collapsed;
+                isDragingEnter = false;
+                return;
+            }
             #endregion
 
             var pos = e.GetPosition(ListPageEdit);
             var result = VisualTreeHelper.HitTest(ListPageEdit, pos);
-            if (result == null)
-            {
-                //超出当前可控区域
-                ExitDraging();
-                return;
-            }
-            //查找元数据
-            var sourcePerson = e.Data.GetData(typeof(StackPanel)) as StackPanel;
-            if (sourcePerson == null)
-            {
-                ExitDraging();
-                return;
-            }
+            //if (result == null)
+            //{
+            //    //超出当前可控区域
+            //    ExitDraging();
+            //    return;
+            //}
+            ////查找元数据
+            //var sourcePerson = e.Data.GetData(typeof(StackPanel)) as StackPanel;
+            //if (sourcePerson == null)
+            //{
+            //    ExitDraging();
+            //    return;
+            //}
             //查找目标数据
             int targetindex = 0;//目标插入位置
             if (InsertIndex != -1)
@@ -736,26 +566,26 @@ namespace PDF_Office.Views.PageEdit
                 //往前移动时  此index  不是准确的,需要处理++
                 targetindex = InsertIndex;
             }
-            else//基本不会命中  仅作为保险措施
-            {
-                var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (listBoxItem == null)
-                {
-                    ////鼠标停留在两个item之间或其他无效区域  暂时不做处理(比较麻烦)
-                    ExitDraging();
-                    return;
-                }
-                var targetPerson = listBoxItem;
-                targetPerson.Opacity = 1;
-                sourcePerson.Opacity = 1;
-                if (ReferenceEquals(targetPerson, sourcePerson))
-                {
-                    ExitDraging();
-                    return;
-                }
+            //else//基本不会命中  仅作为保险措施
+            //{
+            //    var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
+            //    if (listBoxItem == null)
+            //    {
+            //        ////鼠标停留在两个item之间或其他无效区域  暂时不做处理(比较麻烦)
+            //        ExitDraging();
+            //        return;
+            //    }
+            //    var targetPerson = listBoxItem;
+            //    targetPerson.Opacity = 1;
+            //    sourcePerson.Opacity = 1;
+            //    if (ReferenceEquals(targetPerson, sourcePerson))
+            //    {
+            //        ExitDraging();
+            //        return;
+            //    }
 
-                targetindex = ListPageEdit.Items.IndexOf(targetPerson);
-            }
+            //    targetindex = ListPageEdit.Items.IndexOf(targetPerson);
+            //}
 
             List<ListBoxItem> list = new List<ListBoxItem>();
             List<int> sourceindex = new List<int>();//需要保存每个页面对应的位置
@@ -764,67 +594,17 @@ namespace PDF_Office.Views.PageEdit
             //要先对所有选中项 根据页码排序
             for (int i = 0; i < ListPageEdit.SelectedItems.Count; i++)
             {
-                var pageindex = ListPageEdit.Items.IndexOf(ListPageEdit.SelectedItems[i] as ListBoxItem);
+                var pageindex = ListPageEdit.Items.IndexOf(ListPageEdit.SelectedItems[i] as PageEditItem);
                 pages.Add(pageindex);//存入的为页码索引值
             }
-            pages.Sort();
             if (pages.Count <= 0)
             {
                 ExitDraging();
                 return;
             }
 
-            //要考虑每一次交换都会导致局部页码发生改变
-            //每次整体往后移动时,先移动大页码;整体往前移动时,先移动小页码;往中间移动时,再按上述两种情况分别移动
-            //if (targetindex <= pages[0])// 目标位置在所有选中内容左边,整体前移动  优先先判断左移的情况
-            //{
-            //    sourceindex.Add(-1);
-            //    list = new List<ListBoxItem>();
-            //    for (int i = 0; i < pages.Count; i++)
-            //    {
-            //        list.Add(PageEditListBox.Items[pages[i]] as ListBoxItem);
-            //        sourceindex.Add(pages[i]);
-            //        DragToSort(pages[i], targetindex + i);
-            //    }
-            //}
-            //else if (targetindex > pages[pages.Count - 1])//目标位置在所有选中内容右边 整体后移
-            //{
-            //    sourceindex.Add(1);
-            //    list = new List<ListBoxItem>();
-            //    for (int i = 0; i < pages.Count; i++)
-            //    {
-            //        list.Add(PageEditListBox.Items[pages[pages.Count - 1 - i]] as ListBoxItem);
-            //        sourceindex.Add(pages[pages.Count - 1 - i]);
-            //        DragToSort(pages[pages.Count - 1 - i], targetindex - 1 - i/* + (PageEditListBox.SelectedItems.Count - 1 - i)*/);
-            //    }
-            //}
-            //else//目标位置在所有选中项中间
-            //{
-            //    int i, j, k;
-            //    for (k = 0; k < pages.Count - 1; k++)//找出PageEditListBox.Items中页码等于destpage的下标
-            //    {
-            //        //这里要算入K---即前面部分的页面个数
-            //        if (pages[k] < targetindex && pages[k + 1] >= targetindex)
-            //            break;
-            //    }
-
-            //    sourceindex.Add(0);
-            //    list = new List<ListBoxItem>();
-            //    for (i = 0; i <= k; i++)//局部往后移动
-            //    {
-            //        list.Add(PageEditListBox.Items[pages[k - i]] as ListBoxItem);
-            //        sourceindex.Add(pages[k - i]);
-            //        DragToSort(pages[k - i], targetindex - 1 - i);
-            //    }
-            //    for (j = i; j < pages.Count; j++)//局部往前移动
-            //    {
-            //        list.Add(PageEditListBox.Items[pages[j]] as ListBoxItem);
-            //        sourceindex.Add(pages[j]);
-            //        DragToSort(pages[j], targetindex);
-            //        targetindex++;
-            //    }
-            //    sourceindex.Add(k);//往中间移时, index数组的最后一位 表示 间隔位置K
-            //}
+            viewModel.DragToSort(targetindex,pages);
+            ExitDraging();
             isDraging = false;
         }
 
@@ -851,6 +631,8 @@ namespace PDF_Office.Views.PageEdit
                 if (e.KeyStates == (DragDropKeyStates.ControlKey | DragDropKeyStates.LeftMouseButton) || e.KeyStates == (DragDropKeyStates.ShiftKey | DragDropKeyStates.LeftMouseButton | DragDropKeyStates.ControlKey))
                     return;
 
+
+
                 //滚动后有 位置不准确 要减去滚动偏移量
                 //控制线的位置
                 var pos = e.GetPosition(ListPageEdit);
@@ -876,24 +658,26 @@ namespace PDF_Office.Views.PageEdit
                 //内部拖动
                 if (!isDragingEnter)
                 {
-                    //Viewbox viewBox = (tempItem.Content as StackPanel).Children[0] as Viewbox;//获取item宽度
-
-                    ImgPicture.Width = tempItem.ItemSize.Width;
-                    ImgPicture.Height = tempItem.ItemSize.Height;
-                    ImgPicture.Source = tempItem.Image;
-                    xPos = e.GetPosition(ListPageEdit).X - item_x;
-                    yPos = e.GetPosition(ListPageEdit).Y - item_y;
+                    if(tempItem!=null)
+                    {
+                        ImgPicture.Width = tempItem.ItemSize.Width;
+                        ImgPicture.Height = tempItem.ItemSize.Height;
+                        ImgPicture.Source = tempItem.Image;
+                        xPos = e.GetPosition(ListPageEdit).X - item_x;
+                        yPos = e.GetPosition(ListPageEdit).Y - item_y;
+                    }
+                }
+                else
+                {
+                    DragDropHelper.DragOver(this, e);
+                    //从外部拖入的逻辑
+                    //var pic = ToBitmapSource(dragingEnterPath);
+                    //ShadowPicture.Width = pic.Width;
+                    //ShadowPicture.Height = pic.Height;
+                    //ShadowPicture.Source = pic;
+                    //xPos = e.GetPosition(ListPageEdit).X - pic.Width / 2;
+                    //yPos = e.GetPosition(ListPageEdit).Y - pic.Height / 2;
                 }
-                //else
-                //{
-                //    //从外部拖入的逻辑
-                //    //var pic = ToBitmapSource(dragingEnterPath);
-                //    //ShadowPicture.Width = pic.Width;
-                //    //ShadowPicture.Height = pic.Height;
-                //    //ShadowPicture.Source = pic;
-                //    //xPos = e.GetPosition(ListPageEdit).X - pic.Width / 2;
-                //    //yPos = e.GetPosition(ListPageEdit).Y - pic.Height / 2;
-                //}
 
                 ImgPicture.Margin = new Thickness(xPos, yPos, 0, 0);
                 #endregion
@@ -905,6 +689,14 @@ namespace PDF_Office.Views.PageEdit
                     //虚拟化影响到该值计算
                     var p = VisualTreeHelper.GetOffset(listBoxItem);//计算控件在容器中的偏移(位置)
                     LineInset.Visibility = Visibility.Visible;
+                    if(!isDragingEnter)
+                    {
+                        ImgPicture.Visibility = Visibility.Visible;
+                    }
+                    else
+                    {
+                        ImgPicture.Visibility = Visibility.Collapsed;
+                    }
 
                     var panel = GetWrapPanel(ListPageEdit);
 
@@ -919,15 +711,14 @@ namespace PDF_Office.Views.PageEdit
 
                     if (pos.X < p.X + gap / 2 + listBoxItem.ActualWidth / 2)
                     {
-                        isFrontHalf = true;//前半部 线条出现在位置前 
                         LineInset.X2 = LineInset.X1 = p.X - gap / 2;
-                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem);
+                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem.DataContext as PageEditItem);
                     }
                     else
                     {
-                        isFrontHalf = false;
-                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem) + 1;
+                        InsertIndex = ListPageEdit.Items.IndexOf(listBoxItem.DataContext as PageEditItem) + 1;
                     }
+                    Console.WriteLine("InsertIndex:{0}\r\n",InsertIndex);
                     //MidLane.Y1 = p.Y - scroll.VerticalOffset;//向下滑动后要减去滑动值
                     LineInset.Y1 = p.Y;
                     if (LineInset.Y1 < 0)//避免超出上边界
@@ -947,12 +738,14 @@ namespace PDF_Office.Views.PageEdit
                 if (pos.Y <= 30 || pos.Y >= ListPageEdit.ActualHeight - 10)
                 {
                     LineInset.Visibility = Visibility.Collapsed;
+                    ImgPicture.Visibility = Visibility.Collapsed;
                     needScroll = false;
                 }
 
                 if (pos.X <= 40 || pos.X >= scroll.ViewportWidth - 50)
                 {
                     LineInset.Visibility = Visibility.Collapsed;
+                    ImgPicture.Visibility = Visibility.Collapsed;
                     needScroll = false;
                 }
 
@@ -983,14 +776,14 @@ namespace PDF_Office.Views.PageEdit
 
         private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-            
+
             //e.Handled = true;
         }
 
         private void ListBoxItem_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
         {
-            if(e.ChangedButton== MouseButton.Left)
-            {         
+            if (e.ChangedButton == MouseButton.Left)
+            {
                 //双击回到PDFViewer界面
                 var item = sender as ListBoxItem;
                 if (item != null)
@@ -1024,7 +817,7 @@ namespace PDF_Office.Views.PageEdit
             {
                 var itemwidth = 0.6 * width;
                 var itemheight = 294 * itemwidth / 208.0;
-                viewModel.ChangeItemSize(new Size(itemwidth,itemheight));
+                viewModel.ChangeItemSize(new Size(itemwidth, itemheight));
             }
         }
 
@@ -1032,5 +825,48 @@ namespace PDF_Office.Views.PageEdit
         {
             ItemSuitAcutalWidth(this.ActualWidth);
         }
+
+        /// <summary>
+        /// 用来判断是否有外界拖入的事件
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void Grid_PreviewDragEnter(object sender, DragEventArgs e)
+        {
+            DragDropHelper.DragEnter(this,e);
+
+            var file = (System.Array)e.Data.GetData(DataFormats.FileDrop);
+            if (file == null)//为null 表示内部拖动 触发的
+            { 
+                return; 
+            }
+            isDragingEnter = false;
+            foreach (string f in file)
+            {
+                System.IO.FileInfo info = new System.IO.FileInfo(f);
+                //只要拖拽进来的文件里包含有pdf格式文件,就允许拖入
+                if(System.IO.Path.GetExtension(f).ToLower()==".pdf" &&info.Length>0)
+                {
+                    isDragingEnter = true;
+                }
+            }
+        }
+
+        private void Grid_DragLeave(object sender, DragEventArgs e)
+        {
+            DragDropHelper.DragLeave();
+        }
+
+        private void Grid_Drop(object sender, DragEventArgs e)
+        {
+            DragDropHelper.Drop(this,e);
+        }
+
+        private void ListBoxItem_DragLeave(object sender, DragEventArgs e)
+        {
+            //增加辅助判断,防止误触发 拖动排序
+            //较大幅度拖动才能触发排序
+            isDraging = true;
+        }
     }
 }

+ 94 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml

@@ -0,0 +1,94 @@
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.CustomCreateDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=annotpanel:CustomCreateDialogViewModel}"
+             mc:Ignorable="d" >
+
+    <cus:DialogContent Header="新建图章">
+        <cus:DialogContent.Content>
+            <TabControl Grid.Row="1" Name="StampTabControl" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Style="{StaticResource TabControlWithUnderLineStyle}">
+                <TabItem x:Name="文字图章"
+                        Header="Standard"
+                        FontFamily="Segoe UI" Foreground="#FF666666"
+                        HorizontalContentAlignment="Center"
+                        FontSize="16"
+                        Height="40"
+                        Width="88"
+                        IsSelected="True">
+                    <Grid>
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="*"/>
+                            <RowDefinition Height="*"/>
+                            <RowDefinition Height="*"/>
+                            <RowDefinition Height="*"/>
+                        </Grid.RowDefinitions>
+                        <Image Height="50" Source="{Binding ImageSource}"/>
+                        <TextBox Grid.Row="1" Text="{Binding StampText,Mode=TwoWay}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="LostFocus">
+                                    <i:InvokeCommandAction Command="{Binding UpDataDynamicCommnad}" PassEventArgsToCommand="True" />
+                                </i:EventTrigger>
+                                <i:EventTrigger EventName="KeyDown">
+                                    <i:InvokeCommandAction Command="{Binding KeyDown}" PassEventArgsToCommand="True" />
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </TextBox>
+                        <Grid Grid.Row="2">
+                            <StackPanel Orientation="Horizontal">
+                                <RadioButton Tag="1" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="2" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="3" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="4" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="5" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="6" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="7" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="8" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="9" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="10" Checked="RadioButton_Checked"/>
+                                <RadioButton Tag="11" Checked="RadioButton_Checked"/>
+                            </StackPanel>
+                        </Grid>
+                        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center">
+                            <CheckBox Name="Date" VerticalAlignment="Center" FontFamily="Seoge UI" FontSize="14" Content="Date" Padding="7 0 0 0" IsChecked="{Binding IsCheckedDate,Mode=TwoWay}"/>
+                            <CheckBox Name="Time" VerticalAlignment="Center" FontFamily="Seoge UI" FontSize="14" Content="Time" Padding="7 0 0 0" IsChecked="{Binding IsCheckedTime,Mode=TwoWay}"/>
+                        </StackPanel>
+                    </Grid>
+                </TabItem>
+                <TabItem  x:Name="图片图章"
+                        Header="Dynamic"
+                        FontFamily="Segoe UI" Foreground="#FF666666"
+                        HorizontalContentAlignment="Center"
+                        FontSize="16"
+                        Width="86">
+                    <Image/>
+                </TabItem>
+            </TabControl>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="50*" />
+                    <ColumnDefinition Width="50*" />
+                </Grid.ColumnDefinitions>
+                <Button
+                    Grid.Column="0"
+                    Width="150"
+                    Height="32"
+                    Margin="25,0,0,0"
+                    HorizontalAlignment="Left"
+                    Command="{Binding CreateCommnad}"
+                    Content="确定" />
+                <Button
+                    Grid.Column="1"
+                    Width="150"
+                    Height="32"
+                    Margin="0,0,25,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 34 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/CustomCreateDialog.xaml.cs

@@ -0,0 +1,34 @@
+using PDF_Office.ViewModels.PropertyPanel.AnnotPanel;
+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.PropertyPanel.AnnotPanel
+{
+    /// <summary>
+    /// CustomCreateDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class CustomCreateDialog : UserControl
+    {
+        public CustomCreateDialog()
+        {
+            InitializeComponent();
+        }
+
+        private void RadioButton_Checked(object sender, RoutedEventArgs e)
+        {
+            (DataContext as CustomCreateDialogViewModel).SetStampStyle(Convert.ToInt32((sender as RadioButton).Tag));
+        }
+    }
+}

+ 51 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/DynamicPropertyDialog.xaml

@@ -0,0 +1,51 @@
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.DynamicPropertyDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel" xmlns:cus="clr-namespace:PDF_Office.CustomControl" xmlns:annotpanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" d:DataContext="{d:DesignInstance Type=annotpanel:DynamicPropertyDialogViewModel}"
+             mc:Ignorable="d" 
+             Width="500"
+             Height="300">
+    <cus:DialogContent Header="动态图章">
+        <cus:DialogContent.Content>
+            <StackPanel Height="50" Grid.Row="1" HorizontalAlignment="Center" Orientation="Horizontal">
+                <CheckBox Name="chkAuthor" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" FontFamily="Seoge UI" FontSize="14" Margin="0 0 0 8" Content="Author" Padding="7 0 0 0" />
+                <TextBox x:Name="txtAuthor" VerticalContentAlignment="Center" IsEnabled="{Binding ElementName=chkAuthor, Path=IsChecked}" Text="{Binding Author,Mode=TwoWay}" Width="152" Height="32" HorizontalAlignment="Right" Margin="0 0 0 8"/>
+                <TextBlock x:Name="lbCreateDate" Grid.Row="1" FontFamily="Seoge UI" FontSize="14" Foreground="Black" VerticalAlignment="Center" Margin="27 0 0 0" Text="Date"/>
+                <ComboBox Name="txtCreateDate" SelectedIndex="{Binding SelectedIndex}" Grid.Row="1" Background ="Transparent"  Width="152" BorderThickness="1" BorderBrush="#FFE2E3E6" HorizontalAlignment="Right" ItemsSource="{Binding DateFormatList}">
+                    <ComboBox.ItemTemplate>
+                        <DataTemplate >
+                            <ComboBoxItem Content="{Binding }">
+                            </ComboBoxItem>
+                        </DataTemplate>
+                    </ComboBox.ItemTemplate>
+                </ComboBox>
+            </StackPanel>
+        </cus:DialogContent.Content>
+        <cus:DialogContent.BottmBar>
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="50*" />
+                    <ColumnDefinition Width="50*" />
+                </Grid.ColumnDefinitions>
+                <Button
+                    Grid.Column="0"
+                    Width="150"
+                    Height="32"
+                    Margin="25,0,0,0"
+                    HorizontalAlignment="Left"
+                    Command="{Binding ApplyCommnad}"
+                    Content="确定" />
+                <Button
+                    Grid.Column="1"
+                    Width="150"
+                    Height="32"
+                    Margin="0,0,25,0"
+                    HorizontalAlignment="Right"
+                    Command="{Binding CancelCommand}"
+                    Content="取消" />
+            </Grid>
+        </cus:DialogContent.BottmBar>
+    </cus:DialogContent>
+</UserControl>

+ 0 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/TextEditProperty.xaml.cs


Some files were not shown because too many files changed in this diff