diff --git a/GUIs.Common/Common.vbproj b/GUIs.Common/Common.vbproj
index e7ec975b..07dbebca 100644
--- a/GUIs.Common/Common.vbproj
+++ b/GUIs.Common/Common.vbproj
@@ -20,6 +20,7 @@
bin\Debug\
DigitalData.GUIs.Common.xml
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ AnyCPU
pdbonly
diff --git a/GUIs.Common/DocumentResultList/DocumentLoader.vb b/GUIs.Common/DocumentResultList/DocumentLoader.vb
index 5ed3dcdb..9cd761bb 100644
--- a/GUIs.Common/DocumentResultList/DocumentLoader.vb
+++ b/GUIs.Common/DocumentResultList/DocumentLoader.vb
@@ -4,6 +4,7 @@ Imports DigitalData.Modules.EDMI.API.Client
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow.Constants
+Imports DigitalData.Modules.ZooFlow.State
Public Class DocumentLoader
Inherits Modules.ZooFlow.Base.BaseClass
@@ -27,7 +28,6 @@ Public Class DocumentLoader
Case OperationMode.WithAppServer
Return Load_FromIDB(pObjectId)
-
Case OperationMode.ZooFlow
Return Load_FromZooflow(pObjectId)
@@ -49,20 +49,30 @@ Public Class DocumentLoader
End Function
Private Function Load_FromIDB(pObjectId As Long) As DocumentResultInfo
- Dim oDocumentInfo As DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
- Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
- Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
- .Contents = Load_FromDisk(oDocumentInfo.FullPath),
- .AccessRight = oDocumentInfo.AccessRight,
- .FullPath = oDocumentInfo.FullPath,
- .Extension = oFileInfo.Extension.Substring(1)
- }
+ Try
+ Dim oDocumentInfo As DocumentInfo = Client.GetDocumentInfo(User.UserId, pObjectId)
+ Dim oFileInfo As New FileInfo(oDocumentInfo.FullPath)
+ Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
+ .Contents = Load_FromDisk(oDocumentInfo.FullPath),
+ .AccessRight = oDocumentInfo.AccessRight,
+ .FullPath = oDocumentInfo.FullPath,
+ .Extension = oFileInfo.Extension.Substring(1)
+ }
- Return oResultDocumentInfo
+ Return oResultDocumentInfo
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return Nothing
+ End Try
End Function
Private Function Load_FromZooflow(pObjectId As Long) As DocumentResultInfo
Dim oFileObject As FileObject = Client.GetFileObject(pObjectId, pLoadFileContents:=True)
+
+ If oFileObject Is Nothing Then
+ Return Nothing
+ End If
+
Dim oResultDocumentInfo As New DocumentResultInfo(pObjectId) With {
.Contents = oFileObject._FileContents,
.Extension = oFileObject._FileExtension,
diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb
index bc1790ba..b97cc6ec 100644
--- a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb
+++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb
@@ -210,12 +210,6 @@ Public Class frmDocumentResultList
DocumentViewer1.CloseDocument()
oDocumentInfo = _documentloader.Load(oObjectId, oFullPath)
- Dim oFileName = $"{oObjectId}.{oDocumentInfo.Extension}"
-
- DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocumentInfo.Contents))
-
- ' Save reference to current
- _CurrentDocument = oDocumentInfo
' Check DocumentInfo
If IsNothing(oDocumentInfo) Then
@@ -223,6 +217,13 @@ Public Class frmDocumentResultList
Exit Sub
End If
+ Dim oFileName = $"{oObjectId}.{oDocumentInfo.Extension}"
+
+ DocumentViewer1.LoadFile(oFileName, New MemoryStream(oDocumentInfo.Contents))
+
+ ' Save reference to current
+ _CurrentDocument = oDocumentInfo
+
If oDocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
DocumentViewer1.SetViewOnly(True)
RibbonPageGroup_Export.Visible = False