From 321c8fe4987794c67b36caf12d5f9b2277fd6259 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 30 Jun 2021 14:48:13 +0200 Subject: [PATCH] ZooFlow: Improve frmTest --- GUIs.ZooFlow/frmtest.Designer.vb | 213 ++++++++++++++++--------------- GUIs.ZooFlow/frmtest.vb | 111 ++++++++-------- 2 files changed, 162 insertions(+), 162 deletions(-) diff --git a/GUIs.ZooFlow/frmtest.Designer.vb b/GUIs.ZooFlow/frmtest.Designer.vb index 48c1a7e5..442f0551 100644 --- a/GUIs.ZooFlow/frmtest.Designer.vb +++ b/GUIs.ZooFlow/frmtest.Designer.vb @@ -22,17 +22,9 @@ Partial Class frmtest 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. _ Private Sub InitializeComponent() - Me.txtFilestoreType = New System.Windows.Forms.TextBox() - Me.Button1 = New System.Windows.Forms.Button() - Me.txtIDBFOPath = New System.Windows.Forms.TextBox() - Me.txtDate = New System.Windows.Forms.TextBox() Me.Label2 = New System.Windows.Forms.Label() - Me.Label3 = New System.Windows.Forms.Label() - Me.Button2 = New System.Windows.Forms.Button() Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox() - Me.Button3 = New System.Windows.Forms.Button() Me.txtFile2Import = New System.Windows.Forms.TextBox() - Me.Label1 = New System.Windows.Forms.Label() Me.Button4 = New System.Windows.Forms.Button() Me.Button5 = New System.Windows.Forms.Button() Me.CheckBoxKeepExtension = New System.Windows.Forms.CheckBox() @@ -40,103 +32,45 @@ Partial Class frmtest Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.Button7 = New System.Windows.Forms.Button() Me.Button8 = New System.Windows.Forms.Button() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label5 = New System.Windows.Forms.Label() + Me.cmbObjectStoreType = New System.Windows.Forms.ComboBox() + Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() + Me.Label6 = New System.Windows.Forms.Label() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.GroupBox1.SuspendLayout() Me.SuspendLayout() ' - 'txtFilestoreType - ' - Me.txtFilestoreType.Location = New System.Drawing.Point(16, 62) - Me.txtFilestoreType.Name = "txtFilestoreType" - Me.txtFilestoreType.Size = New System.Drawing.Size(100, 20) - Me.txtFilestoreType.TabIndex = 2 - ' - 'Button1 - ' - Me.Button1.Location = New System.Drawing.Point(152, 58) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(137, 23) - Me.Button1.TabIndex = 3 - Me.Button1.Text = "2. GetFileName" - Me.Button1.UseVisualStyleBackColor = True - ' - 'txtIDBFOPath - ' - Me.txtIDBFOPath.Location = New System.Drawing.Point(152, 87) - Me.txtIDBFOPath.Name = "txtIDBFOPath" - Me.txtIDBFOPath.ReadOnly = True - Me.txtIDBFOPath.Size = New System.Drawing.Size(495, 20) - Me.txtIDBFOPath.TabIndex = 4 - ' - 'txtDate - ' - Me.txtDate.Location = New System.Drawing.Point(16, 101) - Me.txtDate.Name = "txtDate" - Me.txtDate.Size = New System.Drawing.Size(100, 20) - Me.txtDate.TabIndex = 5 - ' 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(16, 43) + Me.Label2.Location = New System.Drawing.Point(9, 66) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(72, 13) Me.Label2.TabIndex = 6 Me.Label2.Text = "FileStoreType" ' - 'Label3 - ' - Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(16, 85) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(30, 13) - Me.Label3.TabIndex = 7 - Me.Label3.Text = "Date" - ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(12, 12) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(277, 23) - Me.Button2.TabIndex = 8 - Me.Button2.Text = "1. Get IDB_OBJ_ID" - Me.Button2.UseVisualStyleBackColor = True - ' 'txtIDB_OBJ_ID ' Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) - Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(295, 14) + Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(137, 38) Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID" Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20) Me.txtIDB_OBJ_ID.TabIndex = 9 Me.txtIDB_OBJ_ID.Text = Global.DigitalData.GUIs.ZooFlow.Settings.Default.IDBOBJID ' - 'Button3 - ' - Me.Button3.Location = New System.Drawing.Point(16, 188) - Me.Button3.Name = "Button3" - Me.Button3.Size = New System.Drawing.Size(175, 23) - Me.Button3.TabIndex = 10 - Me.Button3.Text = "3. Import/StreamFile" - Me.Button3.UseVisualStyleBackColor = True - ' 'txtFile2Import ' - Me.txtFile2Import.Location = New System.Drawing.Point(16, 162) + Me.txtFile2Import.Location = New System.Drawing.Point(137, 12) Me.txtFile2Import.Name = "txtFile2Import" - Me.txtFile2Import.Size = New System.Drawing.Size(551, 20) + Me.txtFile2Import.Size = New System.Drawing.Size(426, 20) Me.txtFile2Import.TabIndex = 11 ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(16, 143) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(58, 13) - Me.Label1.TabIndex = 12 - Me.Label1.Text = "File2Import" - ' 'Button4 ' - Me.Button4.Location = New System.Drawing.Point(16, 234) + Me.Button4.Location = New System.Drawing.Point(16, 345) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(286, 23) Me.Button4.TabIndex = 13 @@ -145,7 +79,7 @@ Partial Class frmtest ' 'Button5 ' - Me.Button5.Location = New System.Drawing.Point(16, 263) + Me.Button5.Location = New System.Drawing.Point(16, 374) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(286, 23) Me.Button5.TabIndex = 14 @@ -155,7 +89,9 @@ Partial Class frmtest 'CheckBoxKeepExtension ' Me.CheckBoxKeepExtension.AutoSize = True - Me.CheckBoxKeepExtension.Location = New System.Drawing.Point(307, 62) + Me.CheckBoxKeepExtension.Checked = True + Me.CheckBoxKeepExtension.CheckState = System.Windows.Forms.CheckState.Checked + Me.CheckBoxKeepExtension.Location = New System.Drawing.Point(16, 19) Me.CheckBoxKeepExtension.Name = "CheckBoxKeepExtension" Me.CheckBoxKeepExtension.Size = New System.Drawing.Size(100, 17) Me.CheckBoxKeepExtension.TabIndex = 15 @@ -164,7 +100,7 @@ Partial Class frmtest ' 'Button6 ' - Me.Button6.Location = New System.Drawing.Point(572, 160) + Me.Button6.Location = New System.Drawing.Point(569, 9) Me.Button6.Name = "Button6" Me.Button6.Size = New System.Drawing.Size(75, 23) Me.Button6.TabIndex = 16 @@ -177,7 +113,7 @@ Partial Class frmtest ' 'Button7 ' - Me.Button7.Location = New System.Drawing.Point(16, 292) + Me.Button7.Location = New System.Drawing.Point(16, 403) Me.Button7.Name = "Button7" Me.Button7.Size = New System.Drawing.Size(286, 23) Me.Button7.TabIndex = 14 @@ -186,52 +122,115 @@ Partial Class frmtest ' 'Button8 ' - Me.Button8.Location = New System.Drawing.Point(666, 14) + Me.Button8.Location = New System.Drawing.Point(12, 142) Me.Button8.Name = "Button8" Me.Button8.Size = New System.Drawing.Size(187, 23) Me.Button8.TabIndex = 17 - Me.Button8.Text = "1B. All-In-One" + Me.Button8.Text = "Import File" Me.Button8.UseVisualStyleBackColor = True ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(9, 14) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(48, 13) + Me.Label4.TabIndex = 18 + Me.Label4.Text = "File Path" + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(9, 41) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(47, 13) + Me.Label5.TabIndex = 18 + Me.Label5.Text = "ObjectId" + ' + 'cmbObjectStoreType + ' + Me.cmbObjectStoreType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cmbObjectStoreType.FormattingEnabled = True + Me.cmbObjectStoreType.Items.AddRange(New Object() {"Work", "Archive"}) + Me.cmbObjectStoreType.Location = New System.Drawing.Point(137, 63) + Me.cmbObjectStoreType.Name = "cmbObjectStoreType" + Me.cmbObjectStoreType.Size = New System.Drawing.Size(121, 21) + Me.cmbObjectStoreType.TabIndex = 19 + ' + 'DateTimePicker1 + ' + Me.DateTimePicker1.Location = New System.Drawing.Point(137, 90) + Me.DateTimePicker1.Name = "DateTimePicker1" + Me.DateTimePicker1.Size = New System.Drawing.Size(200, 20) + Me.DateTimePicker1.TabIndex = 20 + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(9, 96) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(30, 13) + Me.Label6.TabIndex = 6 + Me.Label6.Text = "Date" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(137, 183) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(426, 20) + Me.TextBox1.TabIndex = 21 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(9, 186) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(98, 13) + Me.Label1.TabIndex = 18 + Me.Label1.Text = "File Path (Imported)" + ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.CheckBoxKeepExtension) + Me.GroupBox1.Location = New System.Drawing.Point(653, 12) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(200, 100) + Me.GroupBox1.TabIndex = 22 + Me.GroupBox1.TabStop = False + Me.GroupBox1.Text = "Import Options" + ' 'frmtest ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(865, 450) + Me.Controls.Add(Me.GroupBox1) + Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.DateTimePicker1) + Me.Controls.Add(Me.cmbObjectStoreType) + Me.Controls.Add(Me.Label5) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Button8) Me.Controls.Add(Me.Button6) - Me.Controls.Add(Me.CheckBoxKeepExtension) Me.Controls.Add(Me.Button7) Me.Controls.Add(Me.Button5) Me.Controls.Add(Me.Button4) - Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.txtFile2Import) - Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.txtIDB_OBJ_ID) - Me.Controls.Add(Me.Button2) - Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.Label2) - Me.Controls.Add(Me.txtDate) - Me.Controls.Add(Me.txtIDBFOPath) - Me.Controls.Add(Me.Button1) - Me.Controls.Add(Me.txtFilestoreType) Me.Name = "frmtest" Me.Text = "frmtest" + Me.GroupBox1.ResumeLayout(False) + Me.GroupBox1.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub - Friend WithEvents txtFilestoreType As TextBox - Friend WithEvents Button1 As Button - Friend WithEvents txtIDBFOPath As TextBox - Friend WithEvents txtDate As TextBox Friend WithEvents Label2 As Label - Friend WithEvents Label3 As Label - Friend WithEvents Button2 As Button Friend WithEvents txtIDB_OBJ_ID As TextBox - Friend WithEvents Button3 As Button Friend WithEvents txtFile2Import As TextBox - Friend WithEvents Label1 As Label Friend WithEvents Button4 As Button Friend WithEvents Button5 As Button Friend WithEvents CheckBoxKeepExtension As CheckBox @@ -239,4 +238,12 @@ Partial Class frmtest Friend WithEvents OpenFileDialog1 As OpenFileDialog Friend WithEvents Button7 As Button Friend WithEvents Button8 As Button + Friend WithEvents Label4 As Label + Friend WithEvents Label5 As Label + Friend WithEvents cmbObjectStoreType As ComboBox + Friend WithEvents DateTimePicker1 As DateTimePicker + Friend WithEvents Label6 As Label + Friend WithEvents TextBox1 As TextBox + Friend WithEvents Label1 As Label + Friend WithEvents GroupBox1 As GroupBox End Class diff --git a/GUIs.ZooFlow/frmtest.vb b/GUIs.ZooFlow/frmtest.vb index 1d42098a..0ca0bb49 100644 --- a/GUIs.ZooFlow/frmtest.vb +++ b/GUIs.ZooFlow/frmtest.vb @@ -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 - - 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) 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 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) - 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 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(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 \ No newline at end of file