This commit is contained in:
2019-10-17 16:27:29 +02:00
11 changed files with 373 additions and 304 deletions

View File

@@ -47,7 +47,7 @@ Public Class ClassControlCreator
Public Class ControlMetadata
Public Guid As Integer
Public [ReadOnly] As Boolean
Public [ReadOnly] As Boolean = False
End Class
Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps
@@ -82,7 +82,6 @@ Public Class ClassControlCreator
.Guid = props.Guid,
.ReadOnly = props.ReadOnly
}
'ctrl.Tag = props.Guid
ctrl.Name = props.Name
ctrl.Location = props.Location
ctrl.Font = props.Font
@@ -93,7 +92,7 @@ Public Class ClassControlCreator
End If
If props.ReadOnly Then
ctrl.BackColor = Color.Gray
ctrl.BackColor = Color.LightGray
End If
Return ctrl
@@ -243,6 +242,7 @@ Public Class ClassControlCreator
control.AcceptsReturn = True
control.ReadOnly = row.Item("READ_ONLY")
control.TabStop = Not row.Item("READ_ONLY")
control.BackColor = IIf(row.Item("READ_ONLY"), Color.LightGray, Color.White)
Else
control.ReadOnly = True
End If
@@ -267,10 +267,10 @@ Public Class ClassControlCreator
If Not designMode Then
control.Enabled = Not row.Item("READ_ONLY")
control.TabStop = Not row.Item("READ_ONLY")
control.BackColor = IIf(row.Item("READ_ONLY"), Color.LightGray, Color.White)
control.AutoCompleteMode = AutoCompleteMode.SuggestAppend
control.AutoCompleteSource = AutoCompleteSource.ListItems
End If
Return control
@@ -332,6 +332,7 @@ Public Class ClassControlCreator
Public Shared Function CreateExistingLookupControl(row As DataRow, designMode As Boolean) As LookupControl2
Dim control As LookupControl2 = CreateBaseControl(New LookupControl2(), row, designMode)
control.Width = row.Item("WIDTH")
control.ReadOnly = row.Item("READ_ONLY")
If designMode Then
control.Cursor = Cursors.Hand

View File

@@ -46,12 +46,6 @@
End If
Return value
'If isVector Then
' Return $"{PREFIX_VECTOR}{value}"
'Else
' Return value
'End If
Catch ex As Exception
LOGGER.Error(ex)
MsgBox($"Error in GetValue: {ex.Message}", MsgBoxStyle.Critical)

View File

@@ -0,0 +1,23 @@
Imports System.ComponentModel
Imports System.Globalization
Public Class ClassVectorBehaviourListConverter
Inherits TypeConverter
Public Overrides Function GetStandardValuesSupported(context As ITypeDescriptorContext) As Boolean
Return True
End Function
Public Overrides Function GetStandardValues(context As ITypeDescriptorContext) As StandardValuesCollection
Dim oBehaviourList = DirectCast(context.Instance, FinalIndexProperties).VectorBehaviourType
Return New StandardValuesCollection(oBehaviourList)
End Function
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object
If IsNothing(value) Then
Return ""
Else
Return value.ToString()
End If
End Function
End Class

View File

@@ -220,6 +220,7 @@
<Compile Include="ClassSQLTypeConverter.vb" />
<Compile Include="ClassSQLValue.vb" />
<Compile Include="ClassUser.vb" />
<Compile Include="ClassVectorBehaviourListConverter.vb" />
<Compile Include="ClassWorkDoc.vb" />
<Compile Include="clsPatterns.vb" />
<Compile Include="clsWMDocGrid.vb" />

View File

