Modules/GUIs.ZooFlow/frmtest.vb
2021-07-02 16:10:00 +02:00

116 lines
4.3 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)
' 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 = My.Application.Service.Client.CreateFileStoreObject(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)
' Dim oString As String
' oString = My.Application.Service.Client.CreateObjectId("DOC", My.Application.User.UserName, "")
' txtIDB_OBJ_ID.Text = oString
'End Sub
'Private Async Sub Button3_Click(sender As Object, e As EventArgs)
' Try
' Dim oResult As Boolean = False
' Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
' Using oMemoryStream As New MemoryStream
' oStream.CopyTo(oMemoryStream)
' Dim oContents As Byte() = oMemoryStream.ToArray()
' oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, "WORK", txtIDBFOPath.Text)
' End Using
' 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
Dim oextension = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oextension}"
Using oInputStream As New FileStream(TextBox1.Text, FileMode.Open)
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oInputStream.CopyTo(oFileStream)
End Using
End Using
Dim oPAth = Path.GetDirectoryName(oFile)
MsgBox($"File [{oFile}] created!", MsgBoxStyle.Information)
Process.Start(oPAth)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Try
Dim wFile As System.IO.FileStream
Dim byteData() As Byte
Dim oextension = Path.GetExtension(txtFile2Import.Text)
byteData = Encoding.ASCII.GetBytes(txtFile2Import.Text)
wFile = New FileStream($"E:\file{oextension}", FileMode.Append)
wFile.Write(byteData, 0, byteData.Length)
wFile.Close()
Catch ex As IOException
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
txtFile2Import.Text = OpenFileDialog1.FileName
End If
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Dim oExt = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oExt}"
File.Copy(TextBox1.Text, oFile)
End Sub
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Dim oResult As Long = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text,
Environment.UserName,
DateTimePicker1.Value,
cmbObjectStoreType.Text,
"DEFAULT",
New Client.NewFileOptions With {
.KeepExtension = True
}
)
txtIDB_OBJ_ID.Text = oResult
MsgBox("File Imported!")
End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmbObjectStoreType.SelectedIndex = 0
End Sub
End Class