Kaynağa Gözat

综合-书签、注释

OYXH\oyxh 1 yıl önce
ebeveyn
işleme
84d519dc00

+ 20 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -1040,6 +1040,11 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 HighLightOpacity = (double)e[argsType];
                             }
+                            //创建注释后,修改注释属性,可用于下次创建的注释
+                            if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
+                            {
+                                PDFViewer.SetToolParam(propertyPanel.annot);
+                            }
                             break;
 
                         case AnnotArgsType.AnnotUnderline:
@@ -1051,6 +1056,11 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 underLineOpacity = (double)e[argsType];
                             }
+                            //创建注释后,修改注释属性,可用于下次创建的注释
+                            if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
+                            {
+                                PDFViewer.SetToolParam(propertyPanel.annot);
+                            }
                             break;
 
                         case AnnotArgsType.AnnotSquiggly:
@@ -1062,6 +1072,11 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 SquigglyOpacity = (double)e[argsType];
                             }
+                            //创建注释后,修改注释属性,可用于下次创建的注释
+                            if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
+                            {
+                                PDFViewer.SetToolParam(propertyPanel.annot);
+                            }
                             break;
 
                         case AnnotArgsType.AnnotStrikeout:
@@ -1073,6 +1088,11 @@ namespace PDF_Office.ViewModels.Tools
                             {
                                 StrikeoutOpacity = (double)e[argsType];
                             }
