02.08.2023
This commit is contained in:
@@ -58,11 +58,8 @@ Partial Public Class frmFieldEditor
|
||||
If Controller.LoadElements() = False Then
|
||||
MsgBox("Elemente konnten nicht geladen werden!", MsgBoxStyle.Critical, Text)
|
||||
Else
|
||||
|
||||
For Each oElement In Controller.Elements
|
||||
LoadAnnotation(oElement)
|
||||
Next
|
||||
|
||||
LoadAnnotations(SelectedReceiver.Id)
|
||||
GDViewer.DisplayFirstPage()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -74,8 +71,15 @@ Partial Public Class frmFieldEditor
|
||||
End Function
|
||||
|
||||
Private Sub BarItem_Click(sender As Object, e As ItemClickEventArgs)
|
||||
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
SetReceiver(oReceiver)
|
||||
If Controller.SaveElements() Then
|
||||
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
SetReceiver(oReceiver)
|
||||
ClearAnnotations()
|
||||
LoadAnnotations(oReceiver.Id)
|
||||
GDViewer.DisplayFirstPage()
|
||||
Else
|
||||
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SetReceiver(pReceiver As EnvelopeReceiver)
|
||||
@@ -95,10 +99,10 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Viewer_AnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(AnnotationIdx)
|
||||
Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
|
||||
Dim oPage = GDViewer.CurrentPage
|
||||
Dim oTag = $"{oPage}|{AnnotationIdx}"
|
||||
Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, pAnnotationIdx)
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
@@ -115,7 +119,7 @@ Partial Public Class frmFieldEditor
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
'NOOP
|
||||
End Sub
|
||||
|
||||
@@ -124,22 +128,21 @@ Partial Public Class frmFieldEditor
|
||||
Dim oCurrentPage = GDViewer.CurrentPage
|
||||
|
||||
'TODO: Save Annotations in Background
|
||||
|
||||
For index = 1 To oPageCount
|
||||
GDViewer.DisplayPage(index)
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
|
||||
For index1 = 0 To oAnnotationCount - 1
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index1)
|
||||
For oAnnotationIndex = 0 To oAnnotationCount - 1
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(oAnnotationIndex)
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
Controller.AddOrUpdateElement(oStickyNote, SelectedReceiver.Id)
|
||||
Controller.AddOrUpdateElement(oStickyNote)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If Not Controller.SaveElements() Then
|
||||
MsgBox("Element konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
MsgBox("Elemente konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
GDViewer.DisplayPage(oCurrentPage)
|
||||
@@ -171,9 +174,10 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement)
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement, pReceiverId As Integer)
|
||||
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
|
||||
|
||||
Dim oIndex = Manager.GetAnnotationIdx(oAnnotation)
|
||||
Dim oPage = pElement.Page
|
||||
|
||||
If Manager.GetStat() = GdPictureStatus.OK Then
|
||||
oAnnotation.Width = CSng(pElement.Width)
|
||||
@@ -183,14 +187,40 @@ Partial Public Class frmFieldEditor
|
||||
oAnnotation.Fill = True
|
||||
oAnnotation.FillColor = Color.DarkRed
|
||||
oAnnotation.Text = "SIGNATUR"
|
||||
|
||||
' TODO: Set tag with annotation index and page
|
||||
'oAnnotation.Tag =
|
||||
oAnnotation.Tag = GetAnnotationTag(pReceiverId, oPage, oIndex)
|
||||
|
||||
If Manager.SaveAnnotationsToPage() = GdPictureStatus.OK Then
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ClearAnnotations()
|
||||
Dim oPageCount = GDViewer.PageCount
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
|
||||
For oAnnotationIndex = 0 To oAnnotationCount - 1
|
||||
GDViewer.DeleteAnnotation(oAnnotationIndex)
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub LoadAnnotations(pReceiverId As Integer)
|
||||
Dim oPageCount = GDViewer.PageCount
|
||||
For oPage = 1 To oPageCount
|
||||
GDViewer.DisplayPage(oPage)
|
||||
Dim oCurrentPage = oPage
|
||||
Dim oElements = Controller.Elements.Where(Function(element) element.Page = oCurrentPage And element.ReceiverId = pReceiverId).ToList()
|
||||
For Each oElement In oElements
|
||||
LoadAnnotation(oElement, pReceiverId)
|
||||
Next
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function GetAnnotationTag(pReceiver As Integer, pPage As Integer, pIndex As Integer) As String
|
||||
Return $"{pReceiver}|{pPage}|{pIndex}"
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user