Imports System.ComponentModel
Imports System.Resources


Module ClassControlProperties
    ' ++++++ LOCALIZE PROPERTIES ++++++

    Private Function Lookup(key As String)
        Try
            Return My.Resources.ControlProperties.ResourceManager.GetString(key)
        Catch ex As Exception
            Return key
        End Try
    End Function

    Public Class LocalizedDescriptionAttribute
        Inherits DescriptionAttribute

        Public Sub New(key As String)
            MyBase.New(Lookup(key))
        End Sub
    End Class

    Public Class LocalizedCategoryAttribute
        Inherits CategoryAttribute

        Public Sub New(key As String)
            MyBase.New(Lookup(key))
        End Sub
    End Class

    ' +++++ END LOCALIZE PROPERTIES +++++

    ' +++++ ABSTRACT CLASSES +++++
    Public MustInherit Class BaseProperties
        Private _id As Integer
        Private _size As Size
        Private _location As Point
        Private _name As String
        Private _hint As String

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_hint")>
        Public Property Hint() As String
            Get
                Return _hint
            End Get
            Set(value As String)
                _hint = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_id")>
        <LocalizedDescriptionAttribute("desc_id")>
        <ReadOnlyAttribute(True)>
        Public Property ID() As Integer
            Get
                Return _id
            End Get
            Set(value As Integer)
                _id = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_size")>
        Public Property Size() As Size
            Get
                Return _size
            End Get
            Set(value As Size)
                _size = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_location")>
        Public Property Location() As Point
            Get
                Return _location
            End Get
            Set(value As Point)
                _location = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_name")>
        Public Property Name() As String
            Get
                Return _name
            End Get
            Set(value As String)
                _name = value
            End Set
        End Property
    End Class

    Public MustInherit Class CommonProperties
        Inherits BaseProperties

        Private _id As Integer
        ' ViewConfigurations
        Private _size As Size
        Private _location As Point
        Private _name As String = ""
        Private _column_title = ""
        ' Other Configurations
        Private _required As Boolean = False
        Private _read_only As Boolean = False
        ' Database Configurations
        Private _sql_command As String = ""
        ' Font Configurations
        Private _font As Font
        Private _font_color As Color

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_col_title")>
        Public Property ColumnTitle() As String
            Get
                Return _column_title
            End Get
            Set(value As String)
                _column_title = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_required")>
        Public Property IsRequired() As Boolean
            Get
                Return _required
            End Get
            Set(value As Boolean)
                _required = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_readonly")>
        Public Property IsReadOnly() As Boolean
            Get
                Return _read_only
            End Get
            Set(value As Boolean)
                _read_only = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_database")>
        <LocalizedDescriptionAttribute("desc_sqlcommand")>
        Public Property SQLCommand() As SQLValue
            Get
                Return New SQLValue(_sql_command)
            End Get
            Set(value As SQLValue)
                _sql_command = value.Value
            End Set
        End Property
        <LocalizedCategoryAttribute("category_font")>
        <LocalizedDescriptionAttribute("desc_fontstyle")>
        Public Property Font() As Font
            Get
                Return _font
            End Get
            Set(value As Font)
                _font = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_font")>
        <LocalizedDescriptionAttribute("desc_fontcolor")>
        Public Property FontColor() As Color
            Get
                Return _font_color
            End Get
            Set(value As Color)
                _font_color = value
            End Set
        End Property

    End Class

    Public MustInherit Class InputControlProperties
        Inherits CommonProperties
        Private _default_Value As String
        Private _tab_index As Integer
        Private _tab_stop As Boolean
        Private _show_column As Boolean

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_tabindex")>
        Public Property TabIndex() As Integer
            Get
                Return _tab_index
            End Get
            Set(value As Integer)
                _tab_index = value
            End Set
        End Property
        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_tabstop")>
        Public Property TabStop() As Boolean
            Get
                Return _tab_stop
            End Get
            Set(value As Boolean)
                _tab_stop = value
            End Set
        End Property
        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_defaultvalue")>
        <DefaultValue("")>
        Public Property DefaultValue() As String
            Get
                Return _default_Value
            End Get
            Set(value As String)
                _default_Value = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_showcolumn")>
        Public Property ShowColumn() As Boolean
            Get
                Return _show_column
            End Get
            Set(value As Boolean)
                _show_column = value
            End Set
        End Property

    End Class

    ' +++++ CONTROL CLASSES +++++

    Public Class LabelProperties
        Inherits CommonProperties

        Private _caption As String = ""

        <Browsable(False)>
        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_col_title")>
        Public Overloads Property ColumnTitle() As String
            Get
                Return ""
            End Get
            Set(value As String)
                '_column_title = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property
    End Class

    Public Class TextBoxProperties
        Inherits InputControlProperties

        Private _multiline As Boolean
        Private _format As String

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_format")>
        Public Property Format() As EnumFormatOptions
            Get
                Return _format
            End Get
            Set(value As EnumFormatOptions)
                _format = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_multiline")>
        Public Property Multiline() As Boolean
            Get
                Return _multiline
            End Get
            Set(value As Boolean)
                _multiline = value
            End Set
        End Property
    End Class
    Public Class ComboBoxProperties
        Inherits InputControlProperties

        Private _master_data_id As Integer
        Private _static_list As String
        Private _format As EnumFormatOptions

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_format")>
        Public Property Format() As EnumFormatOptions
            Get
                Return _format
            End Get
            Set(value As EnumFormatOptions)
                _format = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_masterdataid")>
        Public Property MasterDataId() As Integer
            Get
                Return _master_data_id
            End Get
            Set(value As Integer)
                _master_data_id = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_data")>
        <LocalizedDescriptionAttribute("desc_staticlist")>
        Public Property StaticList() As String
            Get
                Return _static_list
            End Get
            Set(value As String)
                _static_list = value
            End Set
        End Property

    End Class
    Public Class DateTimePickerProperties
        Inherits InputControlProperties

        Private _default_value As EnumDateTimePickerDefaultValueOptions = EnumDateTimePickerDefaultValueOptions.Empty

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_defaultvalue")>
        Public Overloads Property DefaultValue() As EnumDateTimePickerDefaultValueOptions
            Get
                Return _default_value
            End Get
            Set(value As EnumDateTimePickerDefaultValueOptions)
                _default_value = value
            End Set
        End Property

    End Class
    Public Class CheckBoxProperties
        Inherits InputControlProperties
        Private _caption As String = ""
        Private _default_value As Boolean = False

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_defaultvalue")>
        <DefaultValue(False)>
        Public Overloads Property DefaultValue As Boolean
            Get
                Return _default_value
            End Get
            Set(value As Boolean)
                _default_value = value
            End Set
        End Property
    End Class

    Public Class RadioButtonProperties
        Inherits InputControlProperties

        Private _caption As String = ""
        Private _default_value As Boolean = False


        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_other")>
        <LocalizedDescriptionAttribute("desc_defaultvalue")>
        <DefaultValue(False)>
        Public Overloads Property DefaultValue As Boolean
            Get
                Return _default_value
            End Get
            Set(value As Boolean)
                _default_value = value
            End Set
        End Property
    End Class

    Public Class DataGridViewProperties
        Inherits CommonProperties

        Private _show_column As Boolean

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_showcolumn")>
        Public Property ShowColumn() As Boolean
            Get
                Return _show_column
            End Get
            Set(value As Boolean)
                _show_column = value
            End Set
        End Property
    End Class
    Public Class PictureBoxProperties
        Inherits CommonProperties
    End Class
    Public Class GroupBoxProperties
        Inherits CommonProperties
        Private _caption As String = ""
        Private _back_color As Color

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_backcolor")>
        Public Property BackColor() As Color
            Get
                Return _back_color
            End Get
            Set(value As Color)
                _back_color = value
            End Set
        End Property
    End Class

    ' +++++ FUNCTION CLASSES +++++

    Public Class FunctionAddAppointment
        Inherits BaseProperties

        Private _caption As String
        Private _subject As String
        Private _subject2 As String
        Private _from_date As String
        Private _from_time As String
        Private _to_date As String
        Private _to_time As String
        Private _place As String
        Private _description As String

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_appointment")>
        <LocalizedDescriptionAttribute("desc_subject")>
        Public Property Subject() As String
            Get
                Return _subject
            End Get
            Set(value As String)
                _subject = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_appointment")>
        <LocalizedDescriptionAttribute("desc_subject2")>
        Public Property Subject2() As String
            Get
                Return _subject2
            End Get
            Set(value As String)
                _subject2 = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_appointment")>
        <LocalizedDescriptionAttribute("desc_place")>
        Public Property Place() As String
            Get
                Return _place
            End Get
            Set(value As String)
                _place = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_appointment")>
        <LocalizedDescriptionAttribute("desc_description")>
        Public Property Description() As String
            Get
                Return _description
            End Get
            Set(value As String)
                _description = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_date")>
        <LocalizedDescriptionAttribute("desc_fromdate")>
        Public Property FromDate() As String
            Get
                Return _from_date
            End Get
            Set(value As String)
                _from_date = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_date")>
        <LocalizedDescriptionAttribute("desc_todate")>
        Public Property ToDate() As String
            Get
                Return _to_date
            End Get
            Set(value As String)
                _to_date = value
            End Set
        End Property
    End Class

    Public Class FunctionAddFormData
        Inherits BaseProperties

        Private _caption As String
        Private _form_id As Integer
        Private _screen_id As Integer

        <LocalizedCategoryAttribute("category_view")>
        <LocalizedDescriptionAttribute("desc_caption")>
        Public Property Caption() As String
            Get
                Return _caption
            End Get
            Set(value As String)
                _caption = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_form")>
        <LocalizedDescriptionAttribute("desc_formid")>
        Public Property FormID() As Integer
            Get
                Return _form_id
            End Get
            Set(value As Integer)
                _form_id = value
            End Set
        End Property

        <LocalizedCategoryAttribute("category_form")>
        <LocalizedDescriptionAttribute("desc_screenid")>
        Public Property ScreenID() As Integer
            Get
                Return _screen_id
            End Get
            Set(value As Integer)
                _screen_id = value
            End Set
        End Property
    End Class
End Module
