Common/DocumentResultList: Performance Improvements for Grid Result
This commit is contained in:
parent
de685806f0
commit
b5120e4115
@ -45,8 +45,7 @@ Partial Class frmDocumentResultList
|
||||
Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
|
||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
|
||||
Me.GridView1 = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridView()
|
||||
Me.GridBand1 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand()
|
||||
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
Me.SplitContainerControl2 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.GridControl2 = New DevExpress.XtraGrid.GridControl()
|
||||
Me.GridView2 = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridView()
|
||||
@ -84,7 +83,7 @@ Partial Class frmDocumentResultList
|
||||
Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemTextEdit1, Me.RepositoryItemTextEdit2})
|
||||
Me.RibbonControl.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False]
|
||||
Me.RibbonControl.Size = New System.Drawing.Size(1189, 159)
|
||||
Me.RibbonControl.Size = New System.Drawing.Size(1189, 157)
|
||||
Me.RibbonControl.StatusBar = Me.RibbonStatusBar
|
||||
'
|
||||
'SwitchMainContainerHorizontal
|
||||
@ -260,7 +259,7 @@ Partial Class frmDocumentResultList
|
||||
Me.SplitContainerControl1.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl1.Panel2.Controls.Add(Me.SplitContainerControl2)
|
||||
Me.SplitContainerControl1.Panel2.Text = "Panel2"
|
||||
Me.SplitContainerControl1.Size = New System.Drawing.Size(762, 490)
|
||||
Me.SplitContainerControl1.Size = New System.Drawing.Size(762, 492)
|
||||
Me.SplitContainerControl1.SplitterPosition = 382
|
||||
Me.SplitContainerControl1.TabIndex = 2
|
||||
Me.SplitContainerControl1.Text = "SplitContainerControl1"
|
||||
@ -272,7 +271,7 @@ Partial Class frmDocumentResultList
|
||||
Me.GridControl1.MainView = Me.GridView1
|
||||
Me.GridControl1.MenuManager = Me.RibbonControl
|
||||
Me.GridControl1.Name = "GridControl1"
|
||||
Me.GridControl1.Size = New System.Drawing.Size(382, 490)
|
||||
Me.GridControl1.Size = New System.Drawing.Size(382, 492)
|
||||
Me.GridControl1.TabIndex = 0
|
||||
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
|
||||
'
|
||||
@ -282,25 +281,13 @@ Partial Class frmDocumentResultList
|
||||
Me.GridView1.Appearance.EvenRow.Options.UseBackColor = True
|
||||
Me.GridView1.Appearance.FocusedRow.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
|
||||
Me.GridView1.Appearance.FocusedRow.Options.UseBackColor = True
|
||||
Me.GridView1.Bands.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.GridBand() {Me.GridBand1})
|
||||
Me.GridView1.GridControl = Me.GridControl1
|
||||
Me.GridView1.Name = "GridView1"
|
||||
Me.GridView1.OptionsBehavior.Editable = False
|
||||
Me.GridView1.OptionsBehavior.ReadOnly = True
|
||||
Me.GridView1.OptionsView.EnableAppearanceEvenRow = True
|
||||
Me.GridView1.OptionsView.ShowAutoFilterRow = True
|
||||
'
|
||||
'GridBand1
|
||||
'
|
||||
Me.GridBand1.AppearanceHeader.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold)
|
||||
Me.GridBand1.AppearanceHeader.Options.UseFont = True
|
||||
Me.GridBand1.Caption = "GridBand1"
|
||||
Me.GridBand1.Name = "GridBand1"
|
||||
Me.GridBand1.OptionsBand.AllowHotTrack = False
|
||||
Me.GridBand1.OptionsBand.AllowMove = False
|
||||
Me.GridBand1.OptionsBand.AllowPress = False
|
||||
Me.GridBand1.OptionsBand.AllowSize = False
|
||||
Me.GridBand1.VisibleIndex = 0
|
||||
Me.GridBand1.Width = 513
|
||||
'
|
||||
'SplitContainerControl2
|
||||
'
|
||||
Me.SplitContainerControl2.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2
|
||||
@ -312,7 +299,7 @@ Partial Class frmDocumentResultList
|
||||
Me.SplitContainerControl2.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl2.Panel2.Controls.Add(Me.GridControl3)
|
||||
Me.SplitContainerControl2.Panel2.Text = "Panel2"
|
||||
Me.SplitContainerControl2.Size = New System.Drawing.Size(370, 490)
|
||||
Me.SplitContainerControl2.Size = New System.Drawing.Size(370, 492)
|
||||
Me.SplitContainerControl2.SplitterPosition = 223
|
||||
Me.SplitContainerControl2.TabIndex = 0
|
||||
Me.SplitContainerControl2.Text = "SplitContainerControl2"
|
||||
@ -357,7 +344,7 @@ Partial Class frmDocumentResultList
|
||||
Me.GridControl3.MainView = Me.GridView3
|
||||
Me.GridControl3.MenuManager = Me.RibbonControl
|
||||
Me.GridControl3.Name = "GridControl3"
|
||||
Me.GridControl3.Size = New System.Drawing.Size(370, 257)
|
||||
Me.GridControl3.Size = New System.Drawing.Size(370, 259)
|
||||
Me.GridControl3.TabIndex = 0
|
||||
Me.GridControl3.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView3})
|
||||
'
|
||||
@ -386,13 +373,13 @@ Partial Class frmDocumentResultList
|
||||
'SplitContainerControl3
|
||||
'
|
||||
Me.SplitContainerControl3.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.SplitContainerControl3.Location = New System.Drawing.Point(0, 159)
|
||||
Me.SplitContainerControl3.Location = New System.Drawing.Point(0, 157)
|
||||
Me.SplitContainerControl3.Name = "SplitContainerControl3"
|
||||
Me.SplitContainerControl3.Panel1.Controls.Add(Me.SplitContainerControl1)
|
||||
Me.SplitContainerControl3.Panel1.Text = "Panel1"
|
||||
Me.SplitContainerControl3.Panel2.Controls.Add(Me.DocumentViewer1)
|
||||
Me.SplitContainerControl3.Panel2.Text = "Panel2"
|
||||
Me.SplitContainerControl3.Size = New System.Drawing.Size(1189, 490)
|
||||
Me.SplitContainerControl3.Size = New System.Drawing.Size(1189, 492)
|
||||
Me.SplitContainerControl3.SplitterPosition = 762
|
||||
Me.SplitContainerControl3.TabIndex = 5
|
||||
Me.SplitContainerControl3.Text = "SplitContainerControl3"
|
||||
@ -403,7 +390,7 @@ Partial Class frmDocumentResultList
|
||||
Me.DocumentViewer1.FileLoaded = False
|
||||
Me.DocumentViewer1.Location = New System.Drawing.Point(0, 0)
|
||||
Me.DocumentViewer1.Name = "DocumentViewer1"
|
||||
Me.DocumentViewer1.Size = New System.Drawing.Size(417, 490)
|
||||
Me.DocumentViewer1.Size = New System.Drawing.Size(417, 492)
|
||||
Me.DocumentViewer1.TabIndex = 0
|
||||
'
|
||||
'XtraSaveFileDialog
|
||||
@ -457,8 +444,6 @@ Partial Class frmDocumentResultList
|
||||
Friend WithEvents SplitContainerControl2 As DevExpress.XtraEditors.SplitContainerControl
|
||||
Friend WithEvents GridControl2 As DevExpress.XtraGrid.GridControl
|
||||
Friend WithEvents GridControl3 As DevExpress.XtraGrid.GridControl
|
||||
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView
|
||||
Friend WithEvents GridBand1 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
|
||||
Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView
|
||||
Friend WithEvents GridBand2 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
|
||||
Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.BandedGrid.BandedGridView
|
||||
@ -482,4 +467,5 @@ Partial Class frmDocumentResultList
|
||||
Friend WithEvents RepositoryItemTextEdit2 As DevExpress.XtraEditors.Repository.RepositoryItemTextEdit
|
||||
Friend WithEvents labelCriticalError As DevExpress.XtraBars.BarStaticItem
|
||||
Friend WithEvents labelWarning As DevExpress.XtraBars.BarStaticItem
|
||||
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
End Class
|
||||
|
||||
@ -17,14 +17,17 @@ Imports DevExpress.XtraGrid.Views.BandedGrid
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
Imports DevExpress.XtraEditors.ViewInfo
|
||||
Imports DevExpress.XtraEditors
|
||||
|
||||
Public Class frmDocumentResultList
|
||||
Implements IResultForm
|
||||
|
||||
Private COLUMN_FILEPATH = "FULL_FILENAME"
|
||||
Private COLUMN_FILENAME = "Filename"
|
||||
Private COLUMN_DOCID = "DocID"
|
||||
Private COLUMN_ICON = "ICON"
|
||||
' These are NOT constants, only defaults
|
||||
' Can be changed when calling frmDocumentResultList
|
||||
Private COLUMN_FILEPATH As String = "FULL_FILENAME"
|
||||
Private COLUMN_FILENAME As String = "Filename"
|
||||
Private COLUMN_DOCID As String = "DocID"
|
||||
Private COLUMN_ICON As String = "ICON"
|
||||
|
||||
Private _IsLoading As Boolean = True
|
||||
Private _IDBClient As Client
|
||||
@ -140,14 +143,17 @@ Public Class frmDocumentResultList
|
||||
If IsNothing(_DocumentInfo) Or DocumentViewer1.FileLoaded = False Then
|
||||
Show_Warning("File could not be loaded!")
|
||||
End If
|
||||
DocumentViewer1.LoadFile(_DocumentInfo.FullPath)
|
||||
|
||||
If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||
DocumentViewer1.SetViewOnly(True)
|
||||
RibbonPageGroup_Export.Visible = False
|
||||
Else
|
||||
DocumentViewer1.SetViewOnly(False)
|
||||
RibbonPageGroup_Export.Visible = True
|
||||
If Not IsNothing(_DocumentInfo) Then
|
||||
DocumentViewer1.LoadFile(_DocumentInfo.FullPath)
|
||||
|
||||
If _DocumentInfo.AccessRight = Rights.AccessRight.VIEW_ONLY Then
|
||||
DocumentViewer1.SetViewOnly(True)
|
||||
RibbonPageGroup_Export.Visible = False
|
||||
Else
|
||||
DocumentViewer1.SetViewOnly(False)
|
||||
RibbonPageGroup_Export.Visible = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@ -215,26 +221,46 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Sub LoadGridData(Result As DocumentResult)
|
||||
If Result.Datatable.Columns.Contains(COLUMN_DOCID) = False Then
|
||||
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}] for search {Result.Title}!")
|
||||
End If
|
||||
|
||||
If OperationMode = IResultForm.Mode.NoAppServer And Result.Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
|
||||
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}] for search {Result.Title}!")
|
||||
End If
|
||||
|
||||
GridControl1.DataSource = Result.Datatable
|
||||
GridControl1.ForceInitialize()
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateGridData()
|
||||
' Load Grids
|
||||
For index = 0 To _ResultLists.Count - 1
|
||||
Select Case index
|
||||
For oIndex = 0 To _ResultLists.Count - 1
|
||||
Select Case oIndex
|
||||
Case 0
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(0)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView1, oResult)
|
||||
RestoreLayout(GridView1)
|
||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 1
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(1)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView2, oResult)
|
||||
RestoreLayout(GridView1)
|
||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||
RestoreLayout(GridView2)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 2
|
||||
Dim oResult As DocumentResult = _ResultLists.Item(2)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView3, oResult)
|
||||
RestoreLayout(GridView1)
|
||||
UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count)
|
||||
RestoreLayout(GridView3)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case Else
|
||||
MessageBox.Show(Constants.MESSAGE_TOO_MANY_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
@ -285,7 +311,7 @@ Public Class frmDocumentResultList
|
||||
Select Case pIndex
|
||||
Case 0
|
||||
Dim oResult = pResultList.Item(0)
|
||||
GridBand1.Caption = $"{oResult.Title} ({pCount})"
|
||||
'GridBand1.Caption = $"{oResult.Title} ({pCount})"
|
||||
|
||||
Case 1
|
||||
Dim oResult = pResultList.Item(1)
|
||||
@ -298,89 +324,23 @@ Public Class frmDocumentResultList
|
||||
End Sub
|
||||
|
||||
Private Sub CreateDocumentGrid(GridView As GridView, Result As DocumentResult)
|
||||
Dim oDocDatatable As New DataTable
|
||||
Try
|
||||
If Result.Datatable.Columns.Contains(COLUMN_DOCID) = False Then
|
||||
Throw New ApplicationException($"Datatable is missing DocId Column [{COLUMN_DOCID}] for search {Result.Title}!")
|
||||
If IsNothing(GridView.Columns("ICON")) Then
|
||||
Dim oIconColumn = GridView.Columns.AddVisible("ICON", "ICON")
|
||||
With oIconColumn
|
||||
.OptionsColumn.AllowSort = False
|
||||
.OptionsColumn.AllowSize = False
|
||||
.OptionsColumn.ShowCaption = False
|
||||
.OptionsColumn.FixedWidth = True
|
||||
.Width = 20
|
||||
.MaxWidth = 20
|
||||
.MinWidth = 20
|
||||
.VisibleIndex = 0
|
||||
End With
|
||||
End If
|
||||
|
||||
If OperationMode = IResultForm.Mode.NoAppServer And Result.Datatable.Columns.Contains(COLUMN_FILEPATH) = False Then
|
||||
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}] for search {Result.Title}!")
|
||||
End If
|
||||
|
||||
'Die Icon Colum erstellen und konfigurieren
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(Image),
|
||||
.ColumnName = COLUMN_ICON,
|
||||
.Caption = ""
|
||||
})
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(String),
|
||||
.ColumnName = COLUMN_FILEPATH,
|
||||
.Caption = "Fullpath"
|
||||
})
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(Int32),
|
||||
.ColumnName = COLUMN_DOCID,
|
||||
.Caption = "DocID"
|
||||
})
|
||||
oDocDatatable.Columns.Add(New DataColumn() With {
|
||||
.DataType = GetType(String),
|
||||
.ColumnName = COLUMN_FILENAME,
|
||||
.Caption = "Filename"
|
||||
})
|
||||
|
||||
Dim oRestColArray As New List(Of String)
|
||||
For Each oColumn As DataColumn In Result.Datatable.Columns
|
||||
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
|
||||
Dim oNewColumn As New DataColumn() With {
|
||||
.DataType = oColumn.DataType,
|
||||
.ColumnName = oColumn.ColumnName,
|
||||
.Caption = oColumn.Caption
|
||||
}
|
||||
|
||||
oDocDatatable.Columns.Add(oNewColumn)
|
||||
oRestColArray.Add(oNewColumn.ColumnName)
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each oRow As DataRow In Result.Datatable.Rows
|
||||
Dim oDocId = TryGetItem(oRow, COLUMN_DOCID)
|
||||
Dim oFullpath = TryGetItem(oRow, COLUMN_FILEPATH)
|
||||
Dim oFilename = TryGetItem(oRow, COLUMN_FILENAME)
|
||||
|
||||
Dim oNewRow As DataRow
|
||||
oNewRow = oDocDatatable.NewRow()
|
||||
|
||||
If OperationMode = IResultForm.Mode.NoAppServer Then
|
||||
oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFullpath)
|
||||
oNewRow.Item(COLUMN_FILEPATH) = oFullpath
|
||||
oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
Else
|
||||
oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFilename)
|
||||
oNewRow.Item(COLUMN_FILEPATH) = String.Empty
|
||||
oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
End If
|
||||
|
||||
oNewRow.Item(COLUMN_DOCID) = oDocId
|
||||
|
||||
Dim oIndex = 4 'Fängt bei 4 an, um die definierten Spalten zu überspringen
|
||||
For Each oColumnName As String In oRestColArray
|
||||
Dim oRowValue
|
||||
oRowValue = oRow.Item(oColumnName)
|
||||
oNewRow.Item(oIndex) = oRowValue
|
||||
oIndex += 1
|
||||
Next
|
||||
|
||||
oDocDatatable.Rows.Add(oNewRow)
|
||||
Next
|
||||
|
||||
Dim oGridControl As GridControl = GridView.GridControl
|
||||
oGridControl.DataSource = oDocDatatable
|
||||
oGridControl.ForceInitialize()
|
||||
|
||||
Dim oCreated, oChanged As String
|
||||
If _Environment.User.Language <> "de-DE" Then
|
||||
If _Environment?.User?.Language <> "de-DE" Then
|
||||
oChanged = "Changed"
|
||||
oCreated = "Created"
|
||||
Else
|
||||
@ -389,16 +349,19 @@ Public Class frmDocumentResultList
|
||||
End If
|
||||
|
||||
Try
|
||||
GridView.Columns.Item(COLUMN_DOCID).Visible = False
|
||||
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
|
||||
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
|
||||
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
|
||||
Dim oDocIdColumn As GridColumn = GridView.Columns(COLUMN_DOCID)
|
||||
If Not IsNothing(oDocIdColumn) Then
|
||||
oDocIdColumn.Visible = False
|
||||
End If
|
||||
|
||||
If OperationMode = IResultForm.Mode.WithAppServer Then
|
||||
' Hide Fullpath completely in AppServer Mode
|
||||
GridView.Columns.Item(COLUMN_FILEPATH).OptionsColumn.ShowInCustomizationForm = False
|
||||
'GridView.Columns.Item(COLUMN_ICON).Visible = False
|
||||
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
|
||||
Dim oFilePathColumn As GridColumn = GridView.Columns(COLUMN_FILEPATH)
|
||||
If Not IsNothing(oFilePathColumn) Then
|
||||
oFilePathColumn.Visible = False
|
||||
|
||||
' Hide Fullpath column completely in AppServer-Mode
|
||||
If OperationMode = IResultForm.Mode.WithAppServer Then
|
||||
oFilePathColumn.OptionsColumn.ShowInCustomizationForm = False
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim oCreatedColumn = GridView.Columns(oCreated)
|
||||
@ -412,17 +375,12 @@ Public Class frmDocumentResultList
|
||||
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
|
||||
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
|
||||
End If
|
||||
|
||||
' Alle Spalten auf ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
|
||||
For Each oColumn As GridColumn In GridView.Columns
|
||||
oColumn.OptionsColumn.AllowEdit = False
|
||||
Next
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
GridView.OptionsView.BestFitMaxRowCount = -1
|
||||
GridView.BestFitColumns(True)
|
||||
GridView.OptionsView.BestFitMaxRowCount = 30
|
||||
GridView.BestFitColumns()
|
||||
Catch ex As ApplicationException
|
||||
MsgBox($"Error while loading grid data for search {Result.Title}: {vbNewLine}{vbNewLine}{ex.Message}", MsgBoxStyle.Critical, Text)
|
||||
_Logger.Error(ex)
|
||||
@ -430,26 +388,53 @@ Public Class frmDocumentResultList
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If e.Column.FieldName = "Name" Then
|
||||
Dim cellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
|
||||
Dim info As TextEditViewInfo = TryCast(cellInfo.ViewInfo, TextEditViewInfo)
|
||||
If info IsNot Nothing Then
|
||||
If OperationMode = IResultForm.Mode.NoAppServer Then
|
||||
' oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFullpath)
|
||||
' oNewRow.Item(COLUMN_FILEPATH) = oFullpath
|
||||
' oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
Else
|
||||
'info.ContextImage = _Helpers.GetIconByExtension(oFilename)
|
||||
' oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFilename)
|
||||
' oNewRow.Item(COLUMN_FILEPATH) = String.Empty
|
||||
' oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
End If
|
||||
info.CalcViewInfo()
|
||||
End If
|
||||
If e.RowHandle < 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oView As GridView = TryCast(sender, GridView)
|
||||
Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
|
||||
Dim oRow As DataRow = oView.GetDataRow(e.RowHandle)
|
||||
Dim oValue = oRow.Item(COLUMN_FILENAME)
|
||||
|
||||
e.DefaultDraw()
|
||||
|
||||
If e.Column.FieldName = COLUMN_ICON Then
|
||||
Dim oIcon = _Helpers.GetIconByExtension(oValue)
|
||||
Dim offsetX = 0
|
||||
Dim offsetY = 0
|
||||
|
||||
e.Cache.DrawImage(oIcon, e.Bounds.X + offsetX, e.Bounds.Y + offsetY, 18, 18)
|
||||
End If
|
||||
|
||||
'Dim view As GridView = TryCast(sender, GridView)
|
||||
'If e.Column.FieldName = COLUMN_FILENAME Then
|
||||
' Dim oCellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
|
||||
' Dim oViewInfo As TextEditViewInfo = TryCast(oCellInfo.ViewInfo, TextEditViewInfo)
|
||||
' Dim oFilename As String = e.DisplayText
|
||||
|
||||
' If oViewInfo IsNot Nothing And oFilename <> String.Empty Then
|
||||
' If OperationMode = IResultForm.Mode.NoAppServer Then
|
||||
' ' oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFullpath)
|
||||
' ' oNewRow.Item(COLUMN_FILEPATH) = oFullpath
|
||||
' ' oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
' Else
|
||||
' oViewInfo.ContextImage = _Helpers.GetIconByExtension(oFilename)
|
||||
' oViewInfo.ContextImageAlignment = ContextImageAlignment.Near
|
||||
' ' oNewRow.Item(COLUMN_ICON) = _Helpers.GetIconByExtension(oFilename)
|
||||
' ' oNewRow.Item(COLUMN_FILEPATH) = String.Empty
|
||||
' ' oNewRow.Item(COLUMN_FILENAME) = oFilename
|
||||
' End If
|
||||
' oViewInfo.CalcViewInfo()
|
||||
' End If
|
||||
'End If
|
||||
'e.DefaultDraw()
|
||||
End Sub
|
||||
|
||||
Private Function TryGetItem(DataRow As DataRow, ColumnName As String, Optional DefaultValue As String = "") As String
|
||||
Try
|
||||
Return DataRow.Item(ColumnName)
|
||||
@ -545,7 +530,6 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub RestoreLayout(pGridView As GridView)
|
||||
|
||||
Try
|
||||
Dim oXml As String = GetDevexpressGrid_LayoutName(pGridView)
|
||||
pGridView.RestoreLayoutFromXml(oXml, OptionsLayoutBase.FullLayout)
|
||||
@ -569,7 +553,7 @@ Public Class frmDocumentResultList
|
||||
|
||||
Private Sub SetActiveGridBand()
|
||||
If _ActiveGrid.Equals(GridControl1) Then
|
||||
_ActiveGridBand = GridBand1
|
||||
'_ActiveGridBand = GridBand1
|
||||
ElseIf _ActiveGrid.Equals(GridControl2) Then
|
||||
_ActiveGridBand = GridBand2
|
||||
ElseIf _ActiveGrid.Equals(GridControl3) Then
|
||||
@ -669,7 +653,7 @@ Public Class frmDocumentResultList
|
||||
OpenFile()
|
||||
End Sub
|
||||
|
||||
Private Sub GridView_PopupMenuShowing(sender As Object, e As PopupMenuShowingEventArgs) Handles GridView1.PopupMenuShowing, GridView2.PopupMenuShowing, GridView3.PopupMenuShowing
|
||||
Private Sub GridView_PopupMenuShowing(sender As Object, e As PopupMenuShowingEventArgs) Handles GridView2.PopupMenuShowing, GridView3.PopupMenuShowing
|
||||
Try
|
||||
Dim oView As GridView = sender
|
||||
|
||||
@ -719,19 +703,15 @@ Public Class frmDocumentResultList
|
||||
Dim oFile = GetDevexpressGrid_LayoutName(_ActiveGrid.MainView)
|
||||
If File.Exists(oFile) Then
|
||||
File.Delete(oFile)
|
||||
UpdateGridData()
|
||||
End If
|
||||
UpdateGridData()
|
||||
Catch ex As Exception
|
||||
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmDocumentResultList_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
GridViewSave_Layout(_ActiveGrid.MainView)
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user