13-11-23
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
Imports DevExpress.XtraBars
|
||||
Imports System.Collections
|
||||
Imports DevExpress.Utils
|
||||
Imports DevExpress.Utils.Svg
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.Common
|
||||
Imports EnvelopeGenerator.Common.My
|
||||
@@ -63,26 +66,36 @@ Partial Public Class frmFieldEditor
|
||||
If Controller.LoadElements() = False Then
|
||||
MsgBox(Resources.Envelope.Elements_could_not_be_loaded, MsgBoxStyle.Critical, Text)
|
||||
Else
|
||||
LoadAnnotations(SelectedReceiver.Id)
|
||||
For Each oReceiver In Receivers
|
||||
LoadAnnotations(oReceiver.Id)
|
||||
Next
|
||||
'LoadAnnotations(SelectedReceiver.Id)
|
||||
GDViewer.DisplayFirstPage()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function CreateBarItem(pReceiver As EnvelopeReceiver) As BarItem
|
||||
Dim oItem = New BarButtonItem(BarManager1, pReceiver.Name)
|
||||
Dim oBaseCircle As SvgImage = SvgImageCollection1.Item(0)
|
||||
Dim oColorCircle = Helpers.GetColorCircle(oBaseCircle, pReceiver.Color)
|
||||
|
||||
oItem.ImageOptions.SvgImage = oColorCircle
|
||||
|
||||
AddHandler oItem.ItemClick, AddressOf ReceiverItem_Click
|
||||
oItem.Tag = pReceiver
|
||||
Return oItem
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Sub ReceiverItem_Click(sender As Object, e As ItemClickEventArgs)
|
||||
Me.SuspendLayout()
|
||||
|
||||
Dim oReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
Dim oSelectedReceiver As EnvelopeReceiver = e.Item.Tag
|
||||
Dim oCurrentPage = GDViewer.CurrentPage
|
||||
Dim oCurrentPosition = GDViewer.GetVScrollBarPosition()
|
||||
|
||||
If oReceiver.Id = SelectedReceiver.Id Then
|
||||
If oSelectedReceiver.Id = SelectedReceiver.Id Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -90,9 +103,13 @@ Partial Public Class frmFieldEditor
|
||||
|
||||
If Controller.SaveElements(SelectedReceiver.Id) Then
|
||||
|
||||
SetReceiver(oReceiver)
|
||||
SetReceiver(oSelectedReceiver)
|
||||
ClearAnnotations()
|
||||
LoadAnnotations(oReceiver.Id)
|
||||
|
||||
For Each oReceiver In Receivers
|
||||
LoadAnnotations(oReceiver.Id)
|
||||
Next
|
||||
|
||||
DisplayPage(oCurrentPage)
|
||||
GDViewer.SetVScrollBarPosition(oCurrentPosition)
|
||||
GDViewer.Redraw()
|
||||
@@ -105,7 +122,10 @@ Partial Public Class frmFieldEditor
|
||||
End Sub
|
||||
|
||||
Private Sub SetReceiver(pReceiver As EnvelopeReceiver)
|
||||
Dim oBaseCircle As SvgImage = SvgImageCollection1.Item(0)
|
||||
|
||||
txtReceiver.Caption = pReceiver.Name
|
||||
txtReceiver.ImageOptions.SvgImage = Helpers.GetColorCircle(oBaseCircle, pReceiver.Color)
|
||||
SelectedReceiver = pReceiver
|
||||
End Sub
|
||||
|
||||
@@ -128,28 +148,9 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
|
||||
Dim oPage = GDViewer.CurrentPage
|
||||
Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, -1)
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
oStickyNote.Width = SIGNATURE_WIDTH
|
||||
oStickyNote.Height = SIGNATURE_HEIGHT
|
||||
oStickyNote.Tag = oTag
|
||||
|
||||
ApplyAnnotationStyle(oAnnotation)
|
||||
End If
|
||||
|
||||
oAnnotation.CanRotate = False
|
||||
oAnnotation.CanEdit = False
|
||||
oAnnotation.CanResize = False
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Viewer_BeforeAnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
'NOOP
|
||||
Dim oAnnotation As Annotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
|
||||
ApplyAnnotationStyleForNewAnnotation(oAnnotation, SelectedReceiver.Color)
|
||||
End Sub
|
||||
|
||||
Private Sub btnSave_ItemClick(sender As Object, e As ItemClickEventArgs) Handles btnSave.ItemClick
|
||||
@@ -248,16 +249,22 @@ Partial Public Class frmFieldEditor
|
||||
Private Sub LoadAnnotation(pElement As EnvelopeDocumentElement, pReceiverId As Integer)
|
||||
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
|
||||
Dim oPage = pElement.Page
|
||||
Dim oReceiver = Receivers.Where(Function(r) r.Id = pReceiverId).Single()
|
||||
|
||||
Dim oAnnotationColor = oReceiver.Color
|
||||
If oReceiver.Id <> SelectedReceiver.Id Then
|
||||
oAnnotationColor = Color.FromArgb(30, oReceiver.Color)
|
||||
|
||||
oAnnotation.CanSelect = False
|
||||
End If
|
||||
|
||||
If Manager.GetStat() = GdPictureStatus.OK Then
|
||||
ApplyAnnotationStyleForExistingAnnotation(oAnnotation, oAnnotationColor)
|
||||
|
||||
oAnnotation.Width = CSng(pElement.Width)
|
||||
oAnnotation.Height = CSng(pElement.Height)
|
||||
oAnnotation.Left = CSng(pElement.X)
|
||||
oAnnotation.Top = CSng(pElement.Y)
|
||||
oAnnotation.Fill = True
|
||||
oAnnotation.FillColor = SelectedReceiver.Color
|
||||
oAnnotation.BorderWidth = 0.01
|
||||
oAnnotation.Text = SIGNATURE_LABEL
|
||||
oAnnotation.Tag = GetAnnotationTag(pReceiverId, oPage, pElement.Id)
|
||||
Else
|
||||
Dim oStatus = Manager.GetStat()
|
||||
@@ -266,15 +273,48 @@ Partial Public Class frmFieldEditor
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyAnnotationStyle(ByRef pAnnotation As Annotation)
|
||||
Private Sub Viewer_AnnotationAddedByUser(pAnnotationIdx As Integer)
|
||||
Dim oAnnotation = GDViewer.GetAnnotationFromIdx(pAnnotationIdx)
|
||||
Dim oPage = GDViewer.CurrentPage
|
||||
Dim oTag = GetAnnotationTag(SelectedReceiver.Id, oPage, -1)
|
||||
|
||||
If TypeOf oAnnotation Is AnnotationStickyNote Then
|
||||
Dim oStickyNote As AnnotationStickyNote = oAnnotation
|
||||
oStickyNote.Width = SIGNATURE_WIDTH
|
||||
oStickyNote.Height = SIGNATURE_HEIGHT
|
||||
oStickyNote.Tag = oTag
|
||||
|
||||
ApplyAnnotationStyleForExistingAnnotation(oAnnotation, SelectedReceiver.Color)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyAnnotationStyleForExistingAnnotation(ByRef pAnnotation As Annotation, pColor As Color)
|
||||
ApplyAnnotationStyle(pAnnotation, pColor, pIsNewAnnotation:=False)
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyAnnotationStyleForNewAnnotation(ByRef pAnnotation As Annotation, pColor As Color)
|
||||
ApplyAnnotationStyle(pAnnotation, pColor, pIsNewAnnotation:=True)
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyAnnotationStyle(ByRef pAnnotation As Annotation, pColor As Color, pIsNewAnnotation As Boolean)
|
||||
If TypeOf pAnnotation Is AnnotationStickyNote Then
|
||||
Dim oAnnotation As AnnotationStickyNote = pAnnotation
|
||||
oAnnotation.Fill = True
|
||||
oAnnotation.FillColor = SelectedReceiver.Color
|
||||
oAnnotation.FillColor = pColor
|
||||
oAnnotation.Text = SIGNATURE_LABEL
|
||||
oAnnotation.Alignment = StringAlignment.Center
|
||||
oAnnotation.LineAlignment = StringAlignment.Center
|
||||
oAnnotation.BorderWidth = 0.01
|
||||
oAnnotation.FontSize = 16
|
||||
oAnnotation.FontStyle = FontStyle.Regular
|
||||
|
||||
oAnnotation.CanEditText = False
|
||||
oAnnotation.CanEdit = False
|
||||
oAnnotation.CanRotate = False
|
||||
|
||||
If pIsNewAnnotation = False Then
|
||||
oAnnotation.CanResize = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -332,6 +372,10 @@ Partial Public Class frmFieldEditor
|
||||
Private Function GetAnnotationTag(pReceiver As Integer, pPage As Integer, pGuid As Integer) As String
|
||||
Return $"{pReceiver}|{pPage}|{pGuid}"
|
||||
End Function
|
||||
|
||||
Private Sub PopupMenu1_BeforePopup(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles PopupMenu1.BeforePopup
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user