|
@@ -292,6 +292,59 @@ namespace PDF_Office.ViewModels.Tools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void SelectedSignature(List<AnnotHandlerEventArgs> annotlist)
|
|
|
|
+ {
|
|
|
|
+ if (annotlist == null || annotlist.Count == 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ var annot = annotlist[0];
|
|
|
|
+
|
|
|
|
+ if (annot.EventType != AnnotArgsType.AnnotStamp && annot.EventType != AnnotArgsType.AnnotFreehand)
|
|
|
|
+ return;
|
|
|
|
+ if (annot.PageIndex < 0 || annot.AnnotIndex < 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ var signAnnot = AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
|
|
|
|
+ if (signAnnot == null)
|
|
|
|
+ {
|
|
|
|
+ if (annot.EventType == AnnotArgsType.AnnotStamp)
|
|
|
|
+ {
|
|
|
|
+ GetStamp();
|
|
|
|
+ StrAnnotToolChecked = "Stamp";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ GetFreehand();
|
|
|
|
+ StrAnnotToolChecked = "";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ GetSignature();
|
|
|
|
+ StrAnnotToolChecked = "Signature";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void AddAnnotSignature(AnnotHandlerEventArgs annot)
|
|
|
|
+ {
|
|
|
|
+ if ((annot.EventType != AnnotArgsType.AnnotStamp && annot.EventType != AnnotArgsType.AnnotFreehand) ||
|
|
|
|
+ (annot.PageIndex < 0 || annot.AnnotIndex < 0)) return;
|
|
|
|
+
|
|
|
|
+ if (StrAnnotToolChecked == "Signature")
|
|
|
|
+ {
|
|
|
|
+ if (AnnotSignatures == null)
|
|
|
|
+ AnnotSignatures = new List<Tuple<int, int>>();
|
|
|
|
+
|
|
|
|
+ var signAnnot = AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
|
|
|
|
+ if (signAnnot == null)
|
|
|
|
+ {
|
|
|
|
+ AnnotSignatures.Add(new Tuple<int, int>(annot.PageIndex, annot.AnnotIndex));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
#endregion 与触发事件调用相关的函数
|
|
#endregion 与触发事件调用相关的函数
|
|
|
|
|
|
#region PDFViewer事件
|
|
#region PDFViewer事件
|
|
@@ -310,6 +363,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
if (e.IsAnnotCreateReset == false)
|
|
if (e.IsAnnotCreateReset == false)
|
|
{
|
|
{
|
|
GetSelectedAnnots(e);
|
|
GetSelectedAnnots(e);
|
|
|
|
+ SelectedSignature(e.AnnotItemsList);
|
|
CurrentSelectedAnnot = annot;
|
|
CurrentSelectedAnnot = annot;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -808,9 +862,18 @@ namespace PDF_Office.ViewModels.Tools
|
|
)
|
|
)
|
|
{
|
|
{
|
|
PDFViewer.ClearSelectAnnots();
|
|
PDFViewer.ClearSelectAnnots();
|
|
- PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
|
|
|
|
|
|
+ if (StrAnnotToolChecked != "Signature")
|
|
|
|
+ {
|
|
|
|
+ PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ AddAnnotSignature(annot);
|
|
|
|
+ PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
break;
|
|
break;
|
|
|
|
|
|
case ActionType.Del:
|
|
case ActionType.Del:
|