Monorepo/GUIs.ZooFlow/frmtest.vb

137 lines
5.1 KiB
VB.net

Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.EDMI.API
Imports System.IO
Imports System.Text
Imports DigitalData.Modules.EDMI.API.Client
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 oObjectId As Long = Await My.Application.Service.Client.NewFileAsync(
txtFile2Import.Text,
"WORK",
"DOC",
"DEFAULT",
New NewFileOptions With {
.Username = Environment.UserName,
.DateImported = DateTimePicker1.Value
}
)
If oObjectId <> INVALID_OBEJCT_ID Then
MsgBox("File Imported!", MsgBoxStyle.Information, Text)
Else
MsgBox("File was not imported. Check the server logs!")
End If
txtIDB_OBJ_ID.Text = oObjectId
End Sub
Private Sub frmtest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cmbObjectStoreType.SelectedIndex = 0
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
Dim oValue = My.Application.Service.Client.GetVariableValue(txtIDB_OBJ_ID.Text, txtAttributeName.Text)
If oValue.Type Is Nothing Then
ListBox1.Items.Add("Value is nothing")
Else
ListBox1.Items.Add(oValue.Value)
txtAttibuteValue.Text = oValue.Value
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class