MS Multiple Files Dialog, Qualifizierte Signatur weg

This commit is contained in:
Developer01
2024-11-08 11:48:58 +01:00
parent 683ff03a0f
commit 57f8d0e398
15 changed files with 518 additions and 25 deletions

View File

@@ -30,6 +30,7 @@ Partial Public Class frmEnvelopeEditor
Private Const COL_CODE = "AccessCode"
Public Property State As State
Private TempFiles As TempFiles
Public Sub New()
InitializeComponent()
@@ -72,6 +73,8 @@ Partial Public Class frmEnvelopeEditor
Private Sub frmEditor_Load(sender As Object, e As EventArgs) Handles Me.Load
Logger = State.LogConfig.GetLogger()
Logger.Debug("Loading Configuration..")
TempFiles = New TempFiles(State.LogConfig)
TempFiles.Create()
If Envelope Is Nothing Then
Controller = New EnvelopeEditorController(State)
@@ -93,6 +96,24 @@ Partial Public Class frmEnvelopeEditor
Receivers = New BindingList(Of EnvelopeReceiver)(Controller.Envelope.Receivers)
For Each docItem As EnvelopeDocument In Documents
If Not File.Exists(docItem.Filepath) Then
Dim oTempFolder = TempFiles.TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{Envelope.Id}.pdf")
If File.Exists(oTempFilename) Then
Try
File.OpenWrite(oTempFilename)
Catch ex As Exception
MsgBox("File might already be open?", MsgBoxStyle.Exclamation)
Me.Cursor = Cursors.Default
Exit Sub
End Try
File.Delete(oTempFilename)
End If
WriteBytetoPath(oTempFilename, docItem.Byte_Data)
docItem.Filepath = oTempFilename
End If
If docItem.Thumbnail Is Nothing Then
docItem.Thumbnail = Controller.CreateThumbnail(docItem.Filepath)
docItem.PageCount = Controller.GetPageCount(docItem.Filepath)
@@ -141,6 +162,8 @@ Partial Public Class frmEnvelopeEditor
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
If Controller.DeleteDocument(oDocument) Then
Documents.Remove(oDocument)
GridDocuments.DataSource = Nothing
End If
End If
End Sub
@@ -163,6 +186,19 @@ Partial Public Class frmEnvelopeEditor
If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oEnvelope = Controller.Envelope
If Not IsNothing(oDocument.Byte_Data) Then
Dim oTempFolder = TempFiles.TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{oEnvelope.Id}.pdf")
If Not File.Exists(oTempFilename) Then
WriteBytetoPath(oTempFilename, oDocument.Byte_Data)
oDocument.Filepath = oTempFilename
End If
End If
Dim oGDPictureKey As String = MS_GDPICTUREKEY
Dim oForm As New frmFieldEditor(State) With {
@@ -180,7 +216,23 @@ Partial Public Class frmEnvelopeEditor
SplashScreenManager.CloseOverlayForm(oHandle)
End Try
End Sub
Private Sub WriteBytetoPath(ByVal sFileName As String, pByte As Byte())
'For Document
Try
If Not pByte Is Nothing Then
'Read image data into a file stream
Using fs As New FileStream(sFileName, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(pByte, 0, pByte.Length)
'Set image variable value using memory stream.
fs.Flush()
fs.Close()
End Using
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in downloadFile")
End Try
End Sub
Private Function SaveEnvelopeWithValidation() As Boolean
Return SaveEnvelope(True)
End Function
@@ -507,5 +559,11 @@ Partial Public Class frmEnvelopeEditor
End Sub
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
frmChooseDocVariant.ShowDialog()
End Sub
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
End Sub
End Class