2023-09-11 - THUMBNAILS!!!!!
This commit is contained in:
58
EnvelopeGenerator.Form/Helper/TempFiles.vb
Normal file
58
EnvelopeGenerator.Form/Helper/TempFiles.vb
Normal file
@@ -0,0 +1,58 @@
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class TempFiles
|
||||
Inherits BaseClass
|
||||
|
||||
Public Property TempPath As String
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
|
||||
Dim oTempDirectoryPath = Path.GetTempPath()
|
||||
TempPath = Path.Combine(oTempDirectoryPath, "EnvelopeGenerator")
|
||||
End Sub
|
||||
|
||||
Public Function Create() As Boolean
|
||||
Try
|
||||
If Directory.Exists(TempPath) = False Then
|
||||
Directory.CreateDirectory(TempPath)
|
||||
Else
|
||||
CleanUpFiles()
|
||||
End If
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function CleanUpFiles() As Boolean
|
||||
Try
|
||||
For Each fileItem As String In Directory.GetFiles(TempPath)
|
||||
File.Delete(fileItem)
|
||||
Next
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CleanUp() As Boolean
|
||||
Try
|
||||
Directory.Delete(TempPath)
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
35
EnvelopeGenerator.Form/Helper/Thumbnail.vb
Normal file
35
EnvelopeGenerator.Form/Helper/Thumbnail.vb
Normal file
@@ -0,0 +1,35 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class Thumbnail
|
||||
Inherits BaseClass
|
||||
|
||||
Dim GDViewer As GdViewer
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
|
||||
GDViewer = New GdViewer()
|
||||
Dim oGDPictureKey As String = "21182889975216572111813147150675976632"
|
||||
|
||||
Dim licenseManager As GdPicture14.LicenseManager = New GdPicture14.LicenseManager()
|
||||
licenseManager.RegisterKEY(oGDPictureKey)
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function GetThumbnailFromPDFFile(pFilePath As String) As Bitmap
|
||||
Try
|
||||
GDViewer.DisplayFromFile(pFilePath)
|
||||
Dim thumbnailBitmap As Bitmap = GDViewer.GetPageThumbnailAsBitmap(1414, 1000, 1, Color.White)
|
||||
|
||||
Return thumbnailBitmap
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
41
EnvelopeGenerator.Form/Helper/Validator.vb
Normal file
41
EnvelopeGenerator.Form/Helper/Validator.vb
Normal file
@@ -0,0 +1,41 @@
|
||||
Imports DevExpress.Utils.VisualEffects
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Validator
|
||||
Inherits BaseClass
|
||||
|
||||
Public ReadOnly Property AdornerUIManager As AdornerUIManager
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pAdornerUIManager As AdornerUIManager)
|
||||
MyBase.New(pLogConfig)
|
||||
Me.AdornerUIManager = pAdornerUIManager
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function Validate(pEditor As BaseEdit) As Boolean
|
||||
With AdornerUIManager.ValidationHintProperties
|
||||
.State = ValidationHintState.Invalid
|
||||
.InvalidState.ShowBorder = True
|
||||
.InvalidState.ShowBackgroundMode = ValidationHintBackgroundMode.Target
|
||||
End With
|
||||
|
||||
AdornerUIManager.Hide()
|
||||
AdornerUIManager.Elements.Clear()
|
||||
|
||||
Dim oMissingParams As Boolean = False
|
||||
|
||||
If String.IsNullOrEmpty(pEditor.EditValue) Then
|
||||
AdornerUIManager.Elements.Add(New ValidationHint With {
|
||||
.TargetElement = pEditor,
|
||||
.Visible = True
|
||||
})
|
||||
oMissingParams = True
|
||||
End If
|
||||
|
||||
AdornerUIManager.Show()
|
||||
|
||||
Return oMissingParams
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user