+                            //创建注释后,修改注释属性,可用于下次创建的注释
+                            if (propertyPanel != null && propertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
+                            {
+                                PDFViewer.SetToolParam(propertyPanel.annot);
+                            }
                             break;
 
                         case AnnotArgsType.AnnotFreehand:

+ 1 - 0
PDF Office/Views/BOTA/BookmarkContent.xaml

@@ -81,6 +81,7 @@
                             Padding="5"
                             Background="Transparent"
                             FontSize="14"
+                            TextWrapping="Wrap"
                             Text="{Binding Title}"
                             Visibility="Visible" />
                     </Grid>

+ 333 - 333
PDF Office/Views/BOTA/BookmarkContent.xaml.cs

@@ -21,372 +21,372 @@ using static Dropbox.Api.Sharing.ListFileMembersIndividualResult;
 
 namespace PDF_Office.Views.BOTA
 {
-/// <summary>
+    /// <summary>
     /// BookmarkContent.xaml 的交互逻辑
-/// </summary>
-public partial class BookmarkContent : UserControl
-{
-private BookmarkContentViewModel viewModel = null;
+    /// </summary>
+    public partial class BookmarkContent : UserControl
+    {
+        private BookmarkContentViewModel viewModel = null;
 
-/// <summary>
-    /// 上一个ListBoxItem,为选中状态做准备
-/// </summary>
-private ListBoxItem histotyListBoxItem = null;
+        /// <summary>
+        /// 上一个ListBoxItem,为选中状态做准备
+        /// </summary>
+        private ListBoxItem histotyListBoxItem = null;
 
-private bool isAdd = false;
+        private bool isAdd = false;
 
-public BookmarkContent()
-{
-InitializeComponent();
-viewModel = this.DataContext as BookmarkContentViewModel;
-KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
-KeyEventsHelper.KeyDown += ShortCut_KeyDown;
-}
+        public BookmarkContent()
+        {
+            InitializeComponent();
+            viewModel = this.DataContext as BookmarkContentViewModel;
+            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+            KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+        }
 
-private void ShortCut_KeyDown(object sender, KeyEventArgs e)
-{
-if (KeyEventsHelper.IsSingleKey(Key.Escape))
-{
-if (BookMarkListView.SelectedItems == null)
-{
-return;
-}
+        private void ShortCut_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (KeyEventsHelper.IsSingleKey(Key.Escape))
+            {
+                if (BookMarkListView.SelectedItems == null)
+                {
+                    return;
+                }
 
-BookMarkListView.SelectedItems.Clear();
-}
-}
+                BookMarkListView.SelectedItems.Clear();
+            }
+        }
 
-/// <summary>
-    ///ListViewItem,鼠标左键点击
-/// </summary>
-/// <param name="sender"></param>
-/// <param name="e"></param>
-private void ListViewItem_MouseButtonDown(object sender, MouseButtonEventArgs e)
-{
-object[] objects = new object[] { sender, e };
-TextBlock textBlock = null;
-ListViewItem listBoxItem = (sender as ListViewItem);
-if (e.LeftButton == MouseButtonState.Pressed)
-{
-if (e.ClickCount >= 2)
-    {
-    histotyListBoxItem = listBoxItem;
-    if (e.OriginalSource is TextBlock)
-    {
-    textBlock = (TextBlock)e.OriginalSource;
+        /// <summary>
+        ///ListViewItem,鼠标左键点击
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ListViewItem_MouseButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            object[] objects = new object[] { sender, e };
+            TextBlock textBlock = null;
+            ListViewItem listBoxItem = (sender as ListViewItem);
+            if (e.LeftButton == MouseButtonState.Pressed)
+            {
+                if (e.ClickCount >= 2)
+                {
+                    histotyListBoxItem = listBoxItem;
+                    if (e.OriginalSource is TextBlock)
+                    {
+                        textBlock = (TextBlock)e.OriginalSource;
 
-    if (textBlock != null)
-    {
-    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
+                        if (textBlock != null)
+                        {
+                            TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
 
-        SetSelectedStatus(listBoxItem, textBox, textBlock);
-        }
-        }
-        }
-        else if (e.ClickCount == 1)
-        {
-        if (histotyListBoxItem != listBoxItem)
-        {
-        if (histotyListBoxItem != null)
-        {
-        histotyListBoxItem.IsSelected = false;
-        textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
-            textBlock.Visibility = Visibility.Visible;
-            textBlock.Focusable = true;
-            }
-            }
+                            SetSelectedStatus(listBoxItem, textBox, textBlock);
+                        }
+                    }
+                }
+                else if (e.ClickCount == 1)
+                {
+                    if (histotyListBoxItem != listBoxItem)
+                    {
+                        if (histotyListBoxItem != null)
+                        {
+                            histotyListBoxItem.IsSelected = false;
+                            textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
+                            textBlock.Visibility = Visibility.Visible;
+                            textBlock.Focusable = true;
+                        }
+                    }
 
-            viewModel.ListViewItemMouseDownCommand.Execute(sender);
-            }
+                    viewModel.ListViewItemMouseDownCommand.Execute(sender);
+                }
             }
             else if (e.RightButton == MouseButtonState.Pressed)
             {
-            ContextMenu contextMenu = listBoxItem.ContextMenu;
-            if (contextMenu.Items.Count == 3)
-            {
-            MenuItem rename = contextMenu.Items[0] as MenuItem;
-            MenuItem editPageIndex = contextMenu.Items[1] as MenuItem;
-            MenuItem del = contextMenu.Items[2] as MenuItem;
-            if (isSelects)
-            {
-            rename.IsEnabled = false;
-            editPageIndex.IsEnabled = false;
-            isSelects = false;
+                ContextMenu contextMenu = listBoxItem.ContextMenu;
+                if (contextMenu.Items.Count == 3)
+                {
+                    MenuItem rename = contextMenu.Items[0] as MenuItem;
+                    MenuItem editPageIndex = contextMenu.Items[1] as MenuItem;
+                    MenuItem del = contextMenu.Items[2] as MenuItem;
+                    if (isSelects)
+                    {
+                        rename.IsEnabled = false;
+                        editPageIndex.IsEnabled = false;
+                        isSelects = false;
+                    }
+                    else
+                    {
+                        CPDFBookmark bookmark = (CPDFBookmark)listBoxItem.DataContext;
+                        if (viewModel.PDFViewer.CurrentIndex == bookmark.PageIndex)
+                        {
+                            editPageIndex.IsEnabled = false;
+                            return;
+                        }
+                        rename.IsEnabled = true;
+                        editPageIndex.IsEnabled = true;
+                        editPageIndex.CommandParameter = listBoxItem.DataContext;
+                        editPageIndex.Command = viewModel.EditPageIndexCommand;
+                    }
+                }
             }
-            else
-            {
-            CPDFBookmark bookmark = (CPDFBookmark)listBoxItem.DataContext;
-            if (viewModel.PDFViewer.CurrentIndex == bookmark.PageIndex)
+        }
+
+        private bool isSelects = false;
+
+        private void BookMarkListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            var a1 = (sender as ListView).SelectedItems.Count;
+            if (a1 > 1)
             {
-            editPageIndex.IsEnabled = false;
-            return;
-            }
-            rename.IsEnabled = true;
-            editPageIndex.IsEnabled = true;
-            editPageIndex.CommandParameter = listBoxItem.DataContext;
-            editPageIndex.Command = viewModel.EditPageIndexCommand;
-            }
-            }
-            }
+                isSelects = true;
             }
+        }
 
-            private bool isSelects = false;
+        /// <summary>
+        /// ListViewItem双击时选中状态
+        /// </summary>
+        /// <param name="listBoxItem"></param>
+        /// <param name="textBox"></param>
+        /// <param name="textBlock"></param>
+        private void SetSelectedStatus(ListBoxItem listBoxItem, TextBox textBox, TextBlock textBlock)
+        {
+            listBoxItem.IsSelected = true;
+            listBoxItem.Focus();
+            textBlock.Visibility = Visibility.Collapsed;
 
-            private void BookMarkListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+            textBox.Dispatcher.BeginInvoke(new Action(() =>
+                                {
+                                    textBox.Focus();
+                                    textBox.SelectAll();
+                                    //listBoxItem.IsSelected = true;
+                                }));
+        }
+
+        /// <summary>
+        /// ListViewItem失去焦点
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ListViewItem_LostFocus(object sender, RoutedEventArgs e)
+        {
+            ListViewItem listItem = sender as ListViewItem;
+            if (listItem != null)
             {
-            var a1 = (sender as ListView).SelectedItems.Count;
-if (a1 > 1)
-                {
-                isSelects = true;
-                }
-                }
+                BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
+                viewModel.LostFocusCommand.Execute(listItem);
 
-                /// <summary>
-                    /// ListViewItem双击时选中状态
-                /// </summary>
-                /// <param name="listBoxItem"></param>
-                /// <param name="textBox"></param>
-                /// <param name="textBlock"></param>
-                private void SetSelectedStatus(ListBoxItem listBoxItem, TextBox textBox, TextBlock textBlock)
-                {
-                listBoxItem.IsSelected = true;
-                listBoxItem.Focus();
-                textBlock.Visibility = Visibility.Collapsed;
+                TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listItem);
+                TextBox text = CommonHelper.FindVisualChild<TextBox>(listItem);
 
-textBox.Dispatcher.BeginInvoke(new Action(() =>
+                if (textBlock.Visibility != Visibility.Visible)
+                {
+                    if (isAdd == false && isRename == false)
                     {
-                    textBox.Focus();
-                    textBox.SelectAll();
-                    //listBoxItem.IsSelected = true;
-                    }));
+                        listItem.IsSelected = false;
                     }
-
-                    /// <summary>
-                        /// ListViewItem失去焦点
-                    /// </summary>
-                    /// <param name="sender"></param>
-                    /// <param name="e"></param>
-                    private void ListViewItem_LostFocus(object sender, RoutedEventArgs e)
+                    else
                     {
-                    ListViewItem listItem = sender as ListViewItem;
-                    if (listItem != null)
+                        listItem.IsSelected = true;
+                        isAdd = false;
+                    }
+                    if (text.IsSelectionActive == true)
                     {
-                    BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
-                    viewModel.LostFocusCommand.Execute(listItem);
-
-                    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listItem);
-                        TextBox text = CommonHelper.FindVisualChild<TextBox>(listItem);
-
-                            if (textBlock.Visibility != Visibility.Visible)
-                            {
-                            if (isAdd == false && isRename == false)
-                            {
-                            listItem.IsSelected = false;
-                            }
-                            else
-                            {
-                            listItem.IsSelected = true;
-                            isAdd = false;
-                            }
-                            if (text.IsSelectionActive == true)
-                            {
-                            textBlock.Visibility = Visibility.Visible;
-                            }
-                            }
-                            else
-                            {
-                            listItem.IsSelected = true;
-                            }
+                        textBlock.Visibility = Visibility.Visible;
+                    }
+                }
+                else
+                {
+                    listItem.IsSelected = true;
+                }
 
-                            //if (histotyListBoxItem != null)
-                            //{
-                            //    histotyListBoxItem.IsSelected = false;
-                            //    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
-                                //    textBlock.Visibility = Visibility.Visible;
-                                //    textBlock.Focusable = true;
-                                //}
-                                //if (textBlock.Visibility == Visibility.Collapsed)
-                                //{
-                                //    listItem.IsSelected = false;
-                                //    //textBlock.Visibility = Visibility.Visible;
-                                //}
-                                //else
-                                //{
-                                //    listItem.IsSelected = true;
-                                //    //textBlock.Visibility = Visibility.Collapsed;
-                                //}
-                                }
-                                }
+                //if (histotyListBoxItem != null)
+                //{
+                //    histotyListBoxItem.IsSelected = false;
+                //    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(histotyListBoxItem);
+                //    textBlock.Visibility = Visibility.Visible;
+                //    textBlock.Focusable = true;
+                //}
+                //if (textBlock.Visibility == Visibility.Collapsed)
+                //{
+                //    listItem.IsSelected = false;
+                //    //textBlock.Visibility = Visibility.Visible;
+                //}
+                //else
+                //{
+                //    listItem.IsSelected = true;
+                //    //textBlock.Visibility = Visibility.Collapsed;
+                //}
+            }
+        }
 
