ソースを参照

书签优化、视图UI

OYXH\oyxh 2 年 前
コミット
32aa5714c1

+ 1 - 0
PDF Office/App.xaml.cs

@@ -123,6 +123,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<TextAnnotProperty>();
             containerRegistry.RegisterForNavigation<TextEditProperty>();
             containerRegistry.RegisterForNavigation<ViewModularContent>();
+            containerRegistry.RegisterForNavigation<SplitScreenView>();
 
             //注册弹窗
             containerRegistry.RegisterDialog<VerifyPassWordDialog>(DialogNames.VerifyPassWordDialog);

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

@@ -94,6 +94,19 @@ namespace PDF_Office.Model
             }
         }
 
+
+
+        /// <summary>
+        /// 视图模块-分屏视图
+        /// </summary>
+        public static string SplitScreenViewRegionName
+        {
+            get
+            {
+                return GetRegionName("SplitScreenViewRegionName");
+            }
+        }
+
         /// <summary>
         /// 获取MainWindowsViewModel RegionNames字典里的RegionName,
         /// 如果字典里没有键值就新建一个GUID,并插入到

+ 16 - 0
PDF Office/PDF Office.csproj

@@ -307,6 +307,7 @@
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\TextAnnotPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PropertyPanelContentViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\SplitScreenViewViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModularContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ToolsBarContentViewModel.cs" />
@@ -455,6 +456,9 @@
     <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
       <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\SplitScreenView.xaml.cs">
+      <DependentUpon>SplitScreenView.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModularContent.xaml.cs">
       <DependentUpon>ViewModularContent.xaml</DependentUpon>
     </Compile>
@@ -499,6 +503,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\CheckBoxStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\ComboxStyle.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -531,6 +539,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\RadioButtonStyle.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\SliderStyle.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -765,6 +777,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\SplitScreenView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModularContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 43 - 35
PDF Office/ViewModels/BOTA/BookmarkContentViewModel.cs

@@ -21,6 +21,7 @@ using System.Windows.Forms;
 using System.Windows.Input;
 using System.Windows.Markup;
 using System.Windows.Media;
+using static Dropbox.Api.Files.SearchMatchType;
 using static Dropbox.Api.TeamLog.AdminAlertSeverityEnum;
 using static System.Net.Mime.MediaTypeNames;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement;
@@ -84,7 +85,6 @@ namespace PDF_Office.ViewModels.BOTA
         public DelegateCommand<object> AddBookmarkCommand { get; set; }
 
         public DelegateCommand<object> ListViewItemMouseDownCommand { get; set; }
-        public DelegateCommand<object> RenameCommand { get; set; }
 
         public DelegateCommand<object> EditPageIndexCommand { get; set; }
 
@@ -97,19 +97,26 @@ namespace PDF_Office.ViewModels.BOTA
             region = regionManager;
             dialogs = dialogService;
 
-            //MouseClickCommand = new DelegateCommand<object>(MouseClickEvent);
-            //MouseEnterCommand = new DelegateCommand<object>(MouseEnterEvent);
+            Bookmarklist = new ObservableCollection<CPDFBookmark>();
+
             LostFocusCommand = new DelegateCommand<object>(LostFocusEvent);
-            //MouseLeaveCommand = new DelegateCommand<object>(MouseLeaveEvent);
-            //GotFocusCommand = new DelegateCommand<object>(GotFocusEvent);
+
             AddBookmarkCommand = new DelegateCommand<object>(AddBookmarkEvent);
             ListViewItemMouseDownCommand = new DelegateCommand<object>(ListViewItemMouseLeftButtonDownEvent);
-            RenameCommand = new DelegateCommand<object>(RenameEvent);
+
             DeleteCommand = new DelegateCommand<object>(DelegateEvent);
             EditPageIndexCommand = new DelegateCommand<object>(EditPageIndexEvent);
             KeyDownCommand = new DelegateCommand<object>(KeyDownEvent);
         }
 
+        private void Bookmarklist_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+        {
+        }
+
+        /// <summary>
+        /// 文本框按下Enter键
+        /// </summary>
+        /// <param name="obj"></param>
         private void KeyDownEvent(object obj)
         {
             if (obj is KeyEventArgs)
@@ -130,54 +137,53 @@ namespace PDF_Office.ViewModels.BOTA
             }
         }
 