@@ -65,7 +65,8 @@ Module ModuleFinalIndexProperties
<Category("Index")>
<DisplayName("IndexBehaviour")>
<PropertyAttributesProvider("IndexTypeStringProvider")>
<TypeConverter(GetType(ClassVectorBehaviourListConverter))>
<PropertyAttributesProvider("VectorIndexOnlyProvider")>
Public Property VectorBehaviour As String
<Category("Index")>
@@ -77,6 +78,8 @@ Module ModuleFinalIndexProperties
Public Property Indicies As List(Of String)
<Browsable(False)>
Public Property IndiciesType As List(Of Integer)
<Browsable(False)>
Public Property VectorBehaviourType As List(Of String)
Public Sub VectorIndexBooleanProvider(attrs As PropertyAttributes)
MaybeSetReadOnlyIfNotVectorIndex(attrs)
@@ -107,6 +110,10 @@ Module ModuleFinalIndexProperties
MaybeSetReadOnlyIfSQLHasNoValue(attrs)
End Sub
Public Sub VectorIndexOnlyProvider(attrs As PropertyAttributes)
MaybeSetBrowsable(attrs, {ClassFinalIndex.INDEX_TYPE_VECTOR_STRING})
End Sub
Public Sub MaybeSetReadOnlyIfSQLHasNoValue(attrs As PropertyAttributes)
Dim hasSQLValue As Boolean = (SQLCommand.Value <> String.Empty)

View File

@@ -2812,7 +2812,7 @@ der Wertänderungen nutzen wollen:</value>
<value>Neu hinzufügen</value>
</data>
<data name="BindingNavigatorCountItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>127, 24</value>
<value>128, 24</value>
</data>
<data name="BindingNavigatorCountItem1.Text" xml:space="preserve">
<value>von {0} finalen Indexen</value>
@@ -2978,7 +2978,7 @@ der Wertänderungen nutzen wollen:</value>
<value>9, 133</value>
</data>
<data name="BindingNavigator1.Size" type="System.Drawing.Size, System.Drawing">
<value>798, 27</value>
<value>679, 27</value>
</data>
<data name="BindingNavigator1.TabIndex" type="System.Int32, mscorlib">
<value>92</value>

View File

@@ -952,7 +952,7 @@ Public Class frmAdministration
Dim description As String = NotNull(focusedRow.Item("DESCRIPTION"), "")
Dim preventDuplicates As Boolean = NotNull(focusedRow.Item("PREVENT_DUPLICATES"), False)
Dim allowNewValues As Boolean = NotNull(focusedRow.Item("ALLOW_NEW_VALUES"), False)
Dim VectorBehaviour As String = NotNull(focusedRow.Item("IF_VEKTOR_BEHAVIOUR"), False)
Dim VectorBehaviour As String = NotNull(focusedRow.Item("IF_VEKTOR_BEHAVIOUR"), "Add")
CURRENT_INDEX_ID = guid
@@ -1003,6 +1003,10 @@ Public Class frmAdministration
obj.Indicies = Windream_Indicies
obj.IndiciesType = Windream_Indicies_Types
obj.IndexName = index
obj.VectorBehaviourType = New List(Of String) From {
"Add",
"Overwrite"
}
If Not index Is Nothing Then
Dim indexType As Integer = ClassFinalIndex.GetIndexType(index, Windream_Indicies, Windream_Indicies_Types)
@@ -1168,13 +1172,4 @@ Public Class frmAdministration
LOGGER.Error(ex)
End Try
End Sub
'Private Sub viewFinalIndex_ValidateRow(sender As Object, e As Views.Base.ValidateRowEventArgs) Handles viewFinalIndex.ValidateRow
' Dim rowView As DataRowView = e.Row
' If rowView.IsNew Then
' Dim props As FinalIndexProperties = PropertyGrid1.SelectedObject
' End If
'End Sub
End Class

View File