-                                private bool isRename = false;
+        private bool isRename = false;
 
-                                /// <summary>
-                                    /// 右键菜单-重命名
-                                /// </summary>
-                                /// <param name="sender"></param>
-                                /// <param name="e"></param>
-                                private void MenuItemRename_Click(object sender, RoutedEventArgs e)
-                                {
-                                if (sender is MenuItem)
-                                {
-                                MenuItem menuItem = (MenuItem)sender;
-                                CPDFBookmark bookmark = menuItem.CommandParameter as CPDFBookmark;
-                                if (bookmark != null)
-                                {
-                                BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
-                                isRename = true;
-                                ListViewItem listBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(bookmark));
-                                histotyListBoxItem = listBoxItem;
+        /// <summary>
+        /// 右键菜单-重命名
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void MenuItemRename_Click(object sender, RoutedEventArgs e)
+        {
+            if (sender is MenuItem)
+            {
+                MenuItem menuItem = (MenuItem)sender;
+                CPDFBookmark bookmark = menuItem.CommandParameter as CPDFBookmark;
+                if (bookmark != null)
+                {
+                    BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
+                    isRename = true;
+                    ListViewItem listBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(bookmark));
+                    histotyListBoxItem = listBoxItem;
 
-                                TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
-                                    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listBoxItem);
-                                        SetSelectedStatus(listBoxItem, textBox, textBlock);
-                                        }
-                                        }
-                                        }
+                    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
+                    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listBoxItem);
+                    SetSelectedStatus(listBoxItem, textBox, textBlock);
+                }
+            }
+        }
 
