Merge
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.6" newVersion="8.0.0.6" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
106
Controls.DocumentViewer/DocumentViewer.Designer.vb
generated
106
Controls.DocumentViewer/DocumentViewer.Designer.vb
generated
@@ -24,7 +24,6 @@ Partial Class DocumentViewer
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(DocumentViewer))
|
||||
Me.GdViewer = New GdPicture14.GdViewer()
|
||||
Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
|
||||
Me.BarManager1 = New DevExpress.XtraBars.BarManager(Me.components)
|
||||
Me.ToolbarDocumentViewer = New DevExpress.XtraBars.Bar()
|
||||
@@ -74,82 +73,6 @@ Partial Class DocumentViewer
|
||||
CType(Me.RepositoryItemSearchControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'GdViewer
|
||||
'
|
||||
Me.GdViewer.AllowDropFile = False
|
||||
Me.GdViewer.AnimateGIF = True
|
||||
Me.GdViewer.AnnotationDropShadow = False
|
||||
Me.GdViewer.AnnotationEnableMultiSelect = True
|
||||
Me.GdViewer.AnnotationResizeRotateHandlesColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(128, Byte), Integer))
|
||||
Me.GdViewer.AnnotationResizeRotateHandlesScale = 1.0!
|
||||
Me.GdViewer.AnnotationSelectionLineColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))
|
||||
Me.GdViewer.AutoScrollMargin = New System.Drawing.Size(0, 0)
|
||||
Me.GdViewer.AutoScrollMinSize = New System.Drawing.Size(0, 0)
|
||||
Me.GdViewer.BackColor = System.Drawing.SystemColors.AppWorkspace
|
||||
Me.GdViewer.BackgroundImage = Nothing
|
||||
Me.GdViewer.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None
|
||||
Me.GdViewer.ClipAnnotsToPageBounds = True
|
||||
Me.GdViewer.ClipRegionsToPageBounds = True
|
||||
Me.GdViewer.ContinuousViewMode = True
|
||||
Me.GdViewer.DisplayQuality = GdPicture14.DisplayQuality.DisplayQualityAutomatic
|
||||
Me.GdViewer.DisplayQualityAuto = True
|
||||
Me.GdViewer.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.GdViewer.DocumentAlignment = GdPicture14.ViewerDocumentAlignment.DocumentAlignmentMiddleCenter
|
||||
Me.GdViewer.DocumentPosition = GdPicture14.ViewerDocumentPosition.DocumentPositionMiddleCenter
|
||||
Me.GdViewer.DrawPageBorders = True
|
||||
Me.GdViewer.EnableDeferredPainting = True
|
||||
Me.GdViewer.EnabledProgressBar = True
|
||||
Me.GdViewer.EnableFuzzySearch = False
|
||||
Me.GdViewer.EnableICM = False
|
||||
Me.GdViewer.EnableMenu = True
|
||||
Me.GdViewer.EnableMouseWheel = True
|
||||
Me.GdViewer.EnableTextSelection = True
|
||||
Me.GdViewer.ForceScrollBars = False
|
||||
Me.GdViewer.ForceTemporaryMode = False
|
||||
Me.GdViewer.ForeColor = System.Drawing.Color.Black
|
||||
Me.GdViewer.Gamma = 1.0!
|
||||
Me.GdViewer.HQAnnotationRendering = True
|
||||
Me.GdViewer.IgnoreDocumentResolution = False
|
||||
Me.GdViewer.KeepDocumentPosition = False
|
||||
Me.GdViewer.Location = New System.Drawing.Point(0, 33)
|
||||
Me.GdViewer.LockViewer = False
|
||||
Me.GdViewer.MagnifierHeight = 90
|
||||
Me.GdViewer.MagnifierWidth = 160
|
||||
Me.GdViewer.MagnifierZoomX = 2.0!
|
||||
Me.GdViewer.MagnifierZoomY = 2.0!
|
||||
Me.GdViewer.MouseButtonForMouseMode = GdPicture14.MouseButton.MouseButtonLeft
|
||||
Me.GdViewer.MouseMode = GdPicture14.ViewerMouseMode.MouseModePan
|
||||
Me.GdViewer.MouseWheelMode = GdPicture14.ViewerMouseWheelMode.MouseWheelModeVerticalScroll
|
||||
Me.GdViewer.Name = "GdViewer"
|
||||
Me.GdViewer.PageBordersColor = System.Drawing.Color.Black
|
||||
Me.GdViewer.PageBordersPenSize = 1
|
||||
Me.GdViewer.PageDisplayMode = GdPicture14.PageDisplayMode.MultiplePagesView
|
||||
Me.GdViewer.PdfDisplayFormField = True
|
||||
Me.GdViewer.PdfEnableFileLinks = True
|
||||
Me.GdViewer.PdfEnableLinks = True
|
||||
Me.GdViewer.PdfIncreaseTextContrast = False
|
||||
Me.GdViewer.PdfShowDialogForPassword = True
|
||||
Me.GdViewer.PdfShowOpenFileDialogForDecryption = True
|
||||
Me.GdViewer.PdfVerifyDigitalCertificates = False
|
||||
Me.GdViewer.PreserveViewRotation = True
|
||||
Me.GdViewer.RectBorderColor = System.Drawing.Color.Black
|
||||
Me.GdViewer.RectBorderSize = 1
|
||||
Me.GdViewer.RectIsEditable = True
|
||||
Me.GdViewer.RegionsAreEditable = True
|
||||
Me.GdViewer.RenderGdPictureAnnots = True
|
||||
Me.GdViewer.ScrollBars = True
|
||||
Me.GdViewer.ScrollLargeChange = CType(50, Short)
|
||||
Me.GdViewer.ScrollSmallChange = CType(1, Short)
|
||||
Me.GdViewer.SilentMode = True
|
||||
Me.GdViewer.Size = New System.Drawing.Size(1012, 557)
|
||||
Me.GdViewer.TabIndex = 0
|
||||
Me.GdViewer.TabStop = False
|
||||
Me.GdViewer.ViewRotation = System.Drawing.RotateFlipType.RotateNoneFlipNone
|
||||
Me.GdViewer.Zoom = 1.0R
|
||||
Me.GdViewer.ZoomCenterAtMousePosition = False
|
||||
Me.GdViewer.ZoomMode = GdPicture14.ViewerZoomMode.ZoomMode100
|
||||
Me.GdViewer.ZoomStep = 25
|
||||
'
|
||||
'OpenFileDialog
|
||||
'
|
||||
Me.OpenFileDialog.FileName = "OpenFileDialog1"
|
||||
@@ -355,15 +278,15 @@ Partial Class DocumentViewer
|
||||
Me.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top
|
||||
Me.barDockControlTop.Location = New System.Drawing.Point(0, 0)
|
||||
Me.barDockControlTop.Manager = Me.BarManager1
|
||||
Me.barDockControlTop.Size = New System.Drawing.Size(1012, 33)
|
||||
Me.barDockControlTop.Size = New System.Drawing.Size(841, 33)
|
||||
'
|
||||
'barDockControlBottom
|
||||
'
|
||||
Me.barDockControlBottom.CausesValidation = False
|
||||
Me.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom
|
||||
Me.barDockControlBottom.Location = New System.Drawing.Point(0, 590)
|
||||
Me.barDockControlBottom.Location = New System.Drawing.Point(0, 555)
|
||||
Me.barDockControlBottom.Manager = Me.BarManager1
|
||||
Me.barDockControlBottom.Size = New System.Drawing.Size(1012, 0)
|
||||
Me.barDockControlBottom.Size = New System.Drawing.Size(841, 0)
|
||||
'
|
||||
'barDockControlLeft
|
||||
'
|
||||
@@ -371,15 +294,15 @@ Partial Class DocumentViewer
|
||||
Me.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left
|
||||
Me.barDockControlLeft.Location = New System.Drawing.Point(0, 33)
|
||||
Me.barDockControlLeft.Manager = Me.BarManager1
|
||||
Me.barDockControlLeft.Size = New System.Drawing.Size(0, 557)
|
||||
Me.barDockControlLeft.Size = New System.Drawing.Size(0, 522)
|
||||
'
|
||||
'barDockControlRight
|
||||
'
|
||||
Me.barDockControlRight.CausesValidation = False
|
||||
Me.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right
|
||||
Me.barDockControlRight.Location = New System.Drawing.Point(1012, 33)
|
||||
Me.barDockControlRight.Location = New System.Drawing.Point(841, 33)
|
||||
Me.barDockControlRight.Manager = Me.BarManager1
|
||||
Me.barDockControlRight.Size = New System.Drawing.Size(0, 557)
|
||||
Me.barDockControlRight.Size = New System.Drawing.Size(0, 522)
|
||||
'
|
||||
'BarStaticItem1
|
||||
'
|
||||
@@ -446,7 +369,7 @@ Partial Class DocumentViewer
|
||||
Me.lbFileNotLoaded.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None
|
||||
Me.lbFileNotLoaded.Location = New System.Drawing.Point(3, 74)
|
||||
Me.lbFileNotLoaded.Name = "lbFileNotLoaded"
|
||||
Me.lbFileNotLoaded.Size = New System.Drawing.Size(1006, 72)
|
||||
Me.lbFileNotLoaded.Size = New System.Drawing.Size(835, 72)
|
||||
Me.lbFileNotLoaded.TabIndex = 0
|
||||
Me.lbFileNotLoaded.Tag = ""
|
||||
Me.lbFileNotLoaded.Text = "Die Datei konnte nicht geladen werden"
|
||||
@@ -454,28 +377,17 @@ Partial Class DocumentViewer
|
||||
'
|
||||
'RichEditControl1
|
||||
'
|
||||
Me.RichEditControl1.Location = New System.Drawing.Point(447, 271)
|
||||
Me.RichEditControl1.Location = New System.Drawing.Point(571, 238)
|
||||
Me.RichEditControl1.MenuManager = Me.BarManager1
|
||||
Me.RichEditControl1.Name = "RichEditControl1"
|
||||
Me.RichEditControl1.Size = New System.Drawing.Size(400, 200)
|
||||
Me.RichEditControl1.TabIndex = 5
|
||||
Me.RichEditControl1.Visible = False
|
||||
'
|
||||
'lblInfo
|
||||
'
|
||||
Me.lblInfo.AutoSize = True
|
||||
Me.lblInfo.ForeColor = System.Drawing.Color.Red
|
||||
Me.lblInfo.Location = New System.Drawing.Point(18, 558)
|
||||
Me.lblInfo.Name = "lblInfo"
|
||||
Me.lblInfo.Size = New System.Drawing.Size(39, 13)
|
||||
Me.lblInfo.TabIndex = 10
|
||||
Me.lblInfo.Text = "Label1"
|
||||
'
|
||||
'DocumentViewer
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.Controls.Add(Me.lblInfo)
|
||||
Me.Controls.Add(Me.RichEditControl1)
|
||||
Me.Controls.Add(Me.lbFileNotLoaded)
|
||||
Me.Controls.Add(Me.SpreadsheetControl1)
|
||||
@@ -485,7 +397,7 @@ Partial Class DocumentViewer
|
||||
Me.Controls.Add(Me.barDockControlBottom)
|
||||
Me.Controls.Add(Me.barDockControlTop)
|
||||
Me.Name = "DocumentViewer"
|
||||
Me.Size = New System.Drawing.Size(1012, 590)
|
||||
Me.Size = New System.Drawing.Size(841, 555)
|
||||
CType(Me.BarManager1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.RepositoryItemTextEdit2, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.RepositoryItemTextEdit3, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
|
||||
@@ -123,6 +123,9 @@
|
||||
<metadata name="BarManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>285, 22</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
<assembly alias="DevExpress.Data.v21.2" name="DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<data name="buttonPrint.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
@@ -55,6 +55,7 @@ Public Class DocumentViewer
|
||||
|
||||
Private _hide_file_info_from_user As Boolean = False
|
||||
|
||||
|
||||
Private _FileStream As Stream
|
||||
Private _FilePath As String
|
||||
Private _FileInfo As FileInfo
|
||||
@@ -65,6 +66,8 @@ Public Class DocumentViewer
|
||||
Private _TempFiles As New List(Of String)
|
||||
|
||||
Private Sub DocumentViewer_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
' Ensure search is initialized once the control (and GdViewer) exists
|
||||
EnsureSearchInitialized()
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
'hallo
|
||||
@@ -109,7 +112,8 @@ Public Class DocumentViewer
|
||||
_licenseKey = pLicenseKey
|
||||
_licenseManager.RegisterKEY(_licenseKey)
|
||||
_Annotations = New Annotations(pLogConfig)
|
||||
_Search = New Search(pLogConfig, GdViewer)
|
||||
' Defer creating Search until GdViewer is ready
|
||||
EnsureSearchInitialized()
|
||||
_ToolbarSettings = pToolbarSettings
|
||||
|
||||
Dim oConfigPath = ConfigPath()
|
||||
@@ -121,6 +125,17 @@ Public Class DocumentViewer
|
||||
End Try
|
||||
End Function
|
||||
|
||||
' Create the Search helper only when both the log config and the GdViewer control exist
|
||||
Private Sub EnsureSearchInitialized()
|
||||
Try
|
||||
If _Search Is Nothing AndAlso _logConfig IsNot Nothing AndAlso GdViewer IsNot Nothing Then
|
||||
_Search = New Search(_logConfig, GdViewer)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger?.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Load a file from a path and display it
|
||||
''' </summary>
|
||||
@@ -141,9 +156,8 @@ Public Class DocumentViewer
|
||||
_FileInfo = New FileInfo(FilePath)
|
||||
|
||||
_logger.Info("Loading file [{0}] from Filesystem", FilePath)
|
||||
FileLoaded = DoLoadFile(FilePath)
|
||||
|
||||
SetViewerMode(_FileInfo.Extension)
|
||||
FileLoaded = DoLoadFile(FilePath)
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
|
||||
@@ -223,7 +237,17 @@ Public Class DocumentViewer
|
||||
|
||||
Public Sub CloseDocument()
|
||||
Try
|
||||
GdViewer.CloseDocument()
|
||||
' Null-sicher schließen
|
||||
If GdViewer IsNot Nothing Then
|
||||
Try
|
||||
GdViewer.CloseDocument()
|
||||
Catch exInner As Exception
|
||||
_logger?.Warn("Fehler beim Schließen von GdViewer")
|
||||
_logger?.Error(exInner)
|
||||
End Try
|
||||
Else
|
||||
_logger?.Debug("CloseDocument: GdViewer ist Nothing – nichts zu schließen")
|
||||
End If
|
||||
|
||||
_FileInfo = Nothing
|
||||
_FilePath = Nothing
|
||||
@@ -299,25 +323,23 @@ Public Class DocumentViewer
|
||||
GdViewer.Focus()
|
||||
UpdateMainUi()
|
||||
End Sub
|
||||
Private Sub btnFirstPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonFirstPage.ItemClick
|
||||
Private Sub BtnFirstPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonFirstPage.ItemClick
|
||||
GdViewer.DisplayFirstPage()
|
||||
End Sub
|
||||
|
||||
Private Sub btnPreviousPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonPrevPage.ItemClick
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
Private Sub BtnPreviousPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonPrevPage.ItemClick
|
||||
GdViewer.DisplayPreviousPage()
|
||||
End Sub
|
||||
|
||||
Private Sub btnNextPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonNextPage.ItemClick
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
Private Sub BtnNextPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonNextPage.ItemClick
|
||||
GdViewer.DisplayNextPage()
|
||||
End Sub
|
||||
|
||||
Private Sub btnLastPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonLastPage.ItemClick
|
||||
Private Sub BtnLastPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles buttonLastPage.ItemClick
|
||||
GdViewer.DisplayLastPage()
|
||||
End Sub
|
||||
|
||||
Private Sub tbCurrentPage_Leave(ByVal sender As System.Object, ByVal e As EventArgs) Handles txtCurrentPage.EditValueChanged
|
||||
Private Sub TbCurrentPage_Leave(ByVal sender As System.Object, ByVal e As EventArgs) Handles txtCurrentPage.EditValueChanged
|
||||
Dim page As Integer = 0
|
||||
If Integer.TryParse(txtCurrentPage.EditValue, page) Then
|
||||
If page > 0 And page <= GdViewer.PageCount Then
|
||||
@@ -339,12 +361,10 @@ Public Class DocumentViewer
|
||||
End Sub
|
||||
|
||||
Private Sub btnZoomOut_Click(sender As Object, e As EventArgs) Handles buttonZoomOut.ItemClick
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
GdViewer.ZoomOUT()
|
||||
End Sub
|
||||
|
||||
Private Sub btnZoomIn_Click(sender As Object, e As EventArgs) Handles buttonZoomIn.ItemClick
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
GdViewer.ZoomIN()
|
||||
End Sub
|
||||
|
||||
@@ -356,11 +376,11 @@ Public Class DocumentViewer
|
||||
GdViewer.PrintDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub btnRotateLeft_Click(sender As Object, e As EventArgs) Handles buttonRotateLeft.ItemClick
|
||||
Private Sub BtnRotateLeft_Click(sender As Object, e As EventArgs) Handles buttonRotateLeft.ItemClick
|
||||
GdViewer.Rotate(RotateFlipType.Rotate270FlipNone)
|
||||
End Sub
|
||||
|
||||
Private Sub btnRotateRight_Click(sender As Object, e As EventArgs) Handles buttonRotateRight.ItemClick
|
||||
Private Sub BtnRotateRight_Click(sender As Object, e As EventArgs) Handles buttonRotateRight.ItemClick
|
||||
GdViewer.Rotate(RotateFlipType.Rotate90FlipNone)
|
||||
End Sub
|
||||
|
||||
@@ -385,7 +405,7 @@ Public Class DocumentViewer
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnSettings_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonSettings.ItemClick
|
||||
Private Sub BtnSettings_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonSettings.ItemClick
|
||||
Using frmSettings As New frmViewerSettings(GdViewer)
|
||||
frmSettings.ShowDialog(Me)
|
||||
End Using
|
||||
@@ -439,14 +459,18 @@ Public Class DocumentViewer
|
||||
End Sub
|
||||
|
||||
Private Sub SetViewerMode(Extension As String)
|
||||
Select Case Extension.ToUpper
|
||||
Case "CSV"
|
||||
_ViewerMode = ViewerMode.Excel
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
_ViewerMode = ViewerMode.RichText
|
||||
Case Else
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
End Select
|
||||
If _ViewOverride = "Richtext" Then
|
||||
_ViewerMode = ViewerMode.Richtext
|
||||
Else
|
||||
Select Case Extension.ToUpper
|
||||
Case "CSV"
|
||||
_ViewerMode = ViewerMode.Excel
|
||||
'Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
' _ViewerMode = ViewerMode.RichText
|
||||
Case Else
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
End Select
|
||||
End If
|
||||
End Sub
|
||||
Private Sub FreeFile()
|
||||
Try
|
||||
@@ -574,6 +598,12 @@ Public Class DocumentViewer
|
||||
End Function
|
||||
Private Function DoLoadFile(FilePath As String) As Boolean
|
||||
Try
|
||||
' Ensure the embedded GdViewer control exists before using it
|
||||
If Not EnsureViewerReady() Then
|
||||
_logger?.Warn("GdViewer control is not initialized yet. Delaying load.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
lblInfo.Visible = False
|
||||
Dim oFileInfo = New FileInfo(FilePath)
|
||||
Dim oExtension As String = oFileInfo.Extension.ToUpper
|
||||
@@ -599,46 +629,54 @@ Public Class DocumentViewer
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
oRange.AutoFitColumns()
|
||||
|
||||
SpreadsheetControl1.Visible = True
|
||||
GdViewer.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.Fill
|
||||
Else
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".CSV"
|
||||
Dim oFormat = GetSpreadsheetFormat(oExtension)
|
||||
SpreadsheetControl1.LoadDocument(FilePath, oFormat)
|
||||
If ViewOverride = "Richtext" Then
|
||||
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
|
||||
RichEditControl1.Visible = True
|
||||
GdViewer.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
_ViewOverride = "Richtext"
|
||||
_ViewerMode = ViewerMode.Richtext
|
||||
lblInfo.Visible = True
|
||||
lblInfo.Text = "This docx-file contains a generic error and will be displayed in a reduced viewer. Please try to open the file in WORD"
|
||||
Else
|
||||
_ViewOverride = ""
|
||||
Select Case oExtension.ToUpper
|
||||
Case ".CSV"
|
||||
Dim oFormat = GetSpreadsheetFormat(oExtension)
|
||||
SpreadsheetControl1.LoadDocument(FilePath, oFormat)
|
||||
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
Dim oRange = SpreadsheetControl1.ActiveWorksheet.GetUsedRange()
|
||||
oRange.AutoFitColumns()
|
||||
|
||||
SpreadsheetControl1.Visible = True
|
||||
GdViewer.Visible = False
|
||||
SpreadsheetControl1.Dock = DockStyle.Fill
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
GdViewer.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Case Else
|
||||
Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT"
|
||||
RichEditControl1.LoadDocument(FilePath, GetDocumentFormat(oExtension))
|
||||
|
||||
RichEditControl1.Visible = True
|
||||
GdViewer.Visible = False
|
||||
RichEditControl1.Dock = DockStyle.Fill
|
||||
Case Else
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
If Viewer_ForceTemporaryMode = True Then
|
||||
GdViewer.ForceTemporaryMode = True
|
||||
End If
|
||||
GdViewer.ForceTemporaryMode = True
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
If Viewer_ForceTemporaryMode = True Then
|
||||
GdViewer.ForceTemporaryMode = True
|
||||
End If
|
||||
|
||||
GdViewer.AnnotationDropShadow = True
|
||||
GdViewer.BackColor = Color.White
|
||||
GdViewer.AnnotationDropShadow = True
|
||||
GdViewer.BackColor = Color.White
|
||||
|
||||
Dim oGDPState As GdPicture14.GdPictureStatus = GdViewer.DisplayFromFile(FilePath)
|
||||
If oGDPState <> GdPictureStatus.OK Then
|
||||
_logger.Warn($"GdPictureStatus is [{oGDPState}]")
|
||||
If oExtension.ToUpper = ".DOCX" And oGDPState = GdPictureStatus.GenericError Then
|
||||
DoLoadFile(FilePath, "Richtext")
|
||||
Else
|
||||
Dim oFileName = IO.Path.GetFileName(FilePath)
|
||||
lbFileNotLoaded.Text = String.Format("Datei konnte nicht geladen werden:{0}{1}", vbCrLf, oFileName)
|
||||
Dim oGDPState As GdPicture14.GdPictureStatus = GdViewer.DisplayFromFile(FilePath)
|
||||
If oGDPState <> GdPictureStatus.OK Then
|
||||
_logger.Warn($"GdPictureStatus is [{oGDPState}]")
|
||||
If oExtension.ToUpper = ".DOCX" And oGDPState = GdPictureStatus.GenericError Then
|
||||
DoLoadFile(FilePath, "Richtext")
|
||||
Else
|
||||
Dim oFileName = IO.Path.GetFileName(FilePath)
|
||||
lbFileNotLoaded.Text = String.Format("Datei konnte nicht geladen werden:{0}{1}", vbCrLf, oFileName)
|
||||
lbFileNotLoaded.Visible = True
|
||||
End If
|
||||
|
||||
@@ -649,29 +687,60 @@ Public Class DocumentViewer
|
||||
End If
|
||||
|
||||
End Select
|
||||
End If
|
||||
|
||||
|
||||
UpdateMainUi()
|
||||
|
||||
Return True
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
' Ensures the embedded GdViewer control exists and is added to the visual tree
|
||||
Private Function EnsureViewerReady() As Boolean
|
||||
Try
|
||||
' If the control field is Nothing (e.g., designer not yet created), try to lazy-create and add it
|
||||
If GdViewer Is Nothing Then
|
||||
Private Function EnsureViewerReady() As Boolean
|
||||
Try
|
||||
' If the control field is Nothing (e.g., designer not yet created), try to lazy-create and add it
|
||||
If GdViewer Is Nothing Then
|
||||
' Attempt to find an existing instance by name in Controls collection
|
||||
Dim existing = Me.Controls.OfType(Of GdPicture14.GdViewer)().FirstOrDefault()
|
||||
If existing IsNot Nothing Then
|
||||
' Assign the designer field via reflection if needed, otherwise use it directly
|
||||
GdViewer = existing
|
||||
Else
|
||||
' Last resort: create a new viewer and add it
|
||||
Dim viewer = New GdPicture14.GdViewer()
|
||||
viewer.Dock = DockStyle.Fill
|
||||
Me.Controls.Add(viewer)
|
||||
GdViewer = viewer
|
||||
End If
|
||||
End If
|
||||
|
||||
Return GdViewer IsNot Nothing
|
||||
Catch ex As Exception
|
||||
_logger?.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub FitToPage()
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
|
||||
If Not GdViewer Is Nothing Then
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub FitToWidth()
|
||||
_ViewerMode = ViewerMode.GDPicture
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
If Not GdViewer Is Nothing Then
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function DoLoadFile(Stream As Stream, Extension As String) As Boolean
|
||||
|
||||
Try
|
||||
|
||||
SpreadsheetControl1.Visible = False
|
||||
@@ -691,7 +760,9 @@ Public Class DocumentViewer
|
||||
Case Else
|
||||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||||
GdViewer.ForceTemporaryMode = True
|
||||
If Viewer_ForceTemporaryMode = True Then
|
||||
GdViewer.ForceTemporaryMode = True
|
||||
End If
|
||||
GdViewer.AnnotationDropShadow = True
|
||||
|
||||
GdViewer.DisplayFromStream(Stream)
|
||||
@@ -838,25 +909,27 @@ Public Class DocumentViewer
|
||||
btnSearch2.Visibility = ToVisibility(False)
|
||||
btnNextHighlight.Visibility = ToVisibility(False)
|
||||
btnPrevHighlight.Visibility = ToVisibility(False)
|
||||
|
||||
|
||||
|
||||
Case Else
|
||||
ToolbarDocumentViewer.Visible = False
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub btnSearch2_ItemClick(sender As Object, e As XtraBars.ItemClickEventArgs) Handles btnSearch2.ItemClick
|
||||
If Not String.IsNullOrEmpty(txtSearch.EditValue) Then
|
||||
EnsureSearchInitialized()
|
||||
If _Search IsNot Nothing AndAlso Not String.IsNullOrEmpty(txtSearch.EditValue) Then
|
||||
_Search.SearchAll(txtSearch.EditValue?.ToString)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnPrevHighlight_ItemClick(sender As Object, e As XtraBars.ItemClickEventArgs) Handles btnPrevHighlight.ItemClick
|
||||
_Search.PrevHighlight()
|
||||
EnsureSearchInitialized()
|
||||
_Search?.PrevHighlight()
|
||||
End Sub
|
||||
|
||||
Private Sub btnNextHighlight_ItemClick(sender As Object, e As XtraBars.ItemClickEventArgs) Handles btnNextHighlight.ItemClick
|
||||
_Search.NextHighlight()
|
||||
EnsureSearchInitialized()
|
||||
_Search?.NextHighlight()
|
||||
End Sub
|
||||
|
||||
Private Sub txtSearch_EditValueChanged(sender As Object, e As EventArgs) Handles txtSearch.EditValueChanged
|
||||
|
||||
@@ -160,15 +160,9 @@
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="IndexRange, Version=1.0.3.0, Culture=neutral, PublicKeyToken=35e6a3c4212514c6, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\IndexRange.1.0.3\lib\net45\IndexRange.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
@@ -179,8 +173,8 @@
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenMcdf, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenMcdf.3.0.0\lib\netstandard2.0\OpenMcdf.dll</HintPath>
|
||||
<Reference Include="OpenMcdf, Version=2.4.1.0, Culture=neutral, PublicKeyToken=fdbb1629d7c00800, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenMcdf.2.4.1\lib\net40\OpenMcdf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@@ -234,8 +228,8 @@
|
||||
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath>
|
||||
<Reference Include="System.Text.Json, Version=8.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.8.0.6\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.2.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.2.0.0")>
|
||||
<Assembly: AssemblyVersion("2.6.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.0.0")>
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
<package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" />
|
||||
<package id="GdPicture" version="14.3.3" targetFramework="net462" />
|
||||
<package id="GdPicture.runtimes.windows" version="14.3.3" targetFramework="net462" />
|
||||
<package id="IndexRange" version="1.0.3" targetFramework="net462" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net462" />
|
||||
<package id="Microsoft.VisualBasic" version="10.3.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="OpenMcdf" version="3.0.0" targetFramework="net462" />
|
||||
<package id="OpenMcdf" version="2.4.1" targetFramework="net462" />
|
||||
<package id="protobuf-net" version="3.2.46" targetFramework="net462" />
|
||||
<package id="protobuf-net.Core" version="3.2.46" targetFramework="net462" />
|
||||
<package id="RtfPipe" version="2.0.7677.4303" targetFramework="net462" />
|
||||
@@ -28,7 +26,7 @@
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net462" />
|
||||
<package id="System.Security.Cryptography.Pkcs" version="8.0.1" targetFramework="net462" />
|
||||
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" />
|
||||
<package id="System.Text.Json" version="8.0.6" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user