Explorar o código

底部工具栏-补充前进、后退功能

ZhouJieSheng %!s(int64=2) %!d(string=hai) anos
pai
achega
3a701a368e

+ 0 - 11
PDF Office/SDKLisence.xml

@@ -1,11 +0,0 @@
-<Lisences
-	devKey = "sTHSivIW4YnZQavIYDLVw4vaFcN5DQTUtRGrVyv5p9aeaHX3GirG/MBxl6Wy9TJbNOwR4CU6LPjHmGe3Po3OtBCPqIRheam9+LomScw3AvoUTHFlG1134e2J4enF43WJQ6PyOnjwZqsG1kUdlBPNztkoPzDAE2pQKgZWf6V2i34="
-    devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6cfaiHpW8pgW2aur3AxuQIBBLuJD5gcmNxTYW3KA32JLG8alfyXjKFVS3gka9bngvwfZ7GuNXybjKlmz1tnN6iVHpnbSj+xOHhWEperY4HHrSg=="
-	userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs="
-	userSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/"
-	ConverterDevKey="ErjZKxcU3SPvUohGZo0CBgy0XdkAsZqUYqCTbfn1AYsCQ6mxCucx61UPqLT7MDQ0n+5/oKnWY9SSk8Xv5pJtYYHD87HRdYNG+QNCaoPGHulyfVxGllmzU71U7WjflfZBFvhg/UQOFiz3OsAVKz4k2YkXPzQgNaS3glym42PVpj4="
-	ConverterDevSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iYfqdItiFUaR9LVjsPTUXicGXjRTJz0NHg67bO82qMNdkuY0NReKpg+S1SkS2QdEScM/fgvvcctF5rcqYAH1dpMv7C2jvq4o0q6sQtN3jR47j9bjclgv4TJTahQMmvDDLtOGD99YkYWB6rt/zU8htEYkwcNWVMyYvggPV2rTFvfawopGIC034QzjthmhwwX90="
-	ConverterUserkey=" WLUHzXhndQKyrTJVzvZ+dvPXDQDZeJpcSvklX3GJwRX4+urd8eQskYgbeCf0NXLZ/qJkS/k10x+qGad34i4v5rI/ASFIx901c/Nw5C0YJMH7X87dib141tdAmSmQhnKLO5TBi4FiAidboyvnLFLrYGMmS2kLQOXFPwPj5zQUv5A="
-	ConverterUserSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iK16EcneqBPRe2eKQLuJXpA79IONX9GVI/Ap3uWzMcNWaitc2UB6gDeexJXFPVaXOFAoV6NtcUJC8skonXVk7k/oKTJGcYKLPGdXenrzHolQ=="
-	>
-</Lisences>

+ 2 - 0
PDF Office/Themes/Generic.xaml

@@ -45,6 +45,7 @@
         <Setter Property="BorderBrush" Value="{StaticResource color.field.border.norm}" />
         <Setter Property="BorderBrush" Value="{StaticResource color.field.border.norm}" />
         <Setter Property="Foreground" Value="Black" />
         <Setter Property="Foreground" Value="Black" />
         <Setter Property="VerticalContentAlignment" Value="Center" />
         <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="HorizontalContentAlignment" Value="Left" />
         <Setter Property="BorderThickness" Value="1" />
         <Setter Property="BorderThickness" Value="1" />
         <Setter Property="FocusVisualStyle" Value="{x:Null}" />
         <Setter Property="FocusVisualStyle" Value="{x:Null}" />
         <Setter Property="Height" Value="32" />
         <Setter Property="Height" Value="32" />
@@ -74,6 +75,7 @@
                             <ScrollViewer
                             <ScrollViewer
                                 x:Name="PART_ContentHost"
                                 x:Name="PART_ContentHost"
                                 Margin="4,5,25,5"
                                 Margin="4,5,25,5"
+                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                 Focusable="false"
                                 Focusable="false"
                                 Foreground="{TemplateBinding Foreground}"
                                 Foreground="{TemplateBinding Foreground}"
                                 HorizontalScrollBarVisibility="Hidden"
                                 HorizontalScrollBarVisibility="Hidden"