-                                        /// <summary>
-                                            /// BookMarkListView,鼠标点击
-                                        /// </summary>
-                                        /// <param name="sender"></param>
-                                        /// <param name="e"></param>
-                                        private void BookMarkListView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
-                                        {
-                                        if (e.LeftButton == MouseButtonState.Pressed)
-                                        {
-                                        var pos = e.GetPosition(BookMarkListView);
+        /// <summary>
+        /// BookMarkListView,鼠标点击
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        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<ListViewItem>(result.VisualHit);
-                                            if (listBoxItem == null)
-                                            {
-                                            if (BookMarkListView.SelectedItem != null)
-                                            {
-                                            ListViewItem item = (ListViewItem)(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
-                                                    {
-                                                    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
-                                                        TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listBoxItem);
-                                                            if (textBox.IsFocused == false)
-                                                            {
-                                                            listBoxItem.Focus();
-                                                            }
-                                                            }
-                                                            }
-                                                            //BookMarkListView.Focus();
-                                                            }
-                                                            }
+                var result = VisualTreeHelper.HitTest(BookMarkListView, pos);
+                if (result != null)
+                {
+                    //获取当前鼠标指针下的容器
+                    var listBoxItem = CommonHelper.FindVisualParent<ListViewItem>(result.VisualHit);
+                    if (listBoxItem == null)
+                    {
+                        if (BookMarkListView.SelectedItem != null)
+                        {
+                            ListViewItem item = (ListViewItem)(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
+                    {
+                        TextBox textBox = CommonHelper.FindVisualChild<TextBox>(listBoxItem);
+                        TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(listBoxItem);
+                        if (textBox.IsFocused == false)
+                        {
+                            listBoxItem.Focus();
+                        }
+                    }
+                }
+                //BookMarkListView.Focus();
+            }
+        }
 
-                                                            /// <summary>
-                                                                /// 右键菜单-删除
-                                                            /// </summary>
-                                                            /// <param name="sender"></param>
-                                                            /// <param name="e"></param>
-                                                            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);
-                                                                      }
-                                                                      }
-                                                                      }
+        /// <summary>
+        /// 右键菜单-删除
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        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);
+                }
+            }
+        }
 
