diff --git a/Controls.DocumentViewer/DocumentViewer.vb b/Controls.DocumentViewer/DocumentViewer.vb index 694540c2..e0cd5783 100644 --- a/Controls.DocumentViewer/DocumentViewer.vb +++ b/Controls.DocumentViewer/DocumentViewer.vb @@ -29,6 +29,7 @@ Public Class DocumentViewer Private _logger As Logger Private _hide_file_info_from_user As Boolean = False + Private _FilePath As String ' List of all created temp files when converting msg files Private _TempFiles As New List(Of String) @@ -72,6 +73,7 @@ Public Class DocumentViewer ''' Public Sub Done() DeleteTempFiles() + FreeFile() End Sub ''' @@ -87,7 +89,7 @@ Public Class DocumentViewer _logger.Info("Loading File {0}", FilePath) DoLoadFile(FilePath) - + _FilePath = FilePath UpdateMainUi() End Sub @@ -121,7 +123,27 @@ Public Class DocumentViewer Next _TempFiles.Clear() End Sub + Private Sub FreeFile() + Try + Dim oFileInfo = New IO.FileInfo(_FilePath) + Dim oExtension As String = oFileInfo.Extension.ToUpper + Select Case oExtension.ToUpper + Case ".MSG" + RichEditControl1.CreateNewDocument() + + + Case ".EML", ".DOC", ".DOCX", ".ODT", ".RTF", ".TXT" + RichEditControl1.CreateNewDocument() + Case ".XLSX", ".XLS", "CSV" + SpreadsheetControl1.CreateNewDocument() + Case Else + GdViewer.CloseDocument() + End Select + Catch ex As Exception + _logger.Warn($"Unexpected error in FreeFile: {ex.Message}") + End Try + End Sub Private Sub DoLoadFile(FilePath As String) Try Dim oFileInfo = New IO.FileInfo(FilePath) diff --git a/Controls.DocumentViewer/My Project/AssemblyInfo.vb b/Controls.DocumentViewer/My Project/AssemblyInfo.vb index 4b20ec8f..376da049 100644 --- a/Controls.DocumentViewer/My Project/AssemblyInfo.vb +++ b/Controls.DocumentViewer/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + +