MS Init DocumentViewer

This commit is contained in:
Developer01
2025-05-16 08:34:48 +02:00
parent 0fe82815b8
commit 1f5a5c2227
6 changed files with 229 additions and 38 deletions

View File

@@ -90,23 +90,34 @@ Public Class DocumentViewer
''' </summary>
''' <param name="pLogConfig">A LogConfig object</param>
''' <param name="pLicenseKey">The GDPicture.NET License Key</param>
Public Sub Init(pLogConfig As LogConfig, pLicenseKey As String, pToolbarSettings As ToolbarSettings)
Private Function Init(pLogConfig As LogConfig, pLicenseKey As String, pToolbarSettings As ToolbarSettings) As Boolean
_logConfig = pLogConfig
_logger = pLogConfig.GetLogger()
_email = New Email2(pLogConfig)
_licenseKey = pLicenseKey
_licenseManager.RegisterKEY(_licenseKey)
_Annotations = New Annotations(pLogConfig)
_Search = New Search(pLogConfig, GdViewer)
_ToolbarSettings = pToolbarSettings
Try
Dim oConfigPath = ConfigPath()
_Config = New ConfigManager(Of Config)(pLogConfig, oConfigPath)
End Sub
_email = New Email2(pLogConfig)
If pLicenseKey = String.Empty Then
_logger.Warn("License key was not provided. File [{0}] not loaded.", FileName)
Return False
End If
_licenseKey = pLicenseKey
_licenseManager.RegisterKEY(_licenseKey)
_Annotations = New Annotations(pLogConfig)
_Search = New Search(pLogConfig, GdViewer)
_ToolbarSettings = pToolbarSettings
Public Sub Init(pLogConfig As LogConfig, pLicenseKey As String)
Init(pLogConfig, pLicenseKey, New ToolbarSettings())
End Sub
Dim oConfigPath = ConfigPath()
_Config = New ConfigManager(Of Config)(pLogConfig, oConfigPath)
Return True
Catch ex As Exception
_logger.Error(ex)
Return False
End Try
End Function
Public Function Init(pLogConfig As LogConfig, pLicenseKey As String) As Boolean
Return Init(pLogConfig, pLicenseKey, New ToolbarSettings())
End Function
''' <summary>
''' Load a file from a path and display it
@@ -141,10 +152,7 @@ Public Class DocumentViewer
Public Sub LoadFile(FileName As String, Stream As Stream)
FileLoaded = False
If _licenseKey = String.Empty Then
_logger.Warn("License key was not provided. File [{0}] not loaded.", FileName)
Exit Sub
End If
Dim oExtension As String = FileName.Substring(FileName.LastIndexOf("."))