ZooFlow: new search form

This commit is contained in:
Jonathan Jenne 2021-10-26 16:57:02 +02:00
parent 1113cf9597
commit 180bbd0ffe
3 changed files with 429 additions and 0 deletions

171
GUIs.ZooFlow/Search/XtraForm1.Designer.vb generated Normal file
View File

@ -0,0 +1,171 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class XtraForm1
Inherits DevExpress.XtraEditors.XtraForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.SearchControl2 = New DevExpress.XtraEditors.TokenEdit()
Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit()
Me.PanelControl1 = New DevExpress.XtraEditors.PanelControl()
Me.SidePanel1 = New DevExpress.XtraEditors.SidePanel()
Me.NavBarControl1 = New DevExpress.XtraNavBar.NavBarControl()
Me.NavBarGroup1 = New DevExpress.XtraNavBar.NavBarGroup()
Me.NavBarItem1 = New DevExpress.XtraNavBar.NavBarItem()
Me.NavBarItem2 = New DevExpress.XtraNavBar.NavBarItem()
Me.NavBarItem3 = New DevExpress.XtraNavBar.NavBarItem()
Me.NavBarGroup2 = New DevExpress.XtraNavBar.NavBarGroup()
Me.NavBarGroup3 = New DevExpress.XtraNavBar.NavBarGroup()
CType(Me.SearchControl2.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.PanelControl1.SuspendLayout()
Me.SidePanel1.SuspendLayout()
CType(Me.NavBarControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SearchControl2
'
Me.SearchControl2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.SearchControl2.Location = New System.Drawing.Point(227, 5)
Me.SearchControl2.Name = "SearchControl2"
Me.SearchControl2.Properties.Appearance.BackColor = System.Drawing.Color.Transparent
Me.SearchControl2.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.SearchControl2.Properties.Appearance.Options.UseBackColor = True
Me.SearchControl2.Properties.Appearance.Options.UseFont = True
Me.SearchControl2.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple
Me.SearchControl2.Properties.EditMode = DevExpress.XtraEditors.TokenEditMode.Manual
Me.SearchControl2.Properties.PopupFilterMode = DevExpress.XtraEditors.TokenEditPopupFilterMode.Contains
Me.SearchControl2.Properties.Separators.AddRange(New String() {",", "-", "ODER", "OR", "AND", "UND"})
Me.SearchControl2.Size = New System.Drawing.Size(894, 44)
Me.SearchControl2.TabIndex = 0
'
'ComboBoxEdit1
'
Me.ComboBoxEdit1.Location = New System.Drawing.Point(5, 5)
Me.ComboBoxEdit1.Name = "ComboBoxEdit1"
Me.ComboBoxEdit1.Properties.Appearance.BackColor = System.Drawing.Color.Transparent
Me.ComboBoxEdit1.Properties.Appearance.Font = New System.Drawing.Font("Segoe UI", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ComboBoxEdit1.Properties.Appearance.Options.UseBackColor = True
Me.ComboBoxEdit1.Properties.Appearance.Options.UseFont = True
Me.ComboBoxEdit1.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple
Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.ComboBoxEdit1.Properties.Items.AddRange(New Object() {"Alle", "Belege", "Rechnungen", "Lieferscheine", "Aufträge", "Angebote", "Kunde Schaum", "Kunde medacom"})
Me.ComboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor
Me.ComboBoxEdit1.Size = New System.Drawing.Size(223, 44)
Me.ComboBoxEdit1.TabIndex = 1
'
'PanelControl1
'
Me.PanelControl1.AutoSize = True
Me.PanelControl1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
Me.PanelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder
Me.PanelControl1.Controls.Add(Me.ComboBoxEdit1)
Me.PanelControl1.Controls.Add(Me.SearchControl2)
Me.PanelControl1.Dock = System.Windows.Forms.DockStyle.Top
Me.PanelControl1.Location = New System.Drawing.Point(0, 0)
Me.PanelControl1.Name = "PanelControl1"
Me.PanelControl1.Size = New System.Drawing.Size(1126, 52)
Me.PanelControl1.TabIndex = 2
'
'SidePanel1
'
Me.SidePanel1.Controls.Add(Me.NavBarControl1)
Me.SidePanel1.Dock = System.Windows.Forms.DockStyle.Left
Me.SidePanel1.Location = New System.Drawing.Point(0, 52)
Me.SidePanel1.Name = "SidePanel1"
Me.SidePanel1.Size = New System.Drawing.Size(228, 566)
Me.SidePanel1.TabIndex = 3
Me.SidePanel1.Text = "SidePanel1"
'
'NavBarControl1
'
Me.NavBarControl1.ActiveGroup = Me.NavBarGroup1
Me.NavBarControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.NavBarControl1.Groups.AddRange(New DevExpress.XtraNavBar.NavBarGroup() {Me.NavBarGroup1, Me.NavBarGroup2, Me.NavBarGroup3})
Me.NavBarControl1.Items.AddRange(New DevExpress.XtraNavBar.NavBarItem() {Me.NavBarItem1, Me.NavBarItem2, Me.NavBarItem3})
Me.NavBarControl1.Location = New System.Drawing.Point(0, 0)
Me.NavBarControl1.Name = "NavBarControl1"
Me.NavBarControl1.OptionsNavPane.ExpandedWidth = 227
Me.NavBarControl1.Size = New System.Drawing.Size(227, 566)
Me.NavBarControl1.TabIndex = 0
Me.NavBarControl1.Text = "NavBarControl1"
'
'NavBarGroup1
'
Me.NavBarGroup1.Caption = "NavBarGroup1"
Me.NavBarGroup1.Expanded = True
Me.NavBarGroup1.ItemLinks.AddRange(New DevExpress.XtraNavBar.NavBarItemLink() {New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem1), New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem2), New DevExpress.XtraNavBar.NavBarItemLink(Me.NavBarItem3)})
Me.NavBarGroup1.Name = "NavBarGroup1"
'
'NavBarItem1
'
Me.NavBarItem1.Caption = "NavBarItem1"
Me.NavBarItem1.Name = "NavBarItem1"
'
'NavBarItem2
'
Me.NavBarItem2.Caption = "NavBarItem2"
Me.NavBarItem2.Name = "NavBarItem2"
'
'NavBarItem3
'
Me.NavBarItem3.Caption = "NavBarItem3"
Me.NavBarItem3.Name = "NavBarItem3"
'
'NavBarGroup2
'
Me.NavBarGroup2.Caption = "NavBarGroup2"
Me.NavBarGroup2.Name = "NavBarGroup2"
'
'NavBarGroup3
'
Me.NavBarGroup3.Caption = "NavBarGroup3"
Me.NavBarGroup3.Name = "NavBarGroup3"
'
'XtraForm1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1126, 618)
Me.Controls.Add(Me.SidePanel1)
Me.Controls.Add(Me.PanelControl1)
Me.Name = "XtraForm1"
Me.Text = "XtraForm1"
CType(Me.SearchControl2.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.PanelControl1.ResumeLayout(False)
Me.SidePanel1.ResumeLayout(False)
CType(Me.NavBarControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents SearchControl2 As DevExpress.XtraEditors.TokenEdit
Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit
Friend WithEvents PanelControl1 As DevExpress.XtraEditors.PanelControl
Friend WithEvents SidePanel1 As DevExpress.XtraEditors.SidePanel
Friend WithEvents NavBarControl1 As DevExpress.XtraNavBar.NavBarControl
Friend WithEvents NavBarGroup1 As DevExpress.XtraNavBar.NavBarGroup
Friend WithEvents NavBarItem1 As DevExpress.XtraNavBar.NavBarItem
Friend WithEvents NavBarItem2 As DevExpress.XtraNavBar.NavBarItem
Friend WithEvents NavBarItem3 As DevExpress.XtraNavBar.NavBarItem
Friend WithEvents NavBarGroup2 As DevExpress.XtraNavBar.NavBarGroup
Friend WithEvents NavBarGroup3 As DevExpress.XtraNavBar.NavBarGroup
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,138 @@
Imports DevExpress.Utils
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Repository
Public Class XtraForm1
Private ReadOnly TokenListAttributes As New Dictionary(Of String, Object) From {
{"Rechnungsnummer", New AttributeToken(7411)},
{"Rechnungsdatum", New AttributeToken(7412)},
{"Kundennummer", New AttributeToken(7413)}
}
Private ReadOnly TokenListAttrValues As New Dictionary(Of String, Object) From {
{"{1233}", New AttributeValueToken(1233)},
{"{1234}", New AttributeValueToken(1234)},
{"{1235}", New AttributeValueToken(1235)}
}
Private ReadOnly TokenListDate As New Dictionary(Of String, Object) From {
{"heute", New DateToken(Date.Now)},
{"gestern", New DateToken(Date.Now.AddDays(-1))},
{"letzte Woche", New DateToken(TimeSpan.FromDays(-7))},
{"letzter Monat", New DateToken(TimeSpan.FromDays(-30))}
}
Private TokenListDefault As Dictionary(Of String, Object)
Private TokenListAll As Dictionary(Of String, Object)
Private Sub XtraForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim TokenList As New Dictionary(Of String, Object)
TokenListAll = TokenList.
Concat(TokenListAttributes).
Concat(TokenListAttrValues).
Concat(TokenListDate).
ToDictionary(Function(a) a.Key, Function(a) a.Value)
TokenListDefault = TokenList.
Concat(TokenListAttributes).
Concat(TokenListDate).
ToDictionary(Function(a) a.Key, Function(a) a.Value)
AddTokens(SearchControl2, TokenListDefault)
ComboBoxEdit1.SelectedIndex = 0
End Sub
Public Enum [ValueType]
AttributeName
AttributeValue
End Enum
Public Enum [InputMode]
[Default]
Value
End Enum
Public Class TokenValue
Public Value As Object
Public Type As [ValueType]
Public Overrides Function ToString() As String
Return Value.ToString()
End Function
End Class
Public Class AttributeToken
Inherits TokenValue
Public Sub New(pValue As Object)
Value = pValue
Type = ValueType.AttributeName
End Sub
End Class
Public Class AttributeValueToken
Inherits TokenValue
Public Sub New(pValue As Object)
Value = pValue
Type = ValueType.AttributeValue
End Sub
End Class
Public Class DateToken
Inherits TokenValue
Public Sub New(pValue As Object)
Value = pValue
Type = ValueType.AttributeValue
End Sub
End Class
Private Sub AddTokens(Editor As TokenEdit, Tokens As Dictionary(Of String, Object))
For Each oToken In Tokens
Editor.Properties.Tokens.Add(New DevExpress.XtraEditors.TokenEditToken With {
.Description = oToken.Key,
.Value = oToken.Value
})
Next
End Sub
Private Sub SearchControl2_Properties_TokenAdded(sender As Object, e As DevExpress.XtraEditors.TokenEditTokenAddedEventArgs) Handles SearchControl2.Properties.TokenAdded
Dim oEditor As TokenEdit = sender
SetNewTokens(oEditor)
End Sub
Private Sub SearchControl2_Properties_TokenRemoved(sender As Object, e As TokenEditTokenRemovedEventArgs) Handles SearchControl2.Properties.TokenRemoved
Dim oEditor As TokenEdit = sender
SetNewTokens(oEditor)
End Sub
Private Sub SetNewTokens(pEditor As TokenEdit)
Dim oLastToken = pEditor.GetTokenList().LastOrDefault()
pEditor.Properties.BeginUpdate()
If oLastToken IsNot Nothing Then
pEditor.Properties.Tokens.Clear()
Select Case oLastToken.Value.GetType
Case GetType(AttributeToken)
AddTokens(pEditor, TokenListAttrValues)
Case GetType(AttributeValueToken)
AddTokens(pEditor, TokenListAll)
Case Else
AddTokens(pEditor, TokenListDefault)
End Select
pEditor.Properties.EndUpdate()
Else
pEditor.Properties.Tokens.Clear()
AddTokens(pEditor, TokenListDefault)
End If
End Sub
End Class