diff --git a/Controls.DocumentViewer/DocumentViewer.vb b/Controls.DocumentViewer/DocumentViewer.vb index 73de12b5..1cb5431b 100644 --- a/Controls.DocumentViewer/DocumentViewer.vb +++ b/Controls.DocumentViewer/DocumentViewer.vb @@ -55,7 +55,7 @@ Public Class DocumentViewer Private _FileStream As Stream Private _FilePath As String - Private _Fileinfo As FileInfo + Private _FileInfo As FileInfo Private _FileLoadMode As FileLoadMode = FileLoadMode.File ' List of all created temp files when converting msg files @@ -109,12 +109,12 @@ Public Class DocumentViewer _FilePath = FilePath _FileLoadMode = FileLoadMode.File - _Fileinfo = New FileInfo(FilePath) + _FileInfo = New FileInfo(FilePath) _logger.Info("Loading File [{0}] from Filesystem", FilePath) FileLoaded = DoLoadFile(FilePath) - SetViewerMode(_Fileinfo.Extension) + SetViewerMode(_FileInfo.Extension) UpdateMainUi() End Sub @@ -141,10 +141,6 @@ Public Class DocumentViewer UpdateMainUi() End Sub - Private Sub SearchFile(pSearchQuery As String) - - End Sub - ''' ''' Terminate Viewer, freeing up resources and deleting temp files ''' @@ -180,8 +176,6 @@ Public Class DocumentViewer Return True End Function - - Public Function Save() As Boolean Dim oSaveResult As GdPictureStatus = GdPictureStatus.OK @@ -204,6 +198,11 @@ Public Class DocumentViewer Public Sub CloseDocument() Try GdViewer.CloseDocument() + + _FileInfo = Nothing + _FilePath = Nothing + _FileStream = Nothing + UpdateMainUi() Catch ex As Exception _logger.Error(ex) @@ -449,10 +448,10 @@ Public Class DocumentViewer End Sub Private Sub FreeFile() Try - If Len(_FilePath) = 0 OrElse _Fileinfo Is Nothing Then + If Len(_FilePath) = 0 OrElse _FileInfo Is Nothing Then Exit Sub End If - Dim oExtension As String = _Fileinfo.Extension.ToUpper + Dim oExtension As String = _FileInfo.Extension.ToUpper Select Case _ViewerMode Case ViewerMode.RichText _logger.Debug("Closing RichText Editor") @@ -641,6 +640,10 @@ Public Class DocumentViewer End Select + If _FileStream Is Nothing And _FilePath Is Nothing Then + lbFileNotLoaded.Visible = False + End If + Select Case _ViewerMode Case ViewerMode.GDPicture buttonPrint.Enabled = True