-                                                                      public void BtnAddBookmark_Click(object sender, RoutedEventArgs e)
-                                                                      {
-                                                                      isAdd = true;
-                                                                      viewModel.AddBookmarkCommand.Execute(BookMarkListView);
-                                                                      if (viewModel.IsHasBookmark == false)
-                                                                      {
-                                                                      BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
-                                                                      ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
-                                                                      if (myListBoxItem == null)
-                                                                      {
-                                                                      BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
-                                                                      BookMarkListView.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
-                                                                      }
-                                                                      else
-                                                                      {
-                                                                    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
-                                                                        TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
+        public void BtnAddBookmark_Click(object sender, RoutedEventArgs e)
+        {
+            isAdd = true;
+            viewModel.AddBookmarkCommand.Execute(BookMarkListView);
+            if (viewModel.IsHasBookmark == false)
+            {
+                BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
+                ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
+                if (myListBoxItem == null)
+                {
+                    BookMarkListView.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged;
+                    BookMarkListView.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged;
+                }
+                else
+                {
+                    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
+                    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
 
-                                                                            SetSelectedStatus(myListBoxItem, textBox, textBlock);
-                                                                            }
-                                                                            }
-                                                                            }
+                    SetSelectedStatus(myListBoxItem, textBox, textBlock);
+                }
+            }
+        }
 
-                                                                            private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
-                                                                            {
-                                                                            ItemContainerGenerator itemContainer = sender as ItemContainerGenerator;
-                                                                            if (itemContainer.Status == GeneratorStatus.ContainersGenerated)
-                                                                            {
-                                                                            BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
-                                                                            ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
-                                                                            if (myListBoxItem != null)
-                                                                            {
-                                                                            if (myListBoxItem.RenderSize.Width < 0 && myListBoxItem.RenderSize.Height < 0)
-                                                                              {
-                                                                              BookMarkListView.UpdateLayout();
-                                                                              myListBoxItem.UpdateLayout();
-                                                                              BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
-                                                                              }
-                                                                            TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
-                                                                                TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
-                                                                                    SetSelectedStatus(myListBoxItem, textBox, textBlock);
-                                                                                    }
-                                                                                    }
-                                                                                    }
+        private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
+        {
+            ItemContainerGenerator itemContainer = sender as ItemContainerGenerator;
+            if (itemContainer.Status == GeneratorStatus.ContainersGenerated)
+            {
+                BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
+                ListViewItem myListBoxItem = (ListViewItem)(BookMarkListView.ItemContainerGenerator.ContainerFromItem(viewModel.AddCPDFBookmark));
+                if (myListBoxItem != null)
+                {
+                    if (myListBoxItem.RenderSize.Width < 0 && myListBoxItem.RenderSize.Height < 0)
+                    {
+                        BookMarkListView.UpdateLayout();
+                        myListBoxItem.UpdateLayout();
+                        BookMarkListView.ScrollIntoView(viewModel.AddCPDFBookmark);
+                    }
+                    TextBox textBox = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
+                    TextBlock textBlock = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
+                    SetSelectedStatus(myListBoxItem, textBox, textBlock);
+                }
+            }
+        }
 
