work on resultlists

This commit is contained in:
Developer02 Digital Data 2019-10-16 17:09:40 +02:00
parent c3379adb54
commit 1047f6152a
11 changed files with 186 additions and 17 deletions

View File

@ -258,7 +258,7 @@ Public Class frmMatch
If TypeOf sender Is frmDataResultList Or TypeOf sender Is frmDocumentResultList Then
For Each oForm As IResultForm In OpenForms
' Determine if frmProfileMatch should be shown
If oForm.ShouldReturnToMatchForm Then
If oForm.ShouldReturnToPreviousForm Then
oShouldOpenAgain = True
End If
Next

View File

@ -3,7 +3,7 @@ Imports System.Windows.Forms
Imports DigitalData.Modules.Logging
Namespace Base
Public Class ClassMessageBox
Public Class BaseErrorHandler
Private _Logger As Logger
Private _Form As Form
@ -17,7 +17,12 @@ Namespace Base
Public Sub ShowErrorMessage(Exception As Exception)
_Logger.Error(Exception)
MsgBox(GetMessage(Exception), MsgBoxStyle.Critical, _Form.Text)
MessageBox.Show(GetMessage(Exception), _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub
Public Sub ShowInfoMessage(Text As String)
_Logger.Info(Text)
MessageBox.Show(Text, _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Function GetMessage(Exception As Exception) As String

View File

@ -0,0 +1,83 @@
Imports DevExpress.XtraBars.Docking
Imports DevExpress.XtraBars.Ribbon
Imports DigitalData.Modules.Logging
Namespace Base
''' <summary>
''' This BaseClass is used to provide common functionality like the Logger or ErrorHandler to all Forms
''' To use it, create a form and change the `Inherits` statement in FormName.Designer.vb to this form, eg.:
'''
''' Partial Class frmExample
''' Inherits BaseRibbonForm
'''
''' ...
''' End Class
'''
''' Only BaseRibbonForms can have panels attached to it!
''' </summary>
Public Class BaseRibbonForm
Inherits RibbonForm
Private ReadOnly _Logger As Logger
Private ReadOnly _ErrorHandler As BaseErrorHandler
Protected ReadOnly Property Logger As Logger
Get
Return _Logger
End Get
End Property
''' <summary>
''' Sets or gets the ribbon Page that will be shown when the window is visible
''' </summary>
''' <returns></returns>
Public Property DefaultRibbonPage As RibbonPage
Protected Overrides Sub OnLoad(e As EventArgs)
MyBase.OnLoad(e)
If DefaultRibbonPage IsNot Nothing Then
Ribbon.SelectPage(DefaultRibbonPage)
End If
End Sub
Protected Overrides Sub OnVisibleChanged(e As EventArgs)
MyBase.OnVisibleChanged(e)
If Visible And DefaultRibbonPage IsNot Nothing Then
Ribbon.SelectPage(DefaultRibbonPage)
End If
End Sub
Protected Overrides Sub OnActivated(e As EventArgs)
MyBase.OnVisibleChanged(e)
If Visible And DefaultRibbonPage IsNot Nothing Then
Ribbon.SelectPage(DefaultRibbonPage)
End If
End Sub
Public Sub New(LogConfig As LogConfig)
' Get the full name of the inheriting form
' so the log messages have the right classname
Dim oClassName = [GetType]().FullName
' My.LogConfig is undefined in the designer
_Logger = LogConfig?.GetLogger(oClassName)
_ErrorHandler = New BaseErrorHandler(_Logger, Me)
' When you add something, be careful if it
' depends on a global var like My.LogConfig
' you might need to check for its existence with ?
End Sub
Public Sub ShowErrorMessage(Exception As Exception)
_ErrorHandler.ShowErrorMessage(Exception)
End Sub
Public Sub ShowErrorMessage(ErrorMessage As String)
_ErrorHandler.ShowErrorMessage(New Exception(ErrorMessage))
End Sub
End Class
End Namespace

View File

@ -88,7 +88,10 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Base\ClassMessageBox.vb" />
<Compile Include="Base\BaseMessageBox.vb" />
<Compile Include="Base\BaseRibbonForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Constants.vb" />
<Compile Include="DataResultList\DataResultConfig.vb" />
<Compile Include="DataResultList\DataResultParams.vb" />

View File

@ -27,7 +27,7 @@ Public Class frmDataResultList
Private _ActiveGridBand As GridBand = Nothing
Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE
Public Property ShouldReturnToMatchForm As Boolean Implements IResultForm.ShouldReturnToMatchForm
Public Property ShouldReturnToPreviousForm As Boolean Implements IResultForm.ShouldReturnToPreviousForm
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DataResultParams)
' Dieser Aufruf ist für den Designer erforderlich.
@ -43,7 +43,7 @@ Public Class frmDataResultList
_Params = Params
_ResultLists = Params.Results
ShouldReturnToMatchForm = False
ShouldReturnToPreviousForm = False
End Sub
Private Sub frmDataResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -234,7 +234,7 @@ Public Class frmDataResultList
End Sub
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
ShouldReturnToMatchForm = True
ShouldReturnToPreviousForm = True
Close()
End Sub

View File

@ -1,6 +1,6 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmDocumentResultList
Inherits DevExpress.XtraBars.Ribbon.RibbonForm
Inherits Base.BaseRibbonForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _

View File

@ -35,9 +35,11 @@ Public Class frmDocumentResultList
Private _IsLoading As Boolean = True
Public Property ShouldReturnToMatchForm As Boolean Implements IResultForm.ShouldReturnToMatchForm
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams)
MyBase.New(LogConfig)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
@ -50,8 +52,6 @@ Public Class frmDocumentResultList
_Environment = Environment
_Params = Params
_ResultLists = Params.Results
ShouldReturnToMatchForm = False
End Sub
Private Sub frmDocumentResultList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -481,7 +481,7 @@ Public Class frmDocumentResultList
End Sub
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
ShouldReturnToMatchForm = True
ShouldReturnToPreviousForm = True
Close()
End Sub

