This commit is contained in:
Jonathan Jenne 2017-05-29 15:28:51 +02:00
parent 078ba6b8cd
commit 0f8f8ddf65
5 changed files with 235 additions and 6 deletions

View File

@ -409,6 +409,12 @@
<Compile Include="frmStructureNodeConfig.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmTreeSearchResult.Designer.vb">
<DependentUpon>frmTreeSearchResult.vb</DependentUpon>
</Compile>
<Compile Include="frmTreeSearchResult.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmViewsUser.Designer.vb">
<DependentUpon>frmViewsUser.vb</DependentUpon>
</Compile>
@ -851,6 +857,9 @@
<EmbeddedResource Include="frmStructureNodeConfig.resx">
<DependentUpon>frmStructureNodeConfig.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmTreeSearchResult.resx">
<DependentUpon>frmTreeSearchResult.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmViewsUser.resx">
<DependentUpon>frmViewsUser.vb</DependentUpon>
</EmbeddedResource>

View File

@ -673,20 +673,20 @@ Public Class frmConstructor_Main
Return Nothing
End Function
Dim NodesThatMatch As New List(Of TreeNode)
Private Function SearchTheTreeView(ByVal TV As TreeView, ByVal TextToFind As String) As TreeNode
Private Function SearchTheTreeView(ByVal TV As TreeView, ByVal TextToFind As String) As List(Of TreeNode)
' Empty previous
NodesThatMatch.Clear()
' Keep calling RecursiveSearch
For Each TN As TreeNode In TV.Nodes
If TN.Text = TextToFind Then
If TN.Text.Contains(TextToFind) Then
NodesThatMatch.Add(TN)
End If
RecursiveSearch(TN, TextToFind)
Next
If NodesThatMatch.Count > 0 Then
Return NodesThatMatch(0)
Return NodesThatMatch
Else
Return Nothing
End If
@ -6651,16 +6651,30 @@ Public Class frmConstructor_Main
End If
End Sub
Private Sub tstxtboxSearchNode_KeyUp(sender As Object, e As KeyEventArgs) Handles tstxtboxSearchNode.KeyUp
If e.KeyCode = Keys.Return Then
If SearchTheTreeView(TreeViewMain, tstxtboxSearchNode.Text) Is Nothing Then
Dim Result As List(Of TreeNode) = SearchTheTreeView(TreeViewMain, tstxtboxSearchNode.Text)
If Result Is Nothing Then
MessageBox.Show("No Match Found")
Else
TreeViewMain.SelectedNode = SearchTheTreeView(TreeViewMain, tstxtboxSearchNode.Text)
If Result.Count = 1 Then
TreeViewMain.SelectedNode = Result.First()
Else
Dim resultForm As New frmTreeSearchResult()
resultForm.searchResultNodes = Result
resultForm.constructorForm = Me
resultForm.Show()
End If
End If
End If
End Sub
Public Sub SetSelectedTreeViewNode(node As TreeNode)
TreeViewMain.SelectedNode = node
End Sub
Private Sub tstxtboxSearchNode_Click(sender As Object, e As EventArgs) Handles tstxtboxSearchNode.Click, tstxtboxSearchNode.Enter
tstxtboxSearchNode.Text = ""
End Sub

View File

@ -0,0 +1,55 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmTreeSearchResult
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.listBoxResults = New System.Windows.Forms.ListBox()
Me.SuspendLayout()
'
'listBoxResults
'
Me.listBoxResults.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.listBoxResults.FormattingEnabled = True
Me.listBoxResults.ItemHeight = 16
Me.listBoxResults.Location = New System.Drawing.Point(12, 12)
Me.listBoxResults.Name = "listBoxResults"
Me.listBoxResults.Size = New System.Drawing.Size(534, 228)
Me.listBoxResults.TabIndex = 0
'
'frmTreeSearchResult
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(558, 258)
Me.Controls.Add(Me.listBoxResults)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmTreeSearchResult"
Me.ShowIcon = False
Me.Text = "Gefundene Knoten"
Me.TopMost = True
Me.ResumeLayout(False)
End Sub
Friend WithEvents listBoxResults As ListBox
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,31 @@
Public Class frmTreeSearchResult
Public searchResultNodes As List(Of TreeNode)
Public constructorForm As frmConstructor_Main
Private Sub frmTreeSearchResult_Load(sender As Object, e As EventArgs) Handles MyBase.Load
listBoxResults.Focus()
searchResultNodes.ForEach(Sub(resultNode)
listBoxResults.Items.Add(resultNode.Text)
End Sub)
End Sub
Private Sub listBoxResults_KeyUp(sender As Object, e As KeyEventArgs) Handles listBoxResults.KeyUp
If e.KeyCode = Keys.Escape Then
DialogResult = DialogResult.Cancel
Close()
End If
End Sub
Private Sub SetSelectedNode(nodeName As String)
Dim node = searchResultNodes.Find(Function(n As TreeNode)
Return n.Text = nodeName
End Function)
constructorForm.SetSelectedTreeViewNode(node)
End Sub
Private Sub listBoxResults_SelectedIndexChanged(sender As Object, e As EventArgs) Handles listBoxResults.SelectedIndexChanged
Dim name As String = listBoxResults.SelectedItem
SetSelectedNode(name)
End Sub
End Class