Imports System.ComponentModel Imports System.ComponentModel.Design Imports System.Drawing.Design Imports System.Globalization Imports DigitalData.Modules.Language.Utils Public Module ModuleControlProperties Public Enum IndexTypes SimpleIndex = 0 VectorIndex = 1 End Enum Public Class BaseProperties Private _size As Size Private _font As Font <[ReadOnly](True)> Public Property ChangedAt As Date <[ReadOnly](True)> Public Property ChangedWho As String <[ReadOnly](True)> Public Property ID() As Integer Public Property Name() As String Public Property Location() As Point Public Property Size() As Size Get Return _size End Get Set(value As Size) If (value.Height <= 0) Then value.Height = 1 End If If (value.Width <= 20) Then value.Width = 20 End If _size = value End Set End Property Public Overridable Property Font As Font Get Return _font End Get Set(value As Font) _font = value End Set End Property Public Property TextColor As Color Class FontConverter Inherits TypeConverter Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As CultureInfo, value As Object, destinationType As Type) As Object Dim font = DirectCast(value, Font) Return $"{font.Name}, {font.Size}" End Function End Class End Class Public Class InputProperties Inherits BaseProperties Private _index_type As String Private _sql_command As String Friend _sql_connection As Integer = 0 Private _Enable_SQL As String Private _Enable_SQL_ONLOAD As String Private _default_value Friend _set_control_data As String Public Property Active() As Boolean Public Property Required() As Boolean Public Property [ReadOnly]() As Boolean Public Property [SaveChangeOnReadOnly]() As Boolean Public Property IndexType() As IndexTypes ''' ''' Diese Eigenschaft enthält die auswählbaren Indicies, die für das Control verfügbar sind. Wird nicht direkt angezeigt. ''' Public Property Indicies() As List(Of String) ''' ''' Diese Eigenschaft enthält des ausgewählten Index ''' Public Property Index() As String Public Property SQLCommand() As SQLValue Get Return New SQLValue(NotNull(_sql_command, ""), _sql_connection) End Get Set(ByVal value As SQLValue) _sql_command = value.Value SQLConnection = value.ConnectionId End Set End Property <[ReadOnly](True)> Public Property SQLConnection() As Integer Get Return _sql_connection End Get Set(value As Integer) _sql_connection = value End Set End Property Public Property Enable_SQL() As SQLValue Get Return New SQLValue(NotNull(_Enable_SQL, ""), _sql_connection) End Get Set(ByVal value As SQLValue) _Enable_SQL = value.Value SQLConnection = value.ConnectionId End Set End Property Public Property Enable_SQL_OnLoad() As SQLValue Get Return New SQLValue(NotNull(_Enable_SQL_ONLOAD, ""), _sql_connection) End Get Set(ByVal value As SQLValue) _Enable_SQL_ONLOAD = value.Value SQLConnection = value.ConnectionId End Set End Property Public Property DefaultValue() As String Get Return _default_value End Get Set(value As String) _default_value = value End Set End Property End Class Public Class InputPropertiesWithControlData Inherits InputProperties Public Property SetControlData As SQLValue Get Return New SQLValue(_set_control_data, _sql_connection) End Get Set(value As SQLValue) _set_control_data = value.Value SQLConnection = value.ConnectionId End Set End Property End Class Public Class TextboxProperties Inherits InputPropertiesWithControlData Public Property Regex As String Public Property RegexMessage As String End Class Public Class LabelProperties Inherits BaseProperties Public Property Text() As String End Class Public Class CheckboxProperties Inherits InputPropertiesWithControlData Public Property Text() As String End Class Public Class ComboboxProperties Inherits InputPropertiesWithControlData Public Property Text() As String Public Property ChoiceLists() As List(Of String) Public Property ChoiceList() As String Public Property DisplayAsLookUpControl As Boolean Public Class ChoiceListConverter 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 choiceListList = DirectCast(context.Instance, ComboboxProperties).ChoiceLists Dim values As New StandardValuesCollection(choiceListList) Return values 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 End Class Public Class DatepickerProperties Inherits InputProperties End Class Public Class GridViewProperties Inherits InputProperties End Class Public Class GridControlProperties Inherits InputProperties Public Property AllowAddNewValues As Boolean End Class Public Class ButtonProperties Inherits InputProperties Private _image_Value As String Private _Override_SQL As String Public Property Text() As String Public Property CtrlImage() As ImageValue Get Return New ImageValue(NotNull(_image_Value, "")) End Get Set(ByVal value As ImageValue) _image_Value = value.Value End Set End Property Public Property Override_SQL() As SQLValue Get Return New SQLValue(NotNull(_Override_SQL, ""), _sql_connection) End Get Set(ByVal value As SQLValue) _Override_SQL = value.Value SQLConnection = value.ConnectionId End Set End Property End Class Public Class LookupControlProperties Inherits InputPropertiesWithControlData Public Property MultiSelect As Boolean Public Property AllowAddNewValues As Boolean Public Property PreventDuplicates As Boolean Public Property ChoiceList() As String Public Property DisplayAsComboBox As Boolean End Class Public Class LineLabelProperties Inherits BaseProperties Public Overrides Property Font As Font Get Return Nothing End Get Set(value As Font) End Set End Property End Class End Module