add DataResultList
This commit is contained in:
@@ -11,8 +11,12 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DevExpress.XtraGrid.Views.Base
|
||||
Imports DevExpress.XtraGrid.Views.BandedGrid
|
||||
Imports DigitalData.GUIs.Common
|
||||
|
||||
Public Class frmDocumentResultList
|
||||
Implements IResultForm
|
||||
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
Private _Config As ConfigManager(Of DocumentResultConfig)
|
||||
@@ -21,9 +25,8 @@ Public Class frmDocumentResultList
|
||||
Private _ResultLists As List(Of DocumentResult)
|
||||
|
||||
Private _ActiveGrid As GridControl = Nothing
|
||||
Private _ActiveRowHandle As Integer = NO_ROW_HANDLE
|
||||
|
||||
Private Const NO_ROW_HANDLE = -1
|
||||
Private _ActiveGridBand As GridBand = Nothing
|
||||
Private _ActiveRowHandle As Integer = Constants.NO_ROW_HANDLE
|
||||
|
||||
Private Const COLUMN_ICON = "ICON"
|
||||
Private Const COLUMN_FILEPATH = "FULL_FILENAME"
|
||||
@@ -32,6 +35,8 @@ Public Class frmDocumentResultList
|
||||
|
||||
Private _IsLoading As Boolean = True
|
||||
|
||||
Public Property ShouldReturnToMatchForm As Boolean Implements IResultForm.ShouldReturnToMatchForm
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DocumentResultParams)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
@@ -45,6 +50,8 @@ 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
|
||||
@@ -68,25 +75,24 @@ Public Class frmDocumentResultList
|
||||
oTotalResults += oList.Datatable.Rows.Count
|
||||
Next
|
||||
|
||||
Text = String.Format(Text, oTotalResults)
|
||||
labelResultCount.Caption = String.Format(labelResultCount.Caption, oTotalResults)
|
||||
|
||||
' Load Grids
|
||||
For index = 0 To _ResultLists.Count - 1
|
||||
Select Case index
|
||||
Case 0
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(0)
|
||||
GridBand1.Caption = $"{oResult.Title} ({oResult.Datatable.Rows.Count})"
|
||||
CreateDocumentGrid(GridView1, oResult.Datatable)
|
||||
|
||||
UpdateGridHeader(index, oResult.Datatable.Rows.Count)
|
||||
Case 1
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(1)
|
||||
GridBand2.Caption = $"{oResult.Title} ({oResult.Datatable.Rows.Count})"
|
||||
CreateDocumentGrid(GridView2, oResult.Datatable)
|
||||
UpdateGridHeader(index, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 2
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(2)
|
||||
GridBand3.Caption = $"{oResult.Title} ({oResult.Datatable.Rows.Count})"
|
||||
CreateDocumentGrid(GridView3, oResult.Datatable)
|
||||
UpdateGridHeader(index, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case Else
|
||||
MessageBox.Show("You have more than three searches configured. This Window will only show the first three result lists!")
|
||||
@@ -113,15 +119,15 @@ Public Class frmDocumentResultList
|
||||
Private Sub UpdateGridHeader(Index As Integer, Count As Integer)
|
||||
Select Case Index
|
||||
Case 0
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(0)
|
||||
Dim oResult = _ResultLists.Item(0)
|
||||
GridBand1.Caption = $"{oResult.Title} ({Count})"
|
||||
|
||||
Case 1
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(1)
|
||||
Dim oResult = _ResultLists.Item(1)
|
||||
GridBand2.Caption = $"{oResult.Title} ({Count})"
|
||||
|
||||
Case 2
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(2)
|
||||
Dim oResult = _ResultLists.Item(2)
|
||||
GridBand3.Caption = $"{oResult.Title} ({Count})"
|
||||
End Select
|
||||
End Sub
|
||||
@@ -283,7 +289,7 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged
|
||||
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
|
||||
If _Config IsNot Nothing And _IsLoading = False Then
|
||||
_Config.Config.SplitContainer1Horizontal = SwitchMainContainerHorizontal.Checked
|
||||
@@ -301,14 +307,20 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItemExportGrid1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemExportGrid1.ItemClick
|
||||
XtraSaveFileDialog.FileName = Utils.ConvertTextToSlug(GridBand1.Caption) & ".xlsx"
|
||||
XtraSaveFileDialog.DefaultExt = ".xlsx"
|
||||
Dim oActiveGrid = GetActiveGridControl()
|
||||
|
||||
If XtraSaveFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
Dim oOptions As New XlsxExportOptions() With {
|
||||
.ExportMode = XlsxExportMode.SingleFile
|
||||
}
|
||||
GridControl1.ExportToXlsx(XtraSaveFileDialog.FileName, oOptions)
|
||||
If oActiveGrid IsNot Nothing Then
|
||||
Dim oGridBand = _ActiveGridBand
|
||||
|
||||
XtraSaveFileDialog.FileName = Utils.ConvertTextToSlug(oGridBand.Caption) & ".xlsx"
|
||||
XtraSaveFileDialog.DefaultExt = ".xlsx"
|
||||
|
||||
If XtraSaveFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
Dim oOptions As New XlsxExportOptions() With {
|
||||
.ExportMode = XlsxExportMode.SingleFile
|
||||
}
|
||||
oActiveGrid.ExportToXlsx(XtraSaveFileDialog.FileName, oOptions)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -330,7 +342,7 @@ Public Class frmDocumentResultList
|
||||
Dim oActiveGrid = GetActiveGridControl()
|
||||
Dim oActiveRowhandle = GetActiveRowHandle()
|
||||
|
||||
If oActiveGrid IsNot Nothing And oActiveRowhandle <> NO_ROW_HANDLE Then
|
||||
If oActiveGrid IsNot Nothing And oActiveRowhandle <> Constants.NO_ROW_HANDLE Then
|
||||
Dim oView = DirectCast(oActiveGrid.DefaultView, GridView)
|
||||
Dim oRow = oView.GetDataRow(oActiveRowhandle)
|
||||
Return oRow
|
||||
@@ -348,8 +360,8 @@ Public Class frmDocumentResultList
|
||||
End Function
|
||||
|
||||
Private Function GetActiveRowHandle() As Integer
|
||||
If _ActiveRowHandle = NO_ROW_HANDLE Then
|
||||
Return NO_ROW_HANDLE
|
||||
If _ActiveRowHandle = Constants.NO_ROW_HANDLE Then
|
||||
Return Constants.NO_ROW_HANDLE
|
||||
End If
|
||||
|
||||
Return _ActiveRowHandle
|
||||
@@ -357,6 +369,19 @@ Public Class frmDocumentResultList
|
||||
|
||||
Private Sub GridControl_Enter(sender As GridControl, e As EventArgs) Handles GridControl1.Enter, GridControl2.Enter, GridControl3.Enter
|
||||
_ActiveGrid = sender
|
||||
SetActiveGridBand()
|
||||
End Sub
|
||||
|
||||
Private Sub SetActiveGridBand()
|
||||
If _ActiveGrid.Equals(GridControl1) Then
|
||||
_ActiveGridBand = GridBand1
|
||||
ElseIf _ActiveGrid.Equals(GridControl2) Then
|
||||
_ActiveGridBand = GridBand2
|
||||
ElseIf _ActiveGrid.Equals(GridControl3) Then
|
||||
_ActiveGridBand = GridBand3
|
||||
Else
|
||||
_ActiveGridBand = Nothing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub OpenFolderPath()
|
||||
@@ -437,4 +462,9 @@ Public Class frmDocumentResultList
|
||||
Dim oRowCount = sender.RowCount
|
||||
UpdateGridHeader(2, oRowCount)
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||
ShouldReturnToMatchForm = True
|
||||
Close()
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user