@@ -437,27 +437,33 @@ Public Class frmFormDesigner
End Function
Sub SetActiveControlColor()
If DirectCast(CurrentControl.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
CurrentControl.BackColor = Color.DarkOrange
End If
' Reset Color of all other controls
For Each inctrl As Control In Me.pnldesigner.Controls
If inctrl.Name <> CurrentControl.Name Then
Dim Type As String = inctrl.GetType.ToString
For Each oControl As Control In Me.pnldesigner.Controls
If oControl.Name <> CurrentControl.Name Then
Dim oMetadata = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata)
If oMetadata.ReadOnly = False Then
Dim Type As String = oControl.GetType.ToString
Select Case Type
Case "System.Windows.Forms.TextBox"
inctrl.BackColor = Color.White
oControl.BackColor = Color.White
Case "System.Windows.Forms.ComboBox"
inctrl.BackColor = Color.White
oControl.BackColor = Color.White
Case "System.Windows.Forms.Label"
inctrl.BackColor = Color.Transparent
oControl.BackColor = Color.Transparent
Case "System.Windows.Forms.CheckBox"
inctrl.BackColor = Color.Transparent
oControl.BackColor = Color.Transparent
Case "DD_PM_WINDREAM.ClassControlCreator+LineLabel"
inctrl.BackColor = inctrl.ForeColor
oControl.BackColor = oControl.ForeColor
Case "DigitalData.Controls.LookupGrid.LookupControl2"
inctrl.BackColor = Color.White
oControl.BackColor = Color.White
End Select
End If
End If
Next
End Sub
@@ -622,6 +628,12 @@ Public Class frmFormDesigner
Dim CurrentPosition = CurrentControl.Location
Dim OldPosition As Point = DirectCast(pgControls.SelectedObject, BaseProperties).Location
If CurrentPosition.X = OldPosition.X + 2 And CurrentPosition.Y = OldPosition.Y + 2 Then
CurrentControl.Location = New Point(CurrentPosition.X - 2, CurrentPosition.Y - 2)
MyBase.Cursor = Cursors.Default
Exit Sub
End If
If Not Point.op_Inequality(CurrentPosition, OldPosition) Then
MyBase.Cursor = Cursors.Default
Exit Sub

View File

@@ -1534,11 +1534,10 @@ Public Class frmMain
CURRENT_CLICKED_PROFILE_ID = GridView_Docs.GetRowCellValue(GridView_Docs.GetDataRowHandleByGroupRowHandle(hi.RowHandle), GridView_Docs.Columns("PROFILE_ID"))
ElseIf hi.InDataRow Then
GridViewItem_Clicked = "ROW"
Dim profileid = CURRENT_CLICKED_PROFILE_ID
CURRENT_CLICKED_PROFILE_ID = GridView_Docs.GetRowCellValue(GridView_Docs.GetDataRowHandleByGroupRowHandle(hi.RowHandle), GridView_Docs.Columns("PROFILE_ID"))
Else
GridViewItem_Clicked = Nothing
End If
'End If
End Sub
Private Sub GridView_Docs_ColumnWidthChanged(sender As Object, e As Views.Base.ColumnEventArgs) Handles GridView_Docs.ColumnWidthChanged

View File

