ZooFlow: Improve frmTest

This commit is contained in:
Jonathan Jenne
2021-06-30 14:48:13 +02:00
parent 5a0febe8f2
commit 321c8fe498
2 changed files with 156 additions and 156 deletions

View File

@@ -5,56 +5,56 @@ 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
'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 If
' oString = My.Application.Service.Client.CreateFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
' txtIDBFOPath.Text = oString
End Sub
'End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim oString As String
oString = My.Application.Service.Client.CreateObjectId("DOC", My.Application.User.UserName, "")
txtIDB_OBJ_ID.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) Handles Button3.Click
Try
Dim oResult As Boolean = False
'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
' 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
' 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(txtIDBFOPath.Text, FileMode.Open)
Using oInputStream As New FileStream(TextBox1.Text, FileMode.Open)
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oInputStream.CopyTo(oFileStream)
End Using
@@ -91,33 +91,26 @@ Public Class frmtest
Dim oExt = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oExt}"
File.Copy(txtIDBFOPath.Text, oFile)
File.Copy(TextBox1.Text, oFile)
End Sub
Private Async Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If OpenFileDialog1.ShowDialog() <> DialogResult.OK Then
Exit Sub
End If
txtFile2Import.Text = OpenFileDialog1.FileName
Dim oResult As FileMeta = Await My.Application.Service.Client.NewFileAsync(
Dim oResult As Long = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text,
Environment.UserName,
Date.Now,
"WORK",
DateTimePicker1.Value,
cmbObjectStoreType.Text,
"DEFAULT",
New Client.ImportFileOptions With {
.KeepExtension = True
}
)
MsgBox($"File saved to: [{oResult.FilePath}]")
'oResult = Await My.Application.Service.Client.ImportFileObjectAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
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