19.07.2023
This commit is contained in:
@@ -19,7 +19,7 @@ Partial Public Class frmFieldEditor
|
||||
Public Property SelectedReceiver As EnvelopeReceiver = Nothing
|
||||
Public Property State As State
|
||||
|
||||
Public Property Fields As New List(Of EnvelopeDocumentElement)
|
||||
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
@@ -54,7 +54,7 @@ Partial Public Class frmFieldEditor
|
||||
Dim oItems = Receivers.Select(AddressOf CreateBarItem).ToArray()
|
||||
PopupMenu1.AddItems(oItems)
|
||||
|
||||
Controller = New FieldEditorController(State)
|
||||
Controller = New FieldEditorController(State, Document)
|
||||
End Sub
|
||||
|
||||
Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem
|
||||
@@ -88,11 +88,14 @@ Partial Public Class frmFieldEditor
|
||||
|
||||
Private Sub Viewer_AnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(AnnotationIdx)
|
||||
Dim oPage = GDViewer.CurrentPage
|
||||
Dim oTag = $"{oPage}|{AnnotationIdx}"
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
oStickyNote.Width = 1
|
||||
oStickyNote.Height = 1
|
||||
oStickyNote.Tag = oTag
|
||||
|
||||
ApplyAnnotationStyle(oAnnotation)
|
||||
End If
|
||||
@@ -102,54 +105,38 @@ Partial Public Class frmFieldEditor
|
||||
oAnnotation.CanResize = False
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(AnnotationIdx As Integer)
|
||||
'NOOP
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
Dim oElements As New List(Of EnvelopeDocumentElement)
|
||||
Private Sub btnSave_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnSave.ItemClick
|
||||
Dim oPageCount = GDViewer.PageCount
|
||||
Dim oCurrentPage = GDViewer.CurrentPage
|
||||
|
||||
' TODO: Annotationen mit den ElementObjekten verknüpfen, um doppelte Sätze zu verhindern
|
||||
'TODO: Save Annotations in Background
|
||||
|
||||
For index = 0 To oAnnotationCount - 1
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index)
|
||||
For index = 1 To oPageCount
|
||||
GDViewer.DisplayPage(index)
|
||||
Dim oAnnotationCount = GDViewer.GetAnnotationCount()
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
|
||||
|
||||
Dim oWidth = InchToPixel(oStickyNote.Width)
|
||||
Dim oHeight = InchToPixel(oStickyNote.Height)
|
||||
Dim oTop = InchToPixel(oStickyNote.Top)
|
||||
Dim oLeft = InchToPixel(oStickyNote.Left)
|
||||
|
||||
Dim oElement As New EnvelopeDocumentElement() With {
|
||||
.ElementType = Constants.ElementType.Signature.ToString,
|
||||
.Height = oHeight,
|
||||
.Width = oWidth,
|
||||
.X = oLeft,
|
||||
.Y = oTop,
|
||||
.DocumentId = Document.Id,
|
||||
.ReceiverId = SelectedReceiver.Id
|
||||
}
|
||||
|
||||
oElements.Add(oElement)
|
||||
End If
|
||||
For index1 = 0 To oAnnotationCount - 1
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(index1)
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
Controller.AddOrUpdateElement(oStickyNote, SelectedReceiver.Id)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
If Not Controller.SaveElements(oElements) Then
|
||||
If Not Controller.SaveElements() Then
|
||||
MsgBox("Element konnten nicht gespeichert werden!", MsgBoxStyle.Critical, Text)
|
||||
End If
|
||||
|
||||
GDViewer.DisplayPage(oCurrentPage)
|
||||
End Sub
|
||||
|
||||
Private Function InchToPixel(pInch As Single) As Single
|
||||
Return pInch * 96
|
||||
End Function
|
||||
|
||||
Private Function PixelToInch(pPixel As Single) As Single
|
||||
Return pPixel / 96
|
||||
End Function
|
||||
|
||||
Private Sub ApplyAnnotationStyle(ByRef pAnnotation As Annotation)
|
||||
If TypeOf pAnnotation Is AnnotationStickyNote Then
|
||||
|
||||
Reference in New Issue
Block a user