diff --git a/app/DD-Record-Organiser/ClassControlCommands.vb b/app/DD-Record-Organiser/ClassControlCommands.vb index a0accd6..18769ed 100644 --- a/app/DD-Record-Organiser/ClassControlCommands.vb +++ b/app/DD-Record-Organiser/ClassControlCommands.vb @@ -280,7 +280,8 @@ End If If propExists(properties, "StaticList") Then - STATIC_LIST = properties.StaticList + Dim value As StaticListValue = DirectCast(properties.StaticList, StaticListValue) + STATIC_LIST = value.Value Else STATIC_LIST = String.Empty End If diff --git a/app/DD-Record-Organiser/ClassControlProperties.vb b/app/DD-Record-Organiser/ClassControlProperties.vb index 34c81d4..55e0364 100644 --- a/app/DD-Record-Organiser/ClassControlProperties.vb +++ b/app/DD-Record-Organiser/ClassControlProperties.vb @@ -349,12 +349,12 @@ Module ClassControlProperties - Public Property StaticList() As String + Public Property StaticList() As StaticListValue Get - Return _static_list + Return New StaticListValue(_static_list) End Get - Set(value As String) - _static_list = value + Set(value As StaticListValue) + _static_list = value.Value End Set End Property diff --git a/app/DD-Record-Organiser/ClassStaticListEditor.vb b/app/DD-Record-Organiser/ClassStaticListEditor.vb new file mode 100644 index 0000000..02808d0 --- /dev/null +++ b/app/DD-Record-Organiser/ClassStaticListEditor.vb @@ -0,0 +1,62 @@ +Imports System.ComponentModel +'Imports System.ComponentModel.Design +Imports System.Drawing.Design +'Imports System.Windows.Forms +Imports System.Windows.Forms.Design + +Public Class ClassStaticListEditor + Inherits UITypeEditor + + Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle + Return UITypeEditorEditStyle.Modal + End Function + + Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object + Dim svc As IWindowsFormsEditorService = TryCast(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService) + Dim SLString As String = DirectCast(value, StaticListValue).Value + + If svc IsNot Nothing AndAlso SLString IsNot Nothing Then + Using Form As New frmStaticListEditor() + SLString = SLString.Replace(";", vbNewLine) ' Semikolon zu vbNewLine + Form.Value = SLString + If svc.ShowDialog(Form) = DialogResult.OK Then + Dim str As String = Form.Value.Replace(vbNewLine, ";") ' vbNewLine zu Semikolon + Dim sl As New StaticListValue(str) + value = sl + End If + End Using + End If + + Return value + End Function +End Class + + _ + _ +Public Class StaticListValue + Private _value As String + + Public Sub New(value As String) + Me._value = value + End Sub + + Public Property Value As String + Get + Return _value + End Get + Set(value As String) + _value = value + End Set + End Property +End Class + +Public Class StaticListTypeConverter + Inherits TypeConverter + + ' Diese Funktion gibt den String zurück, der im PropertyGrid für den Benutzer sichtbar ist, kann ruhig etwas hübscher sein als foo;bar;baz + Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object + Dim staticlistvalue As StaticListValue = DirectCast(value, StaticListValue) + Dim stringvalue = staticlistvalue.Value + Return stringvalue.Replace(";", ", ") + End Function +End Class diff --git a/app/DD-Record-Organiser/DD-Record-Organiser.vbproj b/app/DD-Record-Organiser/DD-Record-Organiser.vbproj index 22a747a..88ab0bb 100644 --- a/app/DD-Record-Organiser/DD-Record-Organiser.vbproj +++ b/app/DD-Record-Organiser/DD-Record-Organiser.vbproj @@ -259,12 +259,19 @@ Form + + frmStaticListEditor.vb + + + Form + frmWD_Import_Doc_Record.vb Form + ControlProperties.en.resx True @@ -610,6 +617,9 @@ frmRight_Management.vb + + frmStaticListEditor.vb + frmWD_Import_Doc_Record.vb diff --git a/app/DD-Record-Organiser/frmLevel_Designer.vb b/app/DD-Record-Organiser/frmLevel_Designer.vb index 5fcf064..88db195 100644 --- a/app/DD-Record-Organiser/frmLevel_Designer.vb +++ b/app/DD-Record-Organiser/frmLevel_Designer.vb @@ -723,7 +723,8 @@ props.DefaultValue = ClassConverter.ToStringOrDefault(r.Item("CONTROL_DEF_VALUE")) props.MasterDataId = r.Item("CTRLSCR_MASTER_DATA_ID") props.Format = NotNull([Enum].Parse(GetType(EnumFormatOptions), r.Item("CONTROL_FORMAT_TYPE")), EnumFormatOptions.String) - props.StaticList = NotNull(r.Item("CONTROL_STATIC_LIST"), "") + 'props.StaticList = NotNull(r.Item("CONTROL_STATIC_LIST"), "") + props.StaticList = New StaticListValue(r.Item("CONTROL_STATIC_LIST").ToString()) props.IsRequired = r.Item("CONTROL_REQUIRED") props.IsReadOnly = r.Item("CONTROL_READ_ONLY") props.TabStop = r.Item("CTRLSCR_TAB_STOP") @@ -802,7 +803,8 @@ Case "ListBox" props.ControlType = "ListBox" - props.StaticList = ClassConverter.ToStringOrDefault(r.Item("CONTROL_STATIC_LIST")) + 'props.StaticList = ClassConverter.ToStringOrDefault(r.Item("CONTROL_STATIC_LIST")) + props.StaticList = New StaticListValue(r.Item("CONTROL_STATIC_LIST").ToString()) props.IsRequired = r.Item("CONTROL_REQUIRED") props.IsReadOnly = r.Item("CONTROL_READ_ONLY") props.FontColor = IntToColor(r.Item("CTRLSCR_FONT_COLOR")) @@ -815,7 +817,8 @@ Case "CheckedListBox" props.ControlType = "CheckedListBox" - props.StaticList = ClassConverter.ToStringOrDefault(r.Item("CONTROL_STATIC_LIST")) + 'props.StaticList = ClassConverter.ToStringOrDefault(r.Item("CONTROL_STATIC_LIST")) + props.StaticList = New StaticListValue(r.Item("CONTROL_STATIC_LIST").ToString()) props.IsRequired = r.Item("CONTROL_REQUIRED") props.IsReadOnly = r.Item("CONTROL_READ_ONLY") props.FontColor = IntToColor(r.Item("CTRLSCR_FONT_COLOR")) diff --git a/app/DD-Record-Organiser/frmStaticListEditor.Designer.vb b/app/DD-Record-Organiser/frmStaticListEditor.Designer.vb new file mode 100644 index 0000000..de26a20 --- /dev/null +++ b/app/DD-Record-Organiser/frmStaticListEditor.Designer.vb @@ -0,0 +1,103 @@ + _ +Partial Class frmStaticListEditor + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.txtValue = New System.Windows.Forms.TextBox() + Me.Button1 = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Button2 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'txtValue + ' + Me.txtValue.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtValue.Location = New System.Drawing.Point(0, 0) + Me.txtValue.Multiline = True + Me.txtValue.Name = "txtValue" + Me.txtValue.Size = New System.Drawing.Size(516, 216) + Me.txtValue.TabIndex = 0 + ' + 'Button1 + ' + Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Button1.DialogResult = System.Windows.Forms.DialogResult.OK + Me.Button1.Location = New System.Drawing.Point(431, 222) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(75, 23) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Speichern" + Me.Button1.UseVisualStyleBackColor = True + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(12, 227) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(0, 13) + Me.Label1.TabIndex = 2 + ' + 'Label2 + ' + Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(12, 227) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(234, 13) + Me.Label2.TabIndex = 3 + Me.Label2.Text = "Listenelemente eingeben (Ein Element pro Zeile)" + ' + 'Button2 + ' + Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Button2.Location = New System.Drawing.Point(350, 222) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(75, 23) + Me.Button2.TabIndex = 4 + Me.Button2.Text = "Abbrechen" + Me.Button2.UseVisualStyleBackColor = True + ' + 'frmStaticListEditor + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(518, 257) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.txtValue) + Me.Name = "frmStaticListEditor" + Me.Text = "Statische Liste bearbeiten" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents txtValue As System.Windows.Forms.TextBox + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Button2 As System.Windows.Forms.Button +End Class diff --git a/app/DD-Record-Organiser/frmStaticListEditor.resx b/app/DD-Record-Organiser/frmStaticListEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/app/DD-Record-Organiser/frmStaticListEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/app/DD-Record-Organiser/frmStaticListEditor.vb b/app/DD-Record-Organiser/frmStaticListEditor.vb new file mode 100644 index 0000000..4ca1596 --- /dev/null +++ b/app/DD-Record-Organiser/frmStaticListEditor.vb @@ -0,0 +1,19 @@ +Public Class frmStaticListEditor + + Public Property Value() As String + Get + Return txtValue.Text + End Get + Set(value As String) + txtValue.Text = value + End Set + End Property + + Private Sub frmStaticListEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load + 'noop + End Sub + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + + End Sub +End Class \ No newline at end of file