jj 04.05.2016 staticlist editor

This commit is contained in:
JenneJ
2016-05-04 16:09:15 +02:00
parent 7ec031388f
commit 1c53e3e894
8 changed files with 326 additions and 8 deletions

View File

@@ -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

View File

@@ -349,12 +349,12 @@ Module ClassControlProperties
<LocalizedCategoryAttribute("category_data")>
<LocalizedDescriptionAttribute("desc_staticlist")>
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

View File

@@ -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
<Editor(GetType(ClassStaticListEditor), GetType(UITypeEditor))> _
<TypeConverter(GetType(StaticListTypeConverter))> _
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

View File

@@ -259,12 +259,19 @@
<Compile Include="frmRight_Management.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmStaticListEditor.Designer.vb">
<DependentUpon>frmStaticListEditor.vb</DependentUpon>
</Compile>
<Compile Include="frmStaticListEditor.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmWD_Import_Doc_Record.Designer.vb">
<DependentUpon>frmWD_Import_Doc_Record.vb</DependentUpon>
</Compile>
<Compile Include="frmWD_Import_Doc_Record.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="ClassStaticListEditor.vb" />
<Compile Include="Strings\ControlProperties.en.Designer.vb">
<DependentUpon>ControlProperties.en.resx</DependentUpon>
<AutoGen>True</AutoGen>
@@ -610,6 +617,9 @@
<EmbeddedResource Include="frmRight_Management.resx">
<DependentUpon>frmRight_Management.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmStaticListEditor.resx">
<DependentUpon>frmStaticListEditor.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmWD_Import_Doc_Record.resx">
<DependentUpon>frmWD_Import_Doc_Record.vb</DependentUpon>
</EmbeddedResource>

View File

@@ -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"))

View File

@@ -0,0 +1,103 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmStaticListEditor
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
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

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -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