+ 111 - 14
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -58,6 +58,16 @@ namespace PDF_Office.ViewModels
 
 
         public DelegateCommand<object> ShowViewModularCommand { get; set; }
         public DelegateCommand<object> ShowViewModularCommand { get; set; }
 
 
+        /// <summary>
+        /// 上一个视图
+        /// </summary>
+        public DelegateCommand PreViewCommand { get; set; }
+
+        /// <summary>
+        /// 下一个视图
+        /// </summary>
+        public DelegateCommand NextViewCommnad { get; set; }
+
         private bool isShowViewModular = false;
         private bool isShowViewModular = false;
 
 
         /// <summary>
         /// <summary>
@@ -181,11 +191,51 @@ namespace PDF_Office.ViewModels
             }
             }
         }
         }
 
 
+        private bool isPreEnable = false;
+
+        /// <summary>
+        /// 前进是否启用
+        /// </summary>
+        public bool IsPreEnable
+        {
+            get { return isPreEnable; }
+            set
+            {
+                SetProperty(ref isPreEnable, value);
+            }
+        }
+
+        private bool isNextEnable = false;
+
+        public bool IsNextEnable
+        {
+            get { return isNextEnable; }
+            set
+            {
+                SetProperty(ref isNextEnable, value);
+            }
+        }
+
+        private Stack<int> UndoStack = new Stack<int>();
+
+        private Stack<int> RedoStack = new Stack<int>();
+
 
 
         public CPDFViewer PDFViewer { get; set; }
         public CPDFViewer PDFViewer { get; set; }
 
 
         public ViewContentViewModel ViewContentViewModel { get; set; }
         public ViewContentViewModel ViewContentViewModel { get; set; }
 
 
+        /// <summary>
+        /// 来自undo redo方法的跳页 不计入栈
+        /// </summary>
+        private bool isFromMethod = false;
+
+        /// <summary>
+        /// 记录上一个页面索引值
+        /// </summary>
+
+        private int oldPageIndex = 0;
+
         private IRegionManager region;
         private IRegionManager region;
 
 
         private IDialogService dialogs;
         private IDialogService dialogs;
@@ -206,6 +256,41 @@ namespace PDF_Office.ViewModels
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
             SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
             SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
             ShowViewModularCommand = new DelegateCommand<object>(ShowViewModularEvent);
             ShowViewModularCommand = new DelegateCommand<object>(ShowViewModularEvent);
+
+            PreViewCommand = new DelegateCommand(undo);
+
+            NextViewCommnad = new DelegateCommand(redo);
+        }
+
+        private void undo()
+        {
+            RedoStack.Push(PDFViewer.CurrentIndex);
+            IsNextEnable = true;
+
+            int index =  UndoStack.Pop();
+            PDFViewer.GoToPage(index);
+            if(UndoStack.Count<=0)
+            {
+                IsPreEnable = false;
+            }
+            isFromMethod = true;
+        }
+
+        private void redo()
+        {
+            App.Current.Dispatcher.Invoke(() =>
+            {
+                UndoStack.Push(PDFViewer.CurrentIndex);
+                IsPreEnable = true;
+
+                int index = RedoStack.Pop();
+                PDFViewer.GoToPage(index);
+                if (RedoStack.Count <= 0)
+                {
+                    IsNextEnable = false;
+                }
+            });
+            isFromMethod = true;
         }
         }
 
 
         private void ShowViewModularEvent(object obj)
         private void ShowViewModularEvent(object obj)
@@ -475,7 +560,16 @@ namespace PDF_Office.ViewModels
                 {
                 {
                     CurrentPage = renderData.PageIndex;
                     CurrentPage = renderData.PageIndex;
                     PageCount = PDFViewer.Document.PageCount;
                     PageCount = PDFViewer.Document.PageCount;
+                    if(!renderData.IsMouseWheel&&!isFromMethod)
+                    {
+                        UndoStack.Push(oldPageIndex);
+                        RedoStack.Clear();
+                        IsNextEnable = false;
+                        IsPreEnable = true;
+                    }
+                    isFromMethod = false;
                 }
                 }
+                oldPageIndex = renderData.PageIndex - 1;
             }
             }
             if (e.Key == "ViewMode")
             if (e.Key == "ViewMode")
             {
             {
@@ -488,6 +582,22 @@ namespace PDF_Office.ViewModels
             }
             }
         }
         }
 
 
