Monorepo/GUIs.ZooFlow/frmtest.vb
2021-03-19 14:03:33 +01:00

56 lines
2.0 KiB
VB.net

Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.EDMI.API
Imports System.IO
Imports System.Text
Public Class frmtest
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
My.Settings.Save()
Dim oString As String
oString = _Client.NewFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text)
txtIDBFOPath.Text = oString
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim oString As String
oString = _Client.NewIDB_OBJ_ID("DOC", My.Application.User.UserName, "")
txtIDB_OBJ_ID.Text = oString
End Sub
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Try
Dim oResult As Boolean = False
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
Dim oContents(oStream.Length) As Byte
oStream.Read(oContents, 0, oStream.Length)
oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
End Using
If oResult = False Then
MsgBox("Oh no error", MsgBoxStyle.Critical)
Else
MsgBox("#Nailedit")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Using oInputStream As New FileStream(txtIDBFOPath.Text, FileMode.Open)
Dim oContents(oInputStream.Length) As Byte
oInputStream.Read(oContents, 0, oInputStream.Length)
' convert string to stream
Using oMemoryStream As New MemoryStream(oContents)
Using oFileStream As New FileStream("d:\file.txt", FileMode.Create, FileAccess.Write)
oMemoryStream.WriteTo(oFileStream)
End Using
End Using
End Using
End Sub
End Class