View File

@ -1,3 +1,3 @@
Public Interface IResultForm
Property ShouldReturnToMatchForm As Boolean
Property ShouldReturnToPreviousForm As Boolean
End Interface

View File

@ -53,6 +53,16 @@ Partial Class Form1
Dim SerializableAppearanceObject22 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject23 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject24 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim EditorButtonImageOptions7 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
Dim SerializableAppearanceObject25 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject26 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject27 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject28 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim EditorButtonImageOptions8 As DevExpress.XtraEditors.Controls.EditorButtonImageOptions = New DevExpress.XtraEditors.Controls.EditorButtonImageOptions()
Dim SerializableAppearanceObject29 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject30 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject31 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Dim SerializableAppearanceObject32 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject()
Me.Button1 = New System.Windows.Forms.Button()
Me.LookupControl = New DigitalData.Controls.LookupGrid.LookupControl2()
Me.LookupControl21View = New DevExpress.XtraGrid.Views.Grid.GridView()
@ -63,12 +73,17 @@ Partial Class Form1
Me.LookupControl22 = New DigitalData.Controls.LookupGrid.LookupControl2()
Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.Label3 = New System.Windows.Forms.Label()
Me.LookupControl23 = New DigitalData.Controls.LookupGrid.LookupControl2()
Me.GridView3 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.Label4 = New System.Windows.Forms.Label()
CType(Me.LookupControl.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LookupControl21View, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LookupControl21.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LookupControl22.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LookupControl23.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView3, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
@ -176,13 +191,47 @@ Partial Class Form1
Me.Label3.TabIndex = 4
Me.Label3.Text = "MultiSelect = False"
'
'LookupControl23
'
Me.LookupControl23.AllowAddNewValues = False
Me.LookupControl23.DataSource = Nothing
Me.LookupControl23.Location = New System.Drawing.Point(393, 197)
Me.LookupControl23.MultiSelect = False
Me.LookupControl23.Name = "LookupControl23"
Me.LookupControl23.PreventDuplicates = False
Me.LookupControl23.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo, "", -1, True, True, False, EditorButtonImageOptions7, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject25, SerializableAppearanceObject26, SerializableAppearanceObject27, SerializableAppearanceObject28, "", "openDropdown", Nothing, DevExpress.Utils.ToolTipAnchor.[Default]), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis, "", -1, True, True, False, EditorButtonImageOptions8, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject29, SerializableAppearanceObject30, SerializableAppearanceObject31, SerializableAppearanceObject32, "", "openLookupForm", Nothing, DevExpress.Utils.ToolTipAnchor.[Default])})
Me.LookupControl23.Properties.DataSource = CType(resources.GetObject("LookupControl23.Properties.DataSource"), Object)
Me.LookupControl23.Properties.NullText = ""
Me.LookupControl23.Properties.PopupView = Me.GridView3
Me.LookupControl23.SelectedValues = CType(resources.GetObject("LookupControl23.SelectedValues"), System.Collections.Generic.List(Of String))
Me.LookupControl23.Size = New System.Drawing.Size(342, 20)
Me.LookupControl23.TabIndex = 3
'
'GridView3
'
Me.GridView3.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus
Me.GridView3.Name = "GridView3"
Me.GridView3.OptionsSelection.EnableAppearanceFocusedCell = False
Me.GridView3.OptionsView.ShowGroupPanel = False
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(390, 181)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(89, 13)
Me.Label4.TabIndex = 4
Me.Label4.Text = "100.000 Records"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.LookupControl23)
Me.Controls.Add(Me.LookupControl22)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.LookupControl21)
@ -196,6 +245,8 @@ Partial Class Form1
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LookupControl22.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LookupControl23.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView3, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -210,4 +261,7 @@ Partial Class Form1
Friend WithEvents LookupControl22 As DigitalData.Controls.LookupGrid.LookupControl2
Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents Label3 As Label
Friend WithEvents LookupControl23 As DigitalData.Controls.LookupGrid.LookupControl2
Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents Label4 As Label
End Class