+        private void ViewContentViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName == "OCRContentVisible")
+            {
+                if (ViewContentViewModel.OCRContentVisible == Visibility.Visible)
+                {
+                    RightPanelEnable = false;
+                }
+                else
+                {
+                    RightPanelEnable = true;
+                }
+            }
+        }
+
+
         private void GetModeView(ViewMode mode)
         private void GetModeView(ViewMode mode)
         {
         {
             if ((int)mode % 2 == 0)
             if ((int)mode % 2 == 0)
@@ -583,6 +693,7 @@ namespace PDF_Office.ViewModels
             {
             {
                 //获取页面设置等信息
                 //获取页面设置等信息
                 PDFViewer = pdfview;
                 PDFViewer = pdfview;
+                oldPageIndex = pdfview.CurrentIndex;
                 PageCount = PDFViewer.Document.PageCount;
                 PageCount = PDFViewer.Document.PageCount;
                 GetModeView(PDFViewer.ModeView);
                 GetModeView(PDFViewer.ModeView);
                 CurrentPage = PDFViewer.CurrentIndex + 1;
                 CurrentPage = PDFViewer.CurrentIndex + 1;
@@ -591,20 +702,6 @@ namespace PDF_Office.ViewModels
             }
             }
         }
         }
 
 
-        private void ViewContentViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
-        {
-            if(e.PropertyName == "OCRContentVisible")
-            {
-                if(ViewContentViewModel.OCRContentVisible == Visibility.Visible)
-                {
-                    RightPanelEnable = false;
-                }
-                else
-                {
-                    RightPanelEnable = true;
-                }
-            }
-        }
 
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
         {

+ 9 - 3
PDF Office/Views/BottomToolContent.xaml

@@ -64,12 +64,12 @@
             <cus:TextBoxEx
             <cus:TextBoxEx
                 Width="57"
                 Width="57"
                 Height="24"
                 Height="24"
-                Padding="10,0,0,0"
                 VerticalAlignment="Center"
                 VerticalAlignment="Center"
                 VerticalContentAlignment="Center"
                 VerticalContentAlignment="Center"
                 CornerRadius="4"
                 CornerRadius="4"
                 FontSize="12"
                 FontSize="12"
                 InputMethod.IsInputMethodEnabled="False"
                 InputMethod.IsInputMethodEnabled="False"
+                ShowClose="False"
                 Text="{Binding CurrentPage}">
                 Text="{Binding CurrentPage}">
                 <i:Interaction.Triggers>
                 <i:Interaction.Triggers>
                     <i:EventTrigger EventName="KeyDown">
                     <i:EventTrigger EventName="KeyDown">
@@ -122,14 +122,20 @@
             <Button
             <Button
                 Width="24"
                 Width="24"
                 Height="24"
                 Height="24"
-                Margin="8,0">
+                Margin="8,0"
+                Command="{Binding PreViewCommand}"
+                IsEnabled="{Binding IsPreEnable}">
                 <Path
                 <Path
                     Width="16"
                     Width="16"
                     Height="16"
                     Height="16"
                     Data="M2.56067 7.28028L5.7803 4.06066L4.71964 3L0.21967 7.49997C-0.0732233 7.79286 -0.0732233 8.26774 0.21967 8.56063L4.71964 13.0606L5.7803 11.9999L2.56065 8.78028L15.75 8.78029V7.28029L2.56067 7.28028Z"
                     Data="M2.56067 7.28028L5.7803 4.06066L4.71964 3L0.21967 7.49997C-0.0732233 7.79286 -0.0732233 8.26774 0.21967 8.56063L4.71964 13.0606L5.7803 11.9999L2.56065 8.78028L15.75 8.78029V7.28029L2.56067 7.28028Z"
                     Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
                     Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
             </Button>
             </Button>
-            <Button Width="24" Height="24">
+            <Button
+                Width="24"
+                Height="24"
+                Command="{Binding NextViewCommnad}"
+                IsEnabled="{Binding IsNextEnable}">
                 <Path
                 <Path
                     Width="16"
                     Width="16"
                     Height="16"
                     Height="16"