@@ -135,7 +135,7 @@ Public Class frmMassValidator
Dim oCount = 0
For Each oControlRow As DataRow In DTCONTROLS.Rows
Dim ctrl As Control
Dim oControl As Control
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case "TXT"
@@ -146,13 +146,17 @@ Public Class frmMassValidator
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
ctrl = txt
oControl = txt
Case "LBL"
LOGGER.Debug("Versuch LBL zu laden")
ctrl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
oControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
LOGGER.Debug("Versuch CMB zu laden")
If oControlRow.Item("READ_ONLY") Then
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
oControl = cmbReadonly
Else
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
@@ -279,28 +283,33 @@ Public Class frmMassValidator
End Using
cmb.DropDownWidth = maxWith
ctrl = cmb
oControl = cmb
End If
Case "DTP"
LOGGER.Debug("Versuch DTP zu laden")
ctrl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
oControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
Case "DGV"
LOGGER.Debug("Versuch DGV zu laden")
Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False)
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
ctrl = dgv
oControl = dgv
Case "CHK"
LOGGER.Debug("Versuch Checkbox zu laden")
ctrl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
oControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
Case "LINE"
LOGGER.Debug("Versuch Linie zu laden")
ctrl = ClassControlCreator.CreateExistingLine(oControlRow, False)
oControl = ClassControlCreator.CreateExistingLine(oControlRow, False)
Case "LOOKUP"
Dim lookup As LookupControl2 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False)
ctrl = lookup
oControl = lookup
lookup.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES")
lookup.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM")
lookup.MultiSelect = oControlRow.Item("MULTISELECT")
@@ -312,7 +321,7 @@ Public Class frmMassValidator
''Wenn Multiselect false dann prüfen ob abhängiges Control
If CBool(oControlRow.Item("MULTISELECT")) = False Then
Dim filteredData As DataTable = DTCONTROLS.Clone()
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{ctrl.Name}%'"
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oControl.Name}%'"
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
If filteredData.Rows.Count = 1 Then
AddHandler lookup.SelectedValuesChanged, AddressOf onLookUp1
@@ -329,14 +338,14 @@ Public Class frmMassValidator
Where r.CONTROL_ID = oControlRow.Item("GUID")
Select r).ToList()
ctrl = ClassControlCreator.CreateExistingGridControl(oControlRow, columns, False)
oControl = ClassControlCreator.CreateExistingGridControl(oControlRow, columns, False)
End Select
If ctrl IsNot Nothing AndAlso TypeOf ctrl IsNot Label Then
ctrl.TabIndex = oCount
If oControl IsNot Nothing AndAlso TypeOf oControl IsNot Label Then
oControl.TabIndex = oCount
End If
pnldesigner.Controls.Add(ctrl)
pnldesigner.Controls.Add(oControl)
oCount += 1
Next

View File

@@ -662,11 +662,23 @@ Public Class frmValidator
oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
LOGGER.Debug("Versuch CMB zu laden")
If oControlRow.Item("READ_ONLY") Then
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
oMyControl = cmbReadonly
Else
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
AddHandler cmb.GotFocus, Sub(sender As Control, e As EventArgs)
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
cmb.BackColor = Color.Lime
End If
End Sub
AddHandler cmb.LostFocus, Sub(sender As Control, e As EventArgs)
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
cmb.BackColor = Color.White
End If
End Sub
#Region "CONTROL LIST"
Dim ControlID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name)
@@ -793,13 +805,14 @@ Public Class frmValidator
cmb.DropDownWidth = maxWith
oMyControl = cmb
End If
'add_ComboBox(dr.Item("GUID"), dr.Item("CTRL_NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"),
Case "DTP"
LOGGER.Debug("Versuch DTP zu laden")
oMyControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
'add_DTP(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"),
Case "DGV"
LOGGER.Debug("Versuch DGV zu laden")
Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False)
@@ -832,15 +845,24 @@ Public Class frmValidator
End If
End If
AddHandler lookup.GotFocus, Sub(sender As Control, e As EventArgs)
If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
lookup.BackColor = Color.Lime
End If
End Sub
AddHandler lookup.LostFocus, Sub(sender As Control, e As EventArgs)
If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
lookup.BackColor = Color.White
End If
End Sub
'Return filteredData
'AddHandler lookup.Leave, AddressOf onLookUp0
'add_DGV(dr.Item("GUID"), dr.Item("CTRL_NAME"), dr.Item("HEIGHT"), dr.Item("WIDTH"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"),
Case "CHK"
LOGGER.Debug("Versuch Checkbox zu laden")
oMyControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
'add_Checkbox(dr.Item("GUID"), dr.Item("CTRL_NAME"), dr.Item("CTRL_TEXT"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE"))
Case "TABLE"
LOGGER.Debug("Versuch Tabelle zu laden")
@@ -909,12 +931,18 @@ Public Class frmValidator
Public Sub OnTextBoxFocus(sender As Object, e As EventArgs)
Dim box As TextBox = sender
If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
box.BackColor = Color.Lime
box.SelectAll()
End If
End Sub
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
Dim box As TextBox = sender
If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
box.BackColor = Color.White
End If
End Sub
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
If ControlHandleStarted = True Then