View File

@ -169,6 +169,24 @@
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
</value>
</data>
<data name="LookupControl23.Properties.DataSource" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
</value>
</data>
<data name="LookupControl23.SelectedValues" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAJoBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0sIG1zY29ybGliLCBWZXJzaW9u
PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQUB
AAAAMFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbU3lzdGVtLlN0cmluZwMAAAAGX2l0
ZW1zBV9zaXplCF92ZXJzaW9uBgAACAgCAAAACQMAAAAAAAAAAAAAABEDAAAAAAAAAAs=
</value>
</data>
</root>

View File

@ -1,8 +1,12 @@
Public Class Form1
Private _Datasource As New List(Of String) From {"Foo", "bar", "baz", "quux"}
Private _Datasource As New List(Of String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oDatatable = GetDatatable()
For index = 1 To 1000000
_Datasource.Add($"item-{index}")
Next
Dim oDatatable = GetDatatable(10)
Dim oSelectedValues = _Datasource.Take(1).ToList()
LookupControl.DataSource = oDatatable
@ -20,6 +24,8 @@
LookupControl22.SelectedValues = New List(Of String) From {"", Nothing, "LOL", "Foo"}
LookupControl23.DataSource = GetDatatable(100000)
AddHandler LookupControl.SelectedValuesChanged, Sub(_sender As Object, SelectedValues As List(Of String))
MsgBox("Selected Values: " & String.Join(",", SelectedValues.ToArray))
End Sub
@ -33,7 +39,7 @@
End Sub
End Sub
Private Function GetDatatable() As DataTable
Private Function GetDatatable(Limit As Integer) As DataTable
Dim oDatatable As New DataTable
Dim oColumns As New List(Of DataColumn) From {
New DataColumn("Col1", GetType(String)),
@ -42,7 +48,7 @@
oDatatable.Columns.AddRange(oColumns.ToArray)
For Each Item In _Datasource
For Each Item In _Datasource.Take(Limit)
Dim oRow = oDatatable.NewRow()
oRow.Item("Col1") = Item
oRow.Item("Col2") = Item & "_" & "SomeLong Random(String) !!!111einself"