diff --git a/Controls.SnapPanel/PanelSnap.vb b/Controls.SnapPanel/PanelSnap.vb new file mode 100644 index 00000000..bee9b741 --- /dev/null +++ b/Controls.SnapPanel/PanelSnap.vb @@ -0,0 +1,3 @@ +Public Class Class1 + +End Class diff --git a/Controls.SnapPanel/SnapPanel.vbproj b/Controls.SnapPanel/SnapPanel.vbproj new file mode 100644 index 00000000..ce4dd27d --- /dev/null +++ b/Controls.SnapPanel/SnapPanel.vbproj @@ -0,0 +1,8 @@ + + + + Controls.SnapPanel + netstandard2.0 + + + diff --git a/GUIs.ZooFlow/frmtest.Designer.vb b/GUIs.ZooFlow/frmtest.Designer.vb index bf4ee5fc..be41bd4a 100644 --- a/GUIs.ZooFlow/frmtest.Designer.vb +++ b/GUIs.ZooFlow/frmtest.Designer.vb @@ -31,8 +31,10 @@ Partial Class frmtest Me.Button2 = New System.Windows.Forms.Button() Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox() Me.Button3 = New System.Windows.Forms.Button() - Me.TextBox1 = New System.Windows.Forms.TextBox() + 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.SuspendLayout() ' 'txtFilestoreType @@ -111,12 +113,12 @@ Partial Class frmtest Me.Button3.Text = "3. Import/StreamFile" Me.Button3.UseVisualStyleBackColor = True ' - 'TextBox1 + 'txtFile2Import ' - Me.TextBox1.Location = New System.Drawing.Point(16, 162) - Me.TextBox1.Name = "TextBox1" - Me.TextBox1.Size = New System.Drawing.Size(631, 20) - Me.TextBox1.TabIndex = 11 + Me.txtFile2Import.Location = New System.Drawing.Point(16, 162) + Me.txtFile2Import.Name = "txtFile2Import" + Me.txtFile2Import.Size = New System.Drawing.Size(631, 20) + Me.txtFile2Import.TabIndex = 11 ' 'Label1 ' @@ -127,13 +129,33 @@ Partial Class frmtest Me.Label1.TabIndex = 12 Me.Label1.Text = "File2Import" ' + 'Button4 + ' + Me.Button4.Location = New System.Drawing.Point(19, 234) + Me.Button4.Name = "Button4" + Me.Button4.Size = New System.Drawing.Size(75, 23) + Me.Button4.TabIndex = 13 + Me.Button4.Text = "Button4" + Me.Button4.UseVisualStyleBackColor = True + ' + 'Button5 + ' + Me.Button5.Location = New System.Drawing.Point(332, 218) + Me.Button5.Name = "Button5" + Me.Button5.Size = New System.Drawing.Size(75, 23) + Me.Button5.TabIndex = 14 + Me.Button5.Text = "Button5" + Me.Button5.UseVisualStyleBackColor = True + ' 'frmtest ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.Button5) + Me.Controls.Add(Me.Button4) Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.txtFile2Import) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.txtIDB_OBJ_ID) Me.Controls.Add(Me.Button2) @@ -158,6 +180,8 @@ Partial Class frmtest Friend WithEvents Button2 As Button Friend WithEvents txtIDB_OBJ_ID As TextBox Friend WithEvents Button3 As Button - Friend WithEvents TextBox1 As TextBox + Friend WithEvents txtFile2Import As TextBox Friend WithEvents Label1 As Label + Friend WithEvents Button4 As Button + Friend WithEvents Button5 As Button End Class diff --git a/GUIs.ZooFlow/frmtest.vb b/GUIs.ZooFlow/frmtest.vb index 1d172292..a693dd87 100644 --- a/GUIs.ZooFlow/frmtest.vb +++ b/GUIs.ZooFlow/frmtest.vb @@ -2,6 +2,7 @@ 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 @@ -18,19 +19,34 @@ Public Class frmtest End Sub Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click - Dim oResult As Boolean - Dim oStream As New FileStream(TextBox1.Text, FileMode.Open) - Dim oContents(oStream.Length) As Byte - Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length) + Try + Dim oResult As Boolean + Dim oStream As New FileStream(txtFile2Import.Text, FileMode.Open) + Dim oContents(oStream.Length) As Byte + 'Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length) + oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text) + If oResult = False Then + MsgBox("Oh no error", MsgBoxStyle.Critical) + Else + MsgBox("#Nailedit") + End If + Catch ex As Exception + MsgBox(ex.Message) + End Try - oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text) - If oResult = False Then - MsgBox("Oh no error", MsgBoxStyle.Critical) - Else - MsgBox("#Nailedit") + End Sub - End If + Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click + Dim memString As String = "Memory test string !!!" + ' convert string to stream + Dim buffer As Byte() = Encoding.ASCII.GetBytes(memString) + Dim ms As New MemoryStream(buffer) + 'write to file + Dim file As New FileStream("d:\file.txt", FileMode.Create, FileAccess.Write) + ms.WriteTo(file) + file.Close() + ms.Close() End Sub End Class \ No newline at end of file diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index e3c3411e..89f29b85 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -315,7 +315,7 @@ Public Class Client Catch ex As Exception _logger.Error(ex) - Throw ex + Return False End Try End Function End Class diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index f498fbc8..1ffd4ade 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -577,7 +577,7 @@ Public Class EDMIService End Using ' insert into db - Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath},'{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}" + Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath}','{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}" Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL) diff --git a/SnapPanel.vb b/SnapPanel.vb new file mode 100644 index 00000000..84cce600 --- /dev/null +++ b/SnapPanel.vb @@ -0,0 +1,58 @@ +Imports Microsoft.VisualBasic + +Public Class ClassSnapPanel + Inherits System.Windows.Forms.Panel + + Private _ShowGrid As Boolean = True + Private _GridSize As Integer = 16 + + Private Property AutoScaleMode As AutoScaleMode + + Public Property GridSize As Integer + Get + Return _GridSize + End Get + Set(value As Integer) + _GridSize = value + Refresh() + End Set + End Property + + Public Property ShowGrid As Boolean + Get + Return _ShowGrid + End Get + Set(value As Boolean) + _ShowGrid = value + Refresh() + End Set + End Property + + Protected Overrides Sub OnControlAdded(e As System.Windows.Forms.ControlEventArgs) + AddHandler e.Control.LocationChanged, AddressOf AlignToGrid + AddHandler e.Control.DragDrop, AddressOf AlignToGrid + MyBase.OnControlAdded(e) + End Sub + + Protected Overrides Sub OnControlRemoved(e As System.Windows.Forms.ControlEventArgs) + RemoveHandler e.Control.LocationChanged, AddressOf AlignToGrid + RemoveHandler e.Control.DragDrop, AddressOf AlignToGrid + MyBase.OnControlRemoved(e) + End Sub + + Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs) + If _ShowGrid Then + ControlPaint.DrawGrid(e.Graphics, ClientRectangle, New Size(_GridSize, _GridSize), BackColor) + End If + MyBase.OnPaint(e) + End Sub + + Private Sub AlignToGrid(sender As Object, e As EventArgs) + If _ShowGrid Then + Dim item As Control = CType(sender, Control) + Dim x As Integer = Math.Round(item.Left / _GridSize) * _GridSize + Dim y As Integer = Math.Round(item.Top / _GridSize) * _GridSize + item.Location = New Point(x, y) + End If + End Sub +End Class