WIP: Streaming files from service to client
This commit is contained in:
@@ -15,6 +15,8 @@ Public Class Form1
|
||||
"net.tcp://172.24.12.39:9000/DigitalData/Services/Main")
|
||||
_Channel = oChannelFactory.CreateChannel()
|
||||
_Channel.Open()
|
||||
|
||||
DocumentViewer1.Init(oLogConfig, "21182889975216572111813147150675976632")
|
||||
End Sub
|
||||
|
||||
Private Sub ButtonSelectFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonSelectFiles.ItemClick
|
||||
@@ -53,7 +55,6 @@ Public Class Form1
|
||||
Dim oResult As EDMIServiceReference.DocumentResult2 = Await _Channel.ImportFileAsync(oFileInfo.Name, oContents, Environment.UserName)
|
||||
If oResult.OK Then
|
||||
listboxLog.Items.Add($"File [{oFileInfo.Name}] with Id [{oResult.Document.FileId}] imported!")
|
||||
listboxFileids.Items.Add(oResult.Document.FileId)
|
||||
Else
|
||||
listboxLog.Items.Add($"Import Error: {oResult.ErrorMessage}")
|
||||
End If
|
||||
@@ -111,4 +112,25 @@ Public Class Form1
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Async Sub ButtonLoadFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonLoadFile.ItemClick
|
||||
Try
|
||||
If TextboxObejctId.EditValue = "" Then
|
||||
MsgBox("Please enter an object id!", MsgBoxStyle.Exclamation, "Uh oh!")
|
||||
End If
|
||||
|
||||
Dim oObjectId As Integer = TextboxObejctId.EditValue
|
||||
|
||||
Dim oStream = Await _Channel.GetFileByObjectIdAsync(oObjectId)
|
||||
Dim oMemoryStream As New MemoryStream()
|
||||
oStream.CopyTo(oMemoryStream)
|
||||
oMemoryStream.Position = 0
|
||||
|
||||
listboxLog.Items.Add("Stream read!")
|
||||
|
||||
DocumentViewer1.LoadFile("textfile.png", oMemoryStream)
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Uh oh!")
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user