+        /// <summary>
+        /// 重新定位
+        /// </summary>
+        /// <param name="obj"></param>
         private void EditPageIndexEvent(object obj)
         {
             CPDFBookmark bookmark = obj as CPDFBookmark;
             if (bookmark != null)
             {
-                //var list = PDFViewer.Document.GetBookmarkList().FindAll(q => q.PageIndex == bookmark.PageIndex && q.Title == bookmark.Title);
-                //ListBoxItem myListBoxItem = (ListBoxItem)(listView.ItemContainerGenerator.ContainerFromItem(list[0]));
-                //if (myListBoxItem.IsSelected == false)
-                //{
-                //    myListBoxItem.IsSelected = true;
-                //    myListBoxItem.Focus();
-                //}
-
-                DialogParameters value = new DialogParameters();
-                value.Add(ParameterNames.BookmarkInfo, "确定要将选定大纲的目标位置设置为当前位置吗?");
-                dialogs.ShowDialog(DialogNames.BookmarkInfoDialog, value, e =>
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("提示", "确定要将选定大纲的目标位置设置为当前位置吗?", "Cancel", "OK");
+                if (alertsMessage.result == ContentResult.Ok)
                 {
-                    if (e.Result == ButtonResult.OK)
+                    if (RemoveBookMark(bookmark))
                     {
-                        if (RemoveBookMark(bookmark))
-                        {
-                            bookmarklist.Remove(bookmark);
+                        bookmarklist.Remove(bookmark);
 
-                            CPDFBookmark cPDFBookmark = new CPDFBookmark();
-                            bookmark.Title = bookmark.Title;
-                            bookmark.Date = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
-                            bookmark.PageIndex = PDFViewer.CurrentIndex;
-
-                            if (PDFViewer.Document.AddBookmark(bookmark))
-                            {
-                                PDFViewer.UndoManager.CanSave = true;
+                        CPDFBookmark cPDFBookmark = new CPDFBookmark();
+                        bookmark.Title = bookmark.Title;
+                        bookmark.Date = DateTime.Now.ToString(@"yyyyMMddHHmmsszzz\'").Replace(':', '\'') + "\n";
+                        bookmark.PageIndex = PDFViewer.CurrentIndex;
 
-                                Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
-                            }
+                        if (PDFViewer.Document.AddBookmark(bookmark))
+                        {
+                            PDFViewer.UndoManager.CanSave = true;
+                            Bookmarklist.Add(bookmark);
+                            //Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
                         }
                     }
-                });
+                }
             }
         }
 
+        /// <summary>
+        /// 右键菜单-删除
+        /// </summary>
+        /// <param name="obj"></param>
         private void DelegateEvent(object obj)
         {
             CPDFBookmark bookmark = obj as CPDFBookmark;
             if (bookmark != null)
             {
                 if (RemoveBookMark(bookmark))
-                    bookmarklist.Remove(bookmark);
-                //ListBoxItem myListBoxItem = (ListBoxItem)(myListBox.ItemContainerGenerator.ContainerFromItem(myListBox.Items.CurrentItem));
+                {
+                    Bookmarklist.Remove(bookmark);
+                    Bookmarklist.CollectionChanged += Bookmarklist_CollectionChanged;
+                }
             }
         }
 
@@ -319,7 +325,8 @@ namespace PDF_Office.ViewModels.BOTA
                         {
                             PDFViewer.UndoManager.CanSave = true;
 
-                            Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
+                            Bookmarklist.Add(bookmark);
+                            // Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
                         }
                     }
                 }
@@ -335,6 +342,7 @@ namespace PDF_Office.ViewModels.BOTA
             }
 
             Bookmarklist = new ObservableCollection<CPDFBookmark>(PDFViewer.Document.GetBookmarkList().OrderBy(d => d.Title));
