Monorepo/GUIs.ZooFlow/frmtest.vb

73 lines
2.6 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
Dim oextension = ""
Dim oKeepExtension As Boolean = False
If CheckBoxKeepExtension.Checked Then
If txtFile2Import.Text <> String.Empty Then
oextension = Path.GetExtension(txtFile2Import.Text)
oKeepExtension = True
End If
End If
oString = _Client.NewFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
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, System.Convert.ToInt32(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
Try
Using oInputStream As New FileStream(txtIDBFOPath.Text, FileMode.Open)
Dim oextension = Path.GetExtension(txtFile2Import.Text)
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($"E:\file.{oextension}", FileMode.Create, FileAccess.Write)
oMemoryStream.WriteTo(oFileStream)
End Using
End Using
End Using
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class