|
@@ -17,6 +17,7 @@ using PDF_Office.Model;
|
|
|
using PDF_Office.Model.BOTA;
|
|
|
using PDF_Office.Views.BOTA;
|
|
|
using PDF_Office.Views.PropertyPanel.AnnotPanel;
|
|
|
+using PDF_Office.Views.Scan;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Regions;
|
|
@@ -724,7 +725,7 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
DialogParameters value = new DialogParameters();
|
|
|
value.Add(ParameterNames.Annotation, args);
|
|
|
- dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
|
|
|
+ dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, async e =>
|
|
|
{
|
|
|
if (e.Result == ButtonResult.OK && e.Parameters != null)
|
|
|
{
|
|
@@ -732,58 +733,44 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
|
|
|
{
|
|
|
AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
|
|
|
-
|
|
|
- AnnotAttribEvent annotEvent = e.Parameters.GetValue<AnnotAttribEvent>(ParameterNames.AnnotEvent);
|
|
|
-
|
|
|
- listBoxItem.DataContext = annotation;
|
|
|
- var annot = AnnotationListItems.FirstOrDefault(q => q.PageIndex == annotation.PageIndex && q.AnnotIndex == annotation.AnnotIndex);
|
|
|
-
|
|
|
- //annotEvent?.UpdateAttrib(AnnotAttrib.NoteText, annotation.MarkupContent);
|
|
|
- //annotEvent?.UpdateAnnot();
|
|
|
+ RefreshOneListItem(annotation.AnnotHandlerEventArgs);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //if (obj is AnnotationHandlerEventArgs data)
|
|
|
- //{
|
|
|
- // if (data != null)
|
|
|
- // {
|
|
|
- // if (data.EventType != AnnotArgsType.AnnotSticky)
|
|
|
- // {
|
|
|
- // DialogParameters value = new DialogParameters();
|
|
|
- // value.Add(ParameterNames.Annotation, data);
|
|
|
- // dialogs.ShowDialog(DialogNames.AddAnnotationDialog, value, e =>
|
|
|
- // {
|
|
|
- // if (e.Result == ButtonResult.OK && e.Parameters != null)
|
|
|
- // {
|
|
|
- // //PdfViewer.UndoManager.CanSave = true;
|
|
|
- // // if (e.Parameters.ContainsKey(ParameterNames.Annotation) && e.Parameters.ContainsKey(ParameterNames.AnnotEvent))
|
|
|
- // // {
|
|
|
- // // AnnotationHandlerEventArgs annotation = e.Parameters.GetValue<AnnotationHandlerEventArgs>(ParameterNames.Annotation);
|
|
|
-
|
|
|
- // // //AnnotAttribEvent annotEvent = e.Parameters.GetValue<AnnotAttribEvent>(ParameterNames.AnnotEvent);
|
|
|
-
|
|
|
- // // //annotEvent?.UpdateAttrib(AnnotAttrib.NoteText, annotation.MarkupContent);
|
|
|
- // // //annotEvent?.UpdateAnnot();
|
|
|
-
|
|
|
- // // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
- // //if(data.EventType == AnnotArgsType.AnnotFreeText)
|
|
|
- // //{
|
|
|
- // // ListBoxItem myListBoxItem = (ListBoxItem)(listBox.ItemContainerGenerator.ContainerFromItem(data));
|
|
|
- // // TextBlock txbContent = CommonHelper.FindVisualChild<TextBlock>(myListBoxItem);
|
|
|
-
|
|
|
- // // TextBox txtContent = CommonHelper.FindVisualChild<TextBox>(myListBoxItem);
|
|
|
- // // txbContent.Visibility = Visibility.Collapsed;
|
|
|
- // // txtContent.Visibility = Visibility.Visible;
|
|
|
- // //}
|
|
|
- // }
|
|
|
- //}
|
|
|
+ private async void RefreshOneListItem(AnnotHandlerEventArgs annotation)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < AnnotationListItems.Count; i++)
|
|
|
+ {
|
|
|
+ if (AnnotationListItems[i].PageIndex == annotation.PageIndex && AnnotationListItems[i].AnnotIndex == annotation.AnnotIndex)
|
|
|
+ {
|
|
|
+ AnnotationListItems[i] = GetAddAnnotEventArgs(annotation);
|
|
|
+
|
|
|
+ for (int j = 0; j < CurrentAnnotationArgs.Count; j++)
|
|
|
+ {
|
|
|
+ if (CurrentAnnotationArgs[j].PageIndex == annotation.PageIndex && CurrentAnnotationArgs[j].AnnotIndex == annotation.AnnotIndex)
|
|
|
+ {
|
|
|
+ CurrentAnnotationArgs[j] = GetAddAnnotEventArgs(annotation);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!listBox.SelectedItems.Contains(AnnotationListItems[i]))
|
|
|
+ {
|
|
|
+ listBox.SelectedItem = AnnotationListItems[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ await Task.Delay(1);//不加延时 每页的第一个注释不会展开
|
|
|
+ ExpandGroupHeader(AnnotationListItems[i], listBox);
|
|
|
+
|
|
|
+ await Task.Delay(1);//不加延时 会有不滚动的现象
|
|
|
+ listBox.ScrollIntoView(AnnotationListItems[i]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -875,15 +862,14 @@ namespace PDF_Office.ViewModels.BOTA
|
|
|
{
|
|
|
if (AnnotationListItems[k].PageIndex == pageIndex && AnnotationListItems[k].AnnotIndex == annotIndex && items[j].AnnotIndex == annotIndex)
|
|
|
{
|
|
|
- AnnotationHandlerEventArgs args = GetAddAnnotEventArgs(items[j]);
|
|
|
- AnnotationListItems[k] = args;
|
|
|
+ //AnnotationHandlerEventArgs args = GetAddAnnotEventArgs(items[j]);
|
|
|
+ AnnotationListItems[k] = GetAddAnnotEventArgs(items[j]);
|
|
|
|
|
|
- AnnotationHandlerEventArgs annotation1 = CurrentAnnotationArgs.FirstOrDefault(x => x.PageIndex == AnnotationListItems[k].PageIndex && x.AnnotIndex == AnnotationListItems[k].AnnotIndex);
|
|
|
for (int i = 0; i < CurrentAnnotationArgs.Count; i++)
|
|
|
{
|
|
|
- if (annotation1 == CurrentAnnotationArgs[i])
|
|
|
+ if (CurrentAnnotationArgs[i].PageIndex == pageIndex && CurrentAnnotationArgs[i].AnnotIndex == annotIndex)
|
|
|
{
|
|
|
- CurrentAnnotationArgs[i] = args;
|
|
|
+ CurrentAnnotationArgs[i] = GetAddAnnotEventArgs(items[j]);
|
|
|
break;
|
|
|
}
|
|
|
}
|