+            Bookmarklist.CollectionChanged += Bookmarklist_CollectionChanged;
             if (Bookmarklist.Count < 1)
             {
                 IsEmptyPanelVisibility = Visibility.Visible;

+ 42 - 34
PDF Office/ViewModels/BottomToolContentViewModel.cs

@@ -20,7 +20,6 @@ namespace PDF_Office.ViewModels
 {
     public class BottomToolContentViewModel : BindableBase, INavigationAware
     {
-
         public DelegateCommand Load { get; set; }
 
         public DelegateCommand FirstPageCommand { get; set; }
@@ -53,6 +52,7 @@ namespace PDF_Office.ViewModels
 
         public DelegateCommand<object> SelectionChangedCommand { get; set; }
 
+        public DelegateCommand<object> ShowViewModularCommand { get; set; }
         private bool isSingleView;
 
         public bool IsSingleView
@@ -151,18 +151,15 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
-
         public CPDFViewer PDFViewer { get; set; }
 
         private ViewContentViewModel viewContentViewModel { get; set; }
 
-
         private IRegionManager region;
 
         private IDialogService dialogs;
 
-        public BottomToolContentViewModel(IRegionManager regionManager,IDialogService dialogService)
+        public BottomToolContentViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
             region = regionManager;
             dialogs = dialogService;
@@ -171,13 +168,22 @@ namespace PDF_Office.ViewModels
             NextPageCommand = new DelegateCommand(GoNextPage, CanNextPageExcute).ObservesProperty(() => CurrentPage);
             FirstPageCommand = new DelegateCommand(GoFirstPage, CanPrePageExcute).ObservesProperty(() => CurrentPage);
             LastPageCommand = new DelegateCommand(GoLastPage, CanNextPageExcute).ObservesProperty(() => CurrentPage);
-            ZoomInCommand = new DelegateCommand(ZoomIn, CanZoomIn).ObservesProperty(()=>CurrentZoom);
-            ZoomOutCommand = new DelegateCommand(ZoomOut, CanZoomOut).ObservesProperty(()=>CurrentZoom);
+            ZoomInCommand = new DelegateCommand(ZoomIn, CanZoomIn).ObservesProperty(() => CurrentZoom);
+            ZoomOutCommand = new DelegateCommand(ZoomOut, CanZoomOut).ObservesProperty(() => CurrentZoom);
             SetViewModeCommand = new DelegateCommand(SetModeView);
             PageTextKeyDownCommand = new DelegateCommand<object>(PageNumText_KeyDown);
             PageTextPreviewKeyDownCommand = new DelegateCommand<object>(PageNumText_PreviewKeyDown);
             SelectionChangedCommand = new DelegateCommand<object>(SelectionChangedEvent);
             OpenFullCommand = new DelegateCommand(OpenFullWindow);
+            ShowViewModularCommand = new DelegateCommand<object>(ShowViewModularEvent);
+        }
+
+        private void ShowViewModularEvent(object obj)
+        {
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            region.RequestNavigate(RegionNames.PropertyRegionName, "ViewModularContent", param);
+            viewContentViewModel.IsPropertyOpen = true;
         }
 
         /// <summary>
@@ -187,14 +193,15 @@ namespace PDF_Office.ViewModels
         {
             DialogParameters parameters = new DialogParameters();
             //因为全屏模式可能需要设置特定的页面模式,所以只传文件路径,新建一个PDFview对象
-            parameters.Add(ParameterNames.FilePath,PDFViewer.Document.FilePath);
-            parameters.Add(ParameterNames.PassWord,PDFViewer.Tag==null?"":PDFViewer.Tag.ToString());
-            dialogs.ShowDialog(DialogNames.FullScreenDialog,parameters,e=> { 
-                if(e.Result==ButtonResult.Cancel)
+            parameters.Add(ParameterNames.FilePath, PDFViewer.Document.FilePath);
+            parameters.Add(ParameterNames.PassWord, PDFViewer.Tag == null ? "" : PDFViewer.Tag.ToString());
+            dialogs.ShowDialog(DialogNames.FullScreenDialog, parameters, e =>
+            {
+                if (e.Result == ButtonResult.Cancel)
                 {
                     //TODO:弹窗提示打开全屏模式失败
                     AlertsMessage alertsMessage = new AlertsMessage();
-                    alertsMessage.ShowDialog("","Error","OK");
+                    alertsMessage.ShowDialog("", "Error", "OK");
                     return;
                 }
             });
@@ -203,21 +210,24 @@ namespace PDF_Office.ViewModels
         private void SelectionChangedEvent(object e)
         {
             var args = e as SelectionChangedEventArgs;
-            if(args!=null)
+            if (args != null)
             {
-                if(SelectedIndex<=2)
+                if (SelectedIndex <= 2)
                 {
                     switch (SelectedIndex)
                     {
                         case 0:
                             PDFViewer.ChangeFitMode(FitMode.FitSize);
                             break;
+
                         case 1:
                             PDFViewer.ChangeFitMode(FitMode.FitWidth);
                             break;
+
                         case 2:
                             PDFViewer.ChangeFitMode(FitMode.FitHeight);
                             break;
+
                         default:
                             break;
                     }
@@ -232,14 +242,13 @@ namespace PDF_Office.ViewModels
                         }
                     }
                 }
-    
             }
         }
 
         private void PageNumText_PreviewKeyDown(object e)
         {
             var args = e as KeyEventArgs;
-            if(args != null)
+            if (args != null)
             {
                 //显示文本框输入内容
                 List<Key> NumberKeys = new List<Key>() { Key.D0,Key.D1,Key.D2,Key.D3,Key.D4,Key.D5,Key.D6,Key.D7,Key.D8,Key.D9,Key.NumPad0,Key.NumPad1,Key.NumPad2,
@@ -302,13 +311,12 @@ namespace PDF_Office.ViewModels
             return false;
         }
 
-
         private void GoNextPage()
         {
             if (PDFViewer != null)
             {
                 PDFViewer.GoToPage(PDFViewer.CurrentIndex + 1);
-                if(((int)PDFViewer.Mode%2)==0)
+                if (((int)PDFViewer.Mode % 2) == 0)
                 {
                     PDFViewer.GoToPage(PDFViewer.CurrentIndex + 2);
                 }
@@ -345,7 +353,7 @@ namespace PDF_Office.ViewModels
 
         private void ZoomIn()
         {
-            var zoom = PDFViewer.ZoomFactor*100;
+            var zoom = PDFViewer.ZoomFactor * 100;
             if (zoom >= 1 && zoom <= 100)
             {
                 PDFViewer.Zoom((zoom + 5) / 100.0);
@@ -362,10 +370,10 @@ namespace PDF_Office.ViewModels
 
         private void ZoomOut()
         {
-            var zoom = PDFViewer.ZoomFactor*100;
+            var zoom = PDFViewer.ZoomFactor * 100;
             if (zoom >= 1 && zoom <= 100)
             {
-                PDFViewer.Zoom((zoom - 5)/100.0);
+                PDFViewer.Zoom((zoom - 5) / 100.0);
             }
             else if (zoom <= 500)
             {
@@ -381,7 +389,7 @@ namespace PDF_Office.ViewModels
         {
             if (PDFViewer != null)
             {
-                if (PDFViewer.ZoomFactor*100 >=1000)
+                if (PDFViewer.ZoomFactor * 100 >= 1000)
                     return false;
                 else
                     return true;
@@ -393,7 +401,7 @@ namespace PDF_Office.ViewModels
         {
             if (PDFViewer != null)
             {
-                if (PDFViewer.ZoomFactor*100 <=1)
+                if (PDFViewer.ZoomFactor * 100 <= 1)
                     return false;
                 else
                     return true;
@@ -412,9 +420,9 @@ namespace PDF_Office.ViewModels
             {
                 GetModeView((ViewMode)e.Value);
             }
-            if(e.Key=="Zoom")
+            if (e.Key == "Zoom")
             {
-                CurrentZoom = (double)e.Value*100;
+                CurrentZoom = (double)e.Value * 100;
                 SelectedIndex = -1;
             }
         }
@@ -423,11 +431,10 @@ namespace PDF_Office.ViewModels
         {
             if ((int)mode % 2 == 0)
             {
-                if(!IsContinue)
+                if (!IsContinue)
                 {
                     IsContinue = true;
                 }
-               
             }
             else
             {
@@ -439,21 +446,21 @@ namespace PDF_Office.ViewModels
 
             if ((int)mode <= 2)
             {
-                if(!isSingleView)
+                if (!isSingleView)
                 {
                     IsSingleView = true;
                 }
             }
             else if ((int)mode <= 4)
             {
-                if(!isDoubleView)
+                if (!isDoubleView)
                 {
                     IsDoubleView = true;
                 }
             }
             else
             {
-                if(!isBookMode)
+                if (!isBookMode)
                 {
                     IsBookMode = true;
                 }
@@ -498,6 +505,7 @@ namespace PDF_Office.ViewModels
         }
 
         #region Navigation
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             var viewContentViewModel = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as ViewContentViewModel;
@@ -507,7 +515,7 @@ namespace PDF_Office.ViewModels
             }
 
             var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
-            if(pdfview!=null)
+            if (pdfview != null)
             {
                 //获取页面设置等信息
                 PDFViewer = pdfview;
@@ -526,8 +534,8 @@ namespace PDF_Office.ViewModels
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
-
         }
-        #endregion
+
+        #endregion Navigation
     }
-}
+}

+ 28 - 0
PDF Office/ViewModels/PropertyPanel/SplitScreenViewViewModel.cs

@@ -0,0 +1,28 @@
+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
+{
+    internal class SplitScreenViewViewModel : BindableBase, INavigationAware
+    {
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 43 - 2
PDF Office/ViewModels/PropertyPanel/ViewModularContentViewModel.cs

@@ -1,5 +1,9 @@
-using Prism.Mvvm;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -8,8 +12,40 @@ using System.Threading.Tasks;
 
 namespace PDF_Office.ViewModels.PropertyPanel
 {
-    internal class ViewModularContentViewModel : BindableBase, INavigationAware
+    public class ViewModularContentViewModel : BindableBase, INavigationAware
     {
+        public IRegionManager region;
+
+        public IDialogService dialogs;
+        public CPDFViewer PDFViewer { get; set; }
+        public string SplitScreenViewRegionName { get; set; }
+
+        public DelegateCommand<object> VerticalSplitScreenCommand { get; set; }
+
+        public ViewModularContentViewModel(IRegionManager regionManager, IDialogService dialogService)
+        {
+            region = regionManager;
+            dialogs = dialogService;
+            SplitScreenViewRegionName = RegionNames.SplitScreenViewRegionName;
+            VerticalSplitScreenCommand = new DelegateCommand<object>(VerticalSplitScreenEvent);
+
+            //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(RegionNames.SplitScreenViewRegionName, "SplitScreenView", parameters);
+            //}
+            //));
+        }
+
+        private void VerticalSplitScreenEvent(object obj)
+        {
+            NavigationParameters param = new NavigationParameters();
+            param.Add(ParameterNames.PDFViewer, PDFViewer);
+            region.RequestNavigate(RegionNames.SplitScreenViewRegionName, "SplitScreenView", param);
+        }
+
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -21,6 +57,11 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            var pdfview = navigationContext.Parameters[ParameterNames.PDFViewer] as CPDFViewer;
+            if (pdfview != null)
+            {
+                PDFViewer = pdfview;
+            }
         }
     }
 }

+ 40 - 31
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -22,10 +22,10 @@ using PDF_Office.ViewModels.Tools;
 
 namespace PDF_Office.ViewModels
 {
-
     public class ViewContentViewModel : BindableBase, INavigationAware
     {
         #region 属性、变量
+
         private CPDFViewer PDFViewer { get; set; }
 
         private MainContentViewModel mainViewModel { get; set; }
@@ -58,8 +58,8 @@ namespace PDF_Office.ViewModels
 
         public Action PageEditRedo { get; set; }
 
-
         private int gridToolRow = 1;
+
         /// <summary>
         /// 控制ToolContent的Row
         /// </summary>
@@ -73,6 +73,7 @@ namespace PDF_Office.ViewModels
         }
 
         private int gridToolRowSpan = 3;
+
         /// <summary>
         /// 控制ToolContent的RowSpan
         /// </summary>
@@ -86,6 +87,7 @@ namespace PDF_Office.ViewModels
         }
 
         private Visibility toolContentVisible = Visibility.Collapsed;
+
         /// <summary>
         /// 控制Content的显示 用于显示水印、贝茨码、密文等功能模块
         /// 留意:显示前需要先注入内容、设置好行和跨行数
@@ -100,6 +102,7 @@ namespace PDF_Office.ViewModels
         }
 
         private Visibility isLoading = Visibility.Collapsed;
+
         /// <summary>
         /// 是否正在加载中
         /// </summary>
@@ -113,6 +116,7 @@ namespace PDF_Office.ViewModels
         }
 
         private Visibility toolsbarContentVisible = Visibility.Collapsed;
+
         /// <summary>
         /// 控制ToolsBarContent的显示
         /// 留意:显示前需要先注入内容、设置好行和跨行数
@@ -127,6 +131,7 @@ namespace PDF_Office.ViewModels
         }
 
         private bool isPorpertyOpen = false;
+
         /// <summary>
         /// 属性栏是否展开
         /// </summary>
@@ -139,8 +144,8 @@ namespace PDF_Office.ViewModels
             }
         }
 
-
         private bool canSave;
+
         /// <summary>
         /// 是否可以保存
         /// </summary>
@@ -176,6 +181,7 @@ namespace PDF_Office.ViewModels
         }
 
         private GridLength botaWidth = new GridLength(48);
+
         /// <summary>
         /// BOTA栏的宽度
         /// </summary>
@@ -185,7 +191,7 @@ namespace PDF_Office.ViewModels
             set
             {
                 SetProperty(ref botaWidth, value);
-                if(botaWidth.Value<=48)
+                if (botaWidth.Value <= 48)
                 {
                     OpenBOTA = false;
                 }
@@ -193,22 +199,23 @@ namespace PDF_Office.ViewModels
         }
 
         private bool openBOTA = false;
+
         /// <summary>
         /// 是否展开BOTA
         /// </summary>
         public bool OpenBOTA
         {
             get { return openBOTA; }
-            set { 
-                openBOTA = value; 
-                if(openBOTA)
+            set
+            {
+                openBOTA = value;
+                if (openBOTA)
                 {
                     BOTAWidth = new GridLength(256);
                 }
             }
         }
 
-
         private Dictionary<string, string> regionNameByTabItem;
 
         private Dictionary<string, string> barContentByTabItem;
@@ -226,10 +233,11 @@ namespace PDF_Office.ViewModels
         /// 鼠标滚轮缩放的缩放值
         /// </summary>
         private double[] zoomLevel = { 1.00f, 10, 25, 50, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
-        #endregion
 
+        #endregion 属性、变量
 
         #region 命令
+
         public DelegateCommand LoadFile { get; set; }
 
         public DelegateCommand Load { get; set; }
@@ -243,7 +251,8 @@ namespace PDF_Office.ViewModels
         public DelegateCommand UndoCommand { get; set; }
 
         public DelegateCommand RedoCommand { get; set; }
-        #endregion
+
+        #endregion 命令
 
         public ViewContentViewModel(IRegionManager regionManager, IDialogService dialogService)
         {
@@ -252,7 +261,7 @@ namespace PDF_Office.ViewModels
 
             LoadFile = new DelegateCommand(loadFile);
             Load = new DelegateCommand(LoadControl);
-            SaveFile = new DelegateCommand(()=> { saveFile(); });
+            SaveFile = new DelegateCommand(() => { saveFile(); });
             SaveAsFile = new DelegateCommand(() => { saveAsFile(); });
             UndoCommand = new DelegateCommand(Undo);
             RedoCommand = new DelegateCommand(Redo);
@@ -307,11 +316,11 @@ namespace PDF_Office.ViewModels
             {
                 CanSave = PDFViewer.UndoManager.CanSave;
             }
-            if(e.PropertyName == "CanUndo")
+            if (e.PropertyName == "CanUndo")
             {
                 CanUndo = PDFViewer.UndoManager.CanUndo;
             }
-            if(e.PropertyName =="CanRedo")
+            if (e.PropertyName == "CanRedo")
             {
                 CanRedo = PDFViewer.UndoManager.CanRedo;
             }
@@ -330,7 +339,7 @@ namespace PDF_Office.ViewModels
                 currentBar = item.Name;
                 if (previousBar != currentBar)
                 {
-                    if(currentBar== "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
+                    if (currentBar == "TabItemPageEdit")//如果是页面编辑则进入页面编辑模式
                     {
                         EnterToolMode(barContentByTabItem[currentBar]);
                         isInPageEdit = true;
@@ -346,6 +355,7 @@ namespace PDF_Office.ViewModels
         }
 
         #region PDFViewer鼠标滚轮缩放事件
+
         public void PdfViewer_MouseWheelZoomHandler(object sender, bool e)
         {
             double newZoom = CheckZoomLevel(PDFViewer.ZoomFactor + (e ? 0.01 : -0.01), e);
@@ -380,9 +390,11 @@ namespace PDF_Office.ViewModels
             }
             return standardZoom / 100;
         }
-        #endregion
+
+        #endregion PDFViewer鼠标滚轮缩放事件
 
         #region Navigate
+
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             if (isOpenFile)
@@ -400,7 +412,6 @@ namespace PDF_Office.ViewModels
                 loadFile();
             }
 
-
             isOpenFile = true;
         }
 
@@ -411,14 +422,15 @@ namespace PDF_Office.ViewModels
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
-
         }
-        #endregion
+
+        #endregion Navigate
 
         #region 方法
+
         private void Undo()
         {
-            if(isInPageEdit)
+            if (isInPageEdit)
             {
                 //执行页面编辑的Undo
                 PageEditUndo?.Invoke();
@@ -431,7 +443,7 @@ namespace PDF_Office.ViewModels
 
         private void Redo()
         {
-            if(isInPageEdit)
+            if (isInPageEdit)
             {
                 //执行页面编辑的Redo
                 PageEditRedo?.Invoke();
@@ -450,7 +462,7 @@ namespace PDF_Office.ViewModels
                 NavigationParameters parameters = new NavigationParameters();
                 parameters.Add(ParameterNames.PDFViewer, PDFViewer);
                 parameters.Add(ParameterNames.ViewContentViewModel, this);
-                region.RequestNavigate(BOTARegionName, "BOTAContent",parameters);
+                region.RequestNavigate(BOTARegionName, "BOTAContent", parameters);
                 region.RequestNavigate(BottomToolRegionName, "BottomToolContent", parameters);
 
                 //TODO 根据上一次关闭记录的菜单,选中TabItem
@@ -469,7 +481,6 @@ namespace PDF_Office.ViewModels
                 region.RequestNavigate(PropertyRegionName, Content, parameters);
             }
          ));
-
         }
 
         /// <summary>
@@ -672,10 +683,10 @@ namespace PDF_Office.ViewModels
         /// 显示前添加内容到Region
         /// </summary>
         /// <param name="isPageEdit"></param>
-        private void ShowContent(string currentBar,bool isToolMode=false)
+        private void ShowContent(string currentBar, bool isToolMode = false)
         {
             //显示页面编辑或其他工具
-            if (currentBar == "TabItemPageEdit"||isToolMode)
+            if (currentBar == "TabItemPageEdit" || isToolMode)
             {
                 if (currentBar == "TabItemPageEdit")//进入页面编辑
                 {
@@ -718,7 +729,7 @@ namespace PDF_Office.ViewModels
 
         /// <summary>
         /// 进入工具编辑(如页面编辑、水印、密文等)模式
-        /// </summary> 
+        /// </summary>
         /// <param name="targetToolMode">要导航过去的控件名称</param>
         /// <param name="valuePairs">导航需要传送的参数,为空时,默认传送PDFView和ViewContentViewModel</param>
         private async void EnterToolMode(string targetToolMode, NavigationParameters valuePairs = null)
@@ -736,7 +747,7 @@ namespace PDF_Office.ViewModels
                 param = valuePairs;
             }
             region.RequestNavigate(ToolContentRegionName, targetToolMode, param);
-            ShowContent(currentBar,true);
+            ShowContent(currentBar, true);
 
             IsLoading = Visibility.Collapsed;
         }
@@ -757,9 +768,7 @@ namespace PDF_Office.ViewModels
         {
             ToolContentVisible = Visibility.Collapsed;
         }
-        #endregion
-    }
-}
-
-
 
+        #endregion 方法
+    }
+}

+ 35 - 20
PDF Office/Views/BOTA/BookmarkContent.xaml

@@ -69,6 +69,23 @@
                     </Grid>
                 </StackPanel>
             </DataTemplate>
+            <ContextMenu
+                x:Key="ContextMenu"
+                DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Self}}"
+                FontSize="14">
+                <MenuItem
+                    Click="MenuItemRename_Click"
+                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
+                    Header="重命名" />
+                <MenuItem
+                    Command="{Binding DataContext.EditPageIndexCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
+                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
+                    Header="更改目标位置" />
+                <MenuItem
+                    Click="MenuItemDeleteCommand_Click"
+                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.DataContext}"
+                    Header="删除" />
+            </ContextMenu>
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid Background="#F2F2F2">
@@ -103,7 +120,7 @@
                 BorderThickness="0"
                 ItemTemplate="{StaticResource myDataTemplate}"
                 ItemsSource="{Binding Bookmarklist}"
-                PreviewMouseLeftButtonDown="BookMarkListView_PreviewMouseLeftButtonDown"
+                PreviewMouseDown="BookMarkListView_PreviewMouseDown"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 VirtualizingPanel.CacheLength="1"
                 VirtualizingPanel.CacheLengthUnit="Page"
@@ -119,27 +136,25 @@
                     <Style BasedOn="{StaticResource ListViewItemGraySelectStyle}" TargetType="ListViewItem">
                         <EventSetter Event="PreviewMouseDown" Handler="ListViewItem_MouseLeftButtonDown" />
                         <EventSetter Event="LostFocus" Handler="ListViewItem_LostFocus" />
-                        <!--<EventSetter Event="PreviewMouseMove" Handler="ListViewItem_PreviewMouseMove" />
-                        <EventSetter Event="MouseLeave" Handler="ListViewItem_MouseLeave" />-->
-                        <!--<EventSetter Event="Unselected" Handler="ListViewItem_Unselected" />-->
+                        <Setter Property="ContextMenu" Value="{StaticResource ContextMenu}" />
                     </Style>
                 </ListView.ItemContainerStyle>
-                <ListView.ContextMenu>
-                    <ContextMenu Width="200">
-                        <MenuItem
-                            Click="MenuItemRename_Click"
-                            CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
-                            Header="重命名" />
-                        <MenuItem
-                            Command="{Binding EditPageIndexCommand}"
-                            CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
-                            Header="更改目标位置" />
-                        <MenuItem
-                            Command="{Binding DeleteCommand}"
-                            CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
-                            Header="删除" />
-                    </ContextMenu>
-                </ListView.ContextMenu>
+                <!--<ListView.ContextMenu>
+                <ContextMenu Width="200" Name="ContextMenu">
+                <MenuItem
+                Click="MenuItemRename_Click"
+                CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
+                Header="重命名" />
+                <MenuItem
+                Command="{Binding EditPageIndexCommand}"
+                CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
+                Header="更改目标位置" />
+                <MenuItem
+                Command="{Binding DeleteCommand}"
+                CommandParameter="{Binding PlacementTarget.SelectedItem, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
+                Header="删除" />
+                </ContextMenu>
+                </ListView.ContextMenu>-->
             </ListView>
         </Grid>
         <StackPanel

+ 62 - 51
PDF Office/Views/BOTA/BookmarkContent.xaml.cs

@@ -70,13 +70,6 @@ namespace PDF_Office.Views.BOTA
                     viewModel.ListViewItemMouseDownCommand.Execute(sender);
                 }
             }
