|
@@ -1,4 +1,6 @@
|
|
-using ComPDFKitViewer.AnnotEvent;
|
|
|
|
|
|
+using ComPDFKit.PDFAnnotation;
|
|
|
|
+using ComPDFKit.PDFPage;
|
|
|
|
+using ComPDFKitViewer.AnnotEvent;
|
|
using PDF_Master.DataConvert;
|
|
using PDF_Master.DataConvert;
|
|
using PDF_Master.EventAggregators;
|
|
using PDF_Master.EventAggregators;
|
|
using PDF_Master.Helper;
|
|
using PDF_Master.Helper;
|
|
@@ -13,6 +15,7 @@ using System.Linq;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
|
|
+using System.Windows.Annotations;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Data;
|
|
using System.Windows.Data;
|
|
@@ -23,6 +26,7 @@ using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using System.Windows.Shapes;
|
|
|
|
+using static Dropbox.Api.TeamLog.PaperDownloadFormat;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
|
using ListBox = System.Windows.Controls.ListBox;
|
|
using ListBox = System.Windows.Controls.ListBox;
|
|
using MenuItem = System.Windows.Controls.MenuItem;
|
|
using MenuItem = System.Windows.Controls.MenuItem;
|
|
@@ -313,8 +317,8 @@ namespace PDF_Master.Views.BOTA
|
|
{
|
|
{
|
|
viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(AnnotationList.SelectedItem);
|
|
viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(AnnotationList.SelectedItem);
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
private void AnnotationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void AnnotationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
var a = AnnotationList.SelectedItems.Count;
|
|
var a = AnnotationList.SelectedItems.Count;
|
|
@@ -328,68 +332,70 @@ namespace PDF_Master.Views.BOTA
|
|
viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItems[0]);
|
|
viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItems[0]);
|
|
}
|
|
}
|
|
else if (a1 > 1)
|
|
else if (a1 > 1)
|
|
- {
|
|
|
|
|
|
+ {
|
|
#region 阅读视图 多选
|
|
#region 阅读视图 多选
|
|
-
|
|
|
|
- Dictionary<int, List<int>> selectedItemDics = new Dictionary<int, List<int>>();
|
|
|
|
|
|
+
|
|
|
|
+ Dictionary<int, List<int>> selectedItemDics = new Dictionary<int, List<int>>();
|
|
List<AnnotationHandlerEventArgs> eventArgs = new List<AnnotationHandlerEventArgs>();
|
|
List<AnnotationHandlerEventArgs> eventArgs = new List<AnnotationHandlerEventArgs>();
|
|
- List<int> ints = new List<int>();
|
|
|
|
foreach (var item in (sender as ListBox).SelectedItems)
|
|
foreach (var item in (sender as ListBox).SelectedItems)
|
|
{
|
|
{
|
|
if (item is AnnotationHandlerEventArgs annotation)
|
|
if (item is AnnotationHandlerEventArgs annotation)
|
|
{
|
|
{
|
|
- if (!selectedItemDics.ContainsKey(annotation.PageIndex))
|
|
|
|
- {
|
|
|
|
- ints.Clear();
|
|
|
|
- ints.Add(annotation.AnnotIndex);
|
|
|
|
- selectedItemDics.Add(annotation.PageIndex, ints);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- ints.Add(annotation.AnnotIndex);
|
|
|
|
- selectedItemDics[annotation.PageIndex] = ints;
|
|
|
|
- }
|
|
|
|
|
|
+ if (eventArgs.Contains(annotation) == false)
|
|
|
|
+ {
|
|
|
|
+ eventArgs.Add(annotation);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ var result = eventArgs.GroupBy(d => d.PageIndex);
|
|
|
|
+ foreach (var item in result)
|
|
|
|
+ {
|
|
|
|
+ if (selectedItemDics.ContainsKey(item.Key) == false)
|
|
|
|
+ {
|
|
|
|
+ var ai = item.Select(w => w.AnnotIndex).ToList();
|
|
|
|
+ selectedItemDics.Add(item.Key, ai);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
#endregion 阅读视图 多选
|
|
#endregion 阅读视图 多选
|
|
-
|
|
|
|
- viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(selectedItemDics);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void AnnotationList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
|
|
|
- {
|
|
|
|
- if (AnnotationList.SelectedItems == null)
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (e.Key == Key.Escape)
|
|
|
|
- {
|
|
|
|
- AnnotationList.SelectedItems.Clear();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
|
- {
|
|
|
|
- var pos = e.GetPosition(this);
|
|
|
|
- var result = VisualTreeHelper.HitTest(this, pos);
|
|
|
|
- if (result != null)
|
|
|
|
- {
|
|
|
|
- //点击按钮和listboxitem时 不清空多选 其余区域取消多选
|
|
|
|
- var item = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
|
|
|
|
- if (item != null)
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var btn = CommonHelper.FindVisualParent<System.Windows.Controls.Button>(result.VisualHit);
|
|
|
|
- if (btn != null)
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
|
|
+
|
|
|
|
+ viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(selectedItemDics);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void AnnotationList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ if (AnnotationList.SelectedItems == null)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (e.Key == Key.Escape)
|
|
|
|
+ {
|
|
|
|
+ AnnotationList.SelectedItems.Clear();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ var pos = e.GetPosition(this);
|
|
|
|
+ var result = VisualTreeHelper.HitTest(this, pos);
|
|
|
|
+ if (result != null)
|
|
|
|
+ {
|
|
|
|
+ //点击按钮和listboxitem时 不清空多选 其余区域取消多选
|
|
|
|
+ var item = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
|
|
|
|
+ if (item != null)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ var btn = CommonHelper.FindVisualParent<System.Windows.Controls.Button>(result.VisualHit);
|
|
|
|
+ if (btn != null)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private void ListBox_MouseDown(object sender, MouseButtonEventArgs e)
|
|
private void ListBox_MouseDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
{
|
|
AnnotationList.SelectedIndex = -1;
|
|
AnnotationList.SelectedIndex = -1;
|
|
@@ -410,5 +416,5 @@ namespace PDF_Master.Views.BOTA
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|