This commit is contained in:
JenneJ
2016-12-09 13:33:26 +01:00
parent ad3e53f887
commit fdb479cfdc
15 changed files with 96 additions and 2359 deletions

View File

@@ -16,6 +16,29 @@ Public Class ClassControlBuilder
Private _onMouseHoverName As String = "OnMouseHover"
Private _events As System.ComponentModel.EventHandlerList = Nothing
Public IsInsert As Boolean
Public IsEdit As Boolean
' +++ Constructor +++
Public Sub New(MasterPanel As Panel,
MouseDownHandler As MouseEventHandler,
MouseUpHandler As MouseEventHandler,
MouseMoveHandler As MouseEventHandler,
MouseClickHandler As EventHandler,
GroupBoxDragDropHandler As DragEventHandler)
Me._master_panel = MasterPanel
Me._mouse_down_handler = MouseDownHandler
Me._mouse_up_handler = MouseUpHandler
Me._mouse_move_handler = MouseMoveHandler
Me._mouse_click_handler = MouseClickHandler
Me._group_box_drag_drop_handler = GroupBoxDragDropHandler
End Sub
Public Sub New(MasterPanel As Panel)
Me._master_panel = MasterPanel
End Sub
Protected ReadOnly Property Events() As System.ComponentModel.EventHandlerList
Get
If _events Is Nothing Then
@@ -182,8 +205,8 @@ Public Class ClassControlBuilder
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
If CtrlCommandUI.IsEdit Then
If IsEdit Then
Dim expression As String
expression = "ENTITY_ID = " & CURRENT_ENTITY_ID
Dim foundControls() As DataRow
@@ -202,7 +225,7 @@ Public Class ClassControlBuilder
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
Me.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_TEXTBOX_SELECTED_TEXT
textbox.Text = text
@@ -213,7 +236,7 @@ Public Class ClassControlBuilder
End If
Next
End If
Catch ex As Exception
If ex.Message.Contains("Objektverweis") Or ex.Message.Contains("reference not set") Then
@@ -224,7 +247,7 @@ Public Class ClassControlBuilder
CURRENT_RECORD_ENABLED = True
End Try
End Sub
Public Sub OnComboBoxFocus(sender As Object, ByVal e As EventArgs)
Dim combo As CustomComboBox = sender
combo.BackColor = Color.LemonChiffon
@@ -260,7 +283,7 @@ Public Class ClassControlBuilder
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = row.Item("GUID")
'Dim panel As Panel = DirectCast(control.Parent, Panel)
Dim panel As Panel = CtrlBuilder.MasterPanel
Dim panel As Panel = Me.MasterPanel
' Über die Id das Control finden
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
@@ -369,7 +392,7 @@ Public Class ClassControlBuilder
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = row.Item("GUID")
Dim panel As Panel = CtrlBuilder.MasterPanel
Dim panel As Panel = Me.MasterPanel
'Dim panel As Panel = DirectCast(control.Parent, Panel)
' Über die Id das Control finden
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
@@ -438,7 +461,11 @@ Public Class ClassControlBuilder
'ClassControlValues.LoadControlValue(CURRENT_RECORD_ID, CURRENT_PARENT_RECORD_ID, dependingControlId, dependingControl, values, CURRENT_ENTITY_ID)
ControlLoader.CheckedListBox.LoadValue(checkedlistbox, values)
If IsEdit Or IsInsert Then
CURRENT_RECORD_ENABLED = True
End If
Case "Label"
If dt.Rows.Count = 1 Then
@@ -516,7 +543,7 @@ Public Class ClassControlBuilder
If String.IsNullOrEmpty(value) Then
Exit Sub
End If
If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
If CURRENT_RECORD_ID = 0 And IsInsert = True Then
Exit Sub
End If
@@ -557,7 +584,7 @@ Public Class ClassControlBuilder
Dim combo As CustomComboBox = DirectCast(control, CustomComboBox)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
CONTROL_ID = controlId
If CtrlCommandUI.IsEdit Then
If IsEdit Then
Dim expression As String
expression = "ENTITY_ID = " & CURRENT_ENTITY_ID
Dim foundControls() As DataRow
@@ -575,7 +602,7 @@ Public Class ClassControlBuilder
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
CtrlBuilder.ControlsChanged.Remove(controlId)
Me.ControlsChanged.Remove(controlId)
' Y U NO WORK??
Dim text = CURRENT_COMBOBOX_SELECTED_TEXT
combo.SelectedIndex = -1
@@ -624,7 +651,7 @@ Public Class ClassControlBuilder
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
If CURRENT_RECORD_ID = 0 And IsInsert = True Then
CURRENT_RECORD_ENABLED = True
Exit Sub
End If
@@ -653,7 +680,7 @@ Public Class ClassControlBuilder
CONTROL_ID = controlId
control.Update()
If CtrlCommandUI.IsEdit Then
If IsEdit Then
Dim expression As String
expression = "ENTITY_ID = " & CURRENT_ENTITY_ID
Dim foundControls() As DataRow
@@ -672,7 +699,7 @@ Public Class ClassControlBuilder
result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.No Then
RIGHT_CONTROL_CHANGED = False
CtrlBuilder.ControlsChanged.Remove(controlId)
Me.ControlsChanged.Remove(controlId)
Dim loadedValues As List(Of Object) = (From row In CURRENT_CONTROL_VALUES.AsEnumerable()
Where row.Item("CONTROL_ID") = controlId
@@ -803,9 +830,12 @@ Public Class ClassControlBuilder
Exit Sub
End Try
If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
If CURRENT_RECORD_ID = 0 Then
Exit Sub
End If
'If CURRENT_RECORD_ID = 0 And CtrlCommandUI.IsInsert = True Then
' Exit Sub
'End If
Dim datatable1 As DataTable = ClassDatabase.Return_Datatable(SQLenable)
@@ -1049,26 +1079,6 @@ Public Class ClassControlBuilder
controls.Remove(control)
End Sub
' +++ Constructor +++
Public Sub New(MasterPanel As Panel,
MouseDownHandler As MouseEventHandler,
MouseUpHandler As MouseEventHandler,
MouseMoveHandler As MouseEventHandler,
MouseClickHandler As EventHandler,
GroupBoxDragDropHandler As DragEventHandler)
Me._master_panel = MasterPanel
Me._mouse_down_handler = MouseDownHandler
Me._mouse_up_handler = MouseUpHandler
Me._mouse_move_handler = MouseMoveHandler
Me._mouse_click_handler = MouseClickHandler
Me._group_box_drag_drop_handler = GroupBoxDragDropHandler
End Sub
Public Sub New(MasterPanel As Panel)
Me._master_panel = MasterPanel
End Sub
' +++ Public Properties +++
Public Property CurrentControl As Control
Get
@@ -1150,7 +1160,7 @@ Public Class ClassControlBuilder
control.SelectAll()
End If
End If
'Dim i = IsValidCurrency(control.Text)
'If IsValidCurrency(control.Text) = False Then
' MsgBox("Sorry but some input characters are invalid for the format currency!", MsgBoxStyle.Exclamation)