-                                                                                    private void BookMarkListView_KeyDown(object sender, KeyEventArgs e)
-                                                                                    {
-                                                                                    if (BookMarkListView.SelectedItems == null)
-                                                                                    {
-                                                                                    return;
-                                                                                    }
-                                                                                    if (e.Key == Key.Escape)
-                                                                                    {
-                                                                                    BookMarkListView.SelectedItems.Clear();
-                                                                                    }
-                                                                                    //if (e.Key == Key.Delete)
-                                                                                    //{
-                                                                              //    if (BookMarkListView.SelectedItems.Count > 0)
-                                                                                        //    {
-                                                                                        //        //全选删除
-                                                                                        //        if (BookMarkListView.SelectedItems.Count == BookMarkListView.Items.Count)
-                                                                                        //        {
-                                                                                        //        }
-                                                                                        //    }
-                                                                                        //}
-                                                                                        }
-                                                                                        }
-                                                                                        }
+        private void BookMarkListView_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (BookMarkListView.SelectedItems == null)
+            {
+                return;
+            }
+            if (e.Key == Key.Escape)
+            {
+                BookMarkListView.SelectedItems.Clear();
+            }
+            //if (e.Key == Key.Delete)
+            //{
+            //    if (BookMarkListView.SelectedItems.Count > 0)
+            //    {
+            //        //全选删除
+            //        if (BookMarkListView.SelectedItems.Count == BookMarkListView.Items.Count)
+            //        {
+            //        }
+            //    }
+            //}
+        }
+    }
+}

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

@@ -55,29 +55,30 @@ namespace PDF_Office.Views.PropertyPanel.ViewModular
 
         private void btnRotateRight_Click(object sender, RoutedEventArgs e)
         {
-            if (Window.GetWindow(this) is MainWindow window)
-            {
-                if (window.TabablzControl.SelectedItem is MainContent main)
-                {
-                    if (main.ContentMain.Content is ViewContent viewContent)
-                    {
-                        foreach (var item in viewContent.GridViewer.Children)
-                        {
-                            if (item is ContentControl control)
-                            {
-                                if (control.Content is SplitScreenContent splitScreenContent)
-                                {
-                                    if (splitScreenContent.PDFViewerContent.Content != null)
-                                    {
-                                        viewModel.SplitScreenPDFViewer = (ComPDFKitViewer.PdfViewer.CPDFViewer)splitScreenContent.PDFViewerContent.Content;
-                                        break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
+            //分屏视图,同步旋转
+            //if (Window.GetWindow(this) is MainWindow window)
+            //{
+            //    if (window.TabablzControl.SelectedItem is MainContent main)
+            //    {
+            //        if (main.ContentMain.Content is ViewContent viewContent)
+            //        {
+            //            foreach (var item in viewContent.GridViewer.Children)
+            //            {
+            //                if (item is ContentControl control)
+            //                {
+            //                    if (control.Content is SplitScreenContent splitScreenContent)
+            //                    {
+            //                        if (splitScreenContent.PDFViewerContent.Content != null)
+            //                        {
+            //                            viewModel.SplitScreenPDFViewer = (ComPDFKitViewer.PdfViewer.CPDFViewer)splitScreenContent.PDFViewerContent.Content;
+            //                            break;
+            //                        }
+            //                    }
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
             viewModel.RotateCommand.Execute((sender as Button).Tag.ToString());
         }
     }