-            else if (e.RightButton == MouseButtonState.Pressed)
-            {
-                if (e.ClickCount == 1)
-                    viewModel.ListViewItemMouseDownCommand.Execute(sender);
-                listBoxItem.IsSelected = true;
-                listBoxItem.Focus();
-            }
         }
 
         private void SetSelectedStatus(ListBoxItem listBoxItem, TextBox textBox, TextBlock textBlock)
@@ -110,50 +103,6 @@ namespace PDF_Office.Views.BOTA
             }
         }
 
-        private void BookMarkListView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
-        {
-            var pos = e.GetPosition(BookMarkListView);
-
-            var result = VisualTreeHelper.HitTest(BookMarkListView, pos);
-            if (result != null)
-            {
-                //获取当前鼠标指针下的容器
-                var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (listBoxItem == null)
-                {
-                    if (BookMarkListView.SelectedItem != null)
-                    {
-                        ListBoxItem item = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(BookMarkListView.SelectedItem));
-                        item.IsSelected = false;
-                        TextBlock box = CommonHelper.FindVisualChild<TextBlock>(item);
-                        box.Visibility = Visibility.Visible;
-                        BookMarkListView.SelectedItems.Clear();
-                    }
-                    if (histotyListBoxItem != null)
-                    {
-                        var pos1 = e.GetPosition(histotyListBoxItem);
-                        var result1 = VisualTreeHelper.HitTest(BookMarkListView, pos1);
-                        if (result1 == null)
-                        {
-                            histotyListBoxItem.IsSelected = false;
-                            TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
-                            textBlock.Visibility = Visibility.Visible;
-                            textBlock.Focusable = true;
-                        }
-                    }
-                }
-                else
-                {
-                    listBoxItem.Focus();
-                }
-            }
-            BookMarkListView.Focus();
-        }
-
-        private void MenuItem_Click(object sender, RoutedEventArgs e)
-        {
-        }
-
         private void MenuItemRename_Click(object sender, RoutedEventArgs e)
         {
             if (sender is MenuItem)
@@ -175,5 +124,67 @@ namespace PDF_Office.Views.BOTA
         private void ListViewItem_KeyDown(object sender, KeyEventArgs e)
         {
         }
+
+        private void BookMarkListView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if (e.LeftButton == MouseButtonState.Pressed)
+            {
+                var pos = e.GetPosition(BookMarkListView);
+
+                var result = VisualTreeHelper.HitTest(BookMarkListView, pos);
+                if (result != null)
+                {
+                    //获取当前鼠标指针下的容器
+                    var listBoxItem = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
+                    if (listBoxItem == null)
+                    {
+                        if (BookMarkListView.SelectedItem != null)
+                        {
+                            ListBoxItem item = (ListBoxItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(BookMarkListView.SelectedItem));
+                            item.IsSelected = false;
+                            TextBlock box = CommonHelper.FindVisualChild<TextBlock>(item);
+                            box.Visibility = Visibility.Visible;
+                            BookMarkListView.SelectedItems.Clear();
+                        }
+                        if (histotyListBoxItem != null)
+                        {
+                            var pos1 = e.GetPosition(histotyListBoxItem);
+                            var result1 = VisualTreeHelper.HitTest(BookMarkListView, pos1);
+                            if (result1 == null)
+                            {
+                                histotyListBoxItem.IsSelected = false;
+                                TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
+                                textBlock.Visibility = Visibility.Visible;
+                                textBlock.Focusable = true;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        listBoxItem.Focus();
+                    }
+                }
+                BookMarkListView.Focus();
+            }
+        }
+
+        private void MenuItemDeleteCommand_Click(object sender, RoutedEventArgs e)
+        {
+            List<int> pagelist = new List<int>();
+            for (int i = 0; i < BookMarkListView.SelectedItems.Count; i++)
+            {
+                CPDFBookmark item = BookMarkListView.SelectedItems[i] as CPDFBookmark;
+                pagelist.Add(BookMarkListView.Items.IndexOf(item));
+            }
+            pagelist.Sort();
+            for (int i = 0; i < pagelist.Count; i++)
+            {
+                CPDFBookmark data = BookMarkListView.Items[pagelist[pagelist.Count - i - 1]] as CPDFBookmark;
+                if (data != null)
+                {
+                    viewModel.DeleteCommand.Execute(data);
+                }
+            }
+        }
     }
 }

+ 21 - 0
PDF Office/Views/PropertyPanel/SplitScreenView.xaml

@@ -0,0 +1,21 @@
+<UserControl
+    x:Class="PDF_Office.Views.PropertyPanel.SplitScreenView"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:AnnotPanel="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
+    xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
+    xmlns:PropertyPanel="clr-namespace:PDF_Office.ViewModels.PropertyPanel"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    Width="256"
+    d:DataContext="{d:DesignInstance Type=PropertyPanel:SplitScreenViewViewModel}"
+    d:DesignHeight="200"
+    d:DesignWidth="256"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    mc:Ignorable="d">
+    <Grid>
+        <TextBlock FontSize="20" Text="分屏显示" />
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/SplitScreenView.xaml.cs

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

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

@@ -197,7 +197,7 @@
         <Grid>
             <Grid.RowDefinitions>
                 <RowDefinition Height="80" />
-                <RowDefinition />
+                <RowDefinition MinHeight="100" />
             </Grid.RowDefinitions>
 
             <StackPanel Grid.Row="0" Orientation="Horizontal">
@@ -222,7 +222,8 @@
                     Name="RbtnVerticalSplit"
                     Margin="8,0,8,0"
                     GroupName="SplitMode"
-                    Style="{StaticResource PageViewRadioBtn}">
+                    Style="{StaticResource PageViewRadioBtn}"
+                    Command="{Binding VerticalSplitScreenCommand}">
                     <StackPanel Margin="0,0,3,0">
                         <Path
                             Margin="0,0,0,8"

+ 3 - 5
PDF Office/Views/ViewContent.xaml

@@ -153,10 +153,9 @@
             </i:Interaction.Triggers>
         </TabControl>
 
-
         <!--<ScrollViewer Name="PropScrollView" Grid.Row="2" SizeChanged="PropPanel_SizeChanged" VerticalScrollBarVisibility="Auto" Focusable="False">
-            <Grid x:Name="PropPanel">
-            </Grid>
+        <Grid x:Name="PropPanel">
+        </Grid>
         </ScrollViewer>-->
 
         <Grid Name="DocumentView" Grid.Row="2">
@@ -202,7 +201,6 @@
             <ScrollViewer Grid.Column="4" VerticalScrollBarVisibility="Auto">
                 <ContentControl prism:RegionManager.RegionName="{Binding PropertyRegionName}" />
             </ScrollViewer>
-
         </Grid>
 
         <ContentControl Grid.Row="3" prism:RegionManager.RegionName="{Binding BottomToolRegionName}" />
@@ -223,4 +221,4 @@
             prism:RegionManager.RegionName="{Binding ToolsBarContentRegionName}"
             Visibility="{Binding ToolsBarContentVisible}" />
     </Grid>
-</UserControl>
+</UserControl>