Async Data Loading, use ConfigManager

This commit is contained in:
Jonathan Jenne
2019-07-15 15:09:48 +02:00
parent be1f74ceb0
commit 2e296a5267
14 changed files with 309 additions and 267 deletions

View File

@@ -10,35 +10,12 @@ Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraTab
Public Class frmResultDoc
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)>
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
End Function
Public Structure SHELLEXECUTEINFO
Public cbSize As Integer
Public fMask As Integer
Public hwnd As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpVerb As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpFile As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpParameters As String
<MarshalAs(UnmanagedType.LPTStr)> Public lpDirectory As String
Dim nShow As Integer
Dim hInstApp As IntPtr
Dim lpIDList As IntPtr
<MarshalAs(UnmanagedType.LPTStr)> Public lpClass As String
Public hkeyClass As IntPtr
Public dwHotKey As Integer
Public hIcon As IntPtr
Public hProcess As IntPtr
End Structure
#Region "Laufzeitvariablen & Konstanten"
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Public Const SW_SHOW As Short = 5
Private Shared BW_DocPath As String
Private Shared BW_DocID As Integer
Private Shared CurrSearchID As Integer
Private DTDocSearchDefinition As DataTable
Private _frmDocView As frmDocView 'You need a reference to Form1
Private _frmProfileMatch As frmProfileMatch 'You need a reference to Form1
Private _frmSQL As frmResultSQL 'You need a reference to Form1
@@ -53,11 +30,80 @@ Public Class frmResultDoc
_frmSQL = frmResultSQL
_frmProfileMatch = frmProfileMatch
End Sub
Sub RefreshTabDoc(PROFILE_ID As Integer, ConID As Integer, SQLCommand As String, TabIndex As Integer, TabCaption As String)
Private Class DocSearch
Public DataTable As DataTable
Public TabIndex As Integer
Public TabCaption As String
Public ProfileId As Integer
End Class
Private Async Sub frmResultDoc_Load(sender As Object, e As EventArgs) Handles Me.Load
ToolStripDropDownButtonFile.Visible = False
If ConfigManager.Config.ResultDocWindowX > 0 And ConfigManager.Config.ResultDocWindowY > 0 Then
Dim oLocation As New Point(ConfigManager.Config.ResultDocWindowX, ConfigManager.Config.ResultDocWindowY)
Location = oLocation
End If
Dim oSize As New Size(ConfigManager.Config.ResultDocWindowWidth, ConfigManager.Config.ResultDocWindowHeight)
Size = oSize
GridViewDocSearch1.ShowLoadingPanel()
Dim oSearches = Await LoadSearchesAsync()
Await Task.Delay(4000) 'DEBUG
For Each oSearch As DocSearch In oSearches
RefreshTabDoc(oSearch.ProfileId, oSearch.DataTable, oSearch.TabIndex, oSearch.TabCaption)
Next
GridViewDocSearch1.HideLoadingPanel()
End Sub
Private Async Function LoadSearchesAsync() As Task(Of List(Of DocSearch))
Return Await Task.Run(AddressOf DoLoadSearches)
End Function
Private Function DoLoadSearches() As List(Of DocSearch)
If IsNothing(CurrDocSearch2Load) Then
Throw New ApplicationException("CurrDocSearch2Load is empty")
End If
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({CurrDocSearch2Load}) ORDER BY TAB_INDEX"
Dim oSearchesDataTable = clsDatabase.Return_Datatable(oSQL)
Dim oDocSearches As New List(Of DocSearch)
Dim oCounter As Integer = 0
DTDocSearchDefinition = oSearchesDataTable
For Each oRow As DataRow In oSearchesDataTable.Rows
Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
Dim oTabTitle As String = oRow.Item("TAB_TITLE")
oSQL = oRow.Item("SQL_COMMAND")
oSQL = clsPatterns.ReplaceAllValues(oSQL, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileId)
Dim oDatatable As DataTable = clsDatabase.Return_Datatable(oSQL)
oDocSearches.Add(New DocSearch() With {
.DataTable = oDatatable,
.ProfileId = oProfileId,
.TabCaption = oTabTitle,
.TabIndex = oCounter
})
oCounter += 1
Next
Return oDocSearches
End Function
Sub RefreshTabDoc(ProfileId As Integer, Datatable As DataTable, TabIndex As Integer, TabCaption As String)
Try
SQLCommand = clsPatterns.ReplaceAllValues(SQLCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, PROFILE_ID)
Dim myGridControl As DevExpress.XtraGrid.GridControl
Dim myGridview As DevExpress.XtraGrid.Views.Grid.GridView
Dim myGridControl As GridControl = GridControlDocSearch1
Dim myGridview As GridView = GridViewDocSearch1
Select Case TabIndex
Case 0
GridControlDocSearch1.DataSource = Nothing
@@ -85,27 +131,15 @@ Public Class frmResultDoc
myGridControl = GridControlDocSearch5
myGridview = GridViewDocSearch5
End Select
myGridControl.ContextMenuStrip = ContextMenuStripWMFile
Dim oDatatable As DataTable = clsDatabase.Return_Datatable(SQLCommand)
If Not IsNothing(oDatatable) Then
XtraTabControlDocs.TabPages(TabIndex).Text = $"{TabCaption} ({oDatatable.Rows.Count})"
clsWMDocGrid.DTDocuments = oDatatable
'Select Case TabIndex
' Case 0
' GridControlDocSearch1.DataSource = oDatatable
' Case 1
' GridControlDocSearch2.DataSource = oDatatable
' Case 2
' GridControlDocSearch3.DataSource = oDatatable
' Case 3
' GridControlDocSearch4.DataSource = oDatatable
' Case 4
' GridControlDocSearch5.DataSource = oDatatable
'End Select
Create_GridControl(myGridview, oDatatable)
Dim oxmlPath As String = ""
oxmlPath = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex)
myGridControl.ContextMenuStrip = ContextMenuStripWMFile
If Not IsNothing(Datatable) Then
XtraTabControlDocs.TabPages(TabIndex).Text = $"{TabCaption} ({Datatable.Rows.Count})"
clsWMDocGrid.DTDocuments = Datatable
Create_GridControl(myGridview, Datatable)
Dim oxmlPath As String = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex)
If File.Exists(oxmlPath) Then
myGridview.RestoreLayoutFromXml(oxmlPath)
@@ -120,31 +154,35 @@ Public Class frmResultDoc
Logger.Error(ex)
End Try
End Sub
Private Function Create_GridControl(MyGridView As GridView, _datatable As DataTable) As GridView
Private Sub Create_GridControl(MyGridView As GridView, _datatable As DataTable)
Dim oMyDocDatatable As New DataTable
Try
'Die Icon Colum erstellen und konfigurieren
Dim oColIcon As New System.Data.DataColumn()
oColIcon.DataType = GetType(Image)
oColIcon.ColumnName = "ICON"
oColIcon.Caption = ""
Dim oColIcon As New DataColumn() With {
.DataType = GetType(Image),
.ColumnName = "ICON",
.Caption = ""
}
oMyDocDatatable.Columns.Add(oColIcon)
Dim oColPath As New System.Data.DataColumn()
oColPath.DataType = GetType(String)
oColPath.ColumnName = "FULL_FILENAME"
oColPath.Caption = "Fullpath"
Dim oColPath As New DataColumn() With {
.DataType = GetType(String),
.ColumnName = "FULL_FILENAME",
.Caption = "Fullpath"
}
oMyDocDatatable.Columns.Add(oColPath)
Dim oColDocID As New System.Data.DataColumn()
oColDocID.DataType = GetType(Int32)
oColDocID.ColumnName = "DocID"
oColDocID.Caption = "DocID"
Dim oColDocID As New DataColumn() With {
.DataType = GetType(Int32),
.ColumnName = "DocID",
.Caption = "DocID"
}
oMyDocDatatable.Columns.Add(oColDocID)
Dim oRestColArray As New List(Of String)
For Each oCol As DataColumn In _datatable.Columns
Dim onewColumn As New System.Data.DataColumn()
Dim onewColumn As New DataColumn()
If oCol.ColumnName <> "DocID" And oCol.ColumnName <> "FULL_FILENAME" And oCol.ColumnName <> "Filename" Then
onewColumn.DataType = GetType(String)
onewColumn.ColumnName = oCol.ColumnName
onewColumn.Caption = oCol.Caption
@@ -213,12 +251,6 @@ Public Class frmResultDoc
Next
oMyDocDatatable.Rows.Add(oNewRow)
Next
Dim sdsd As String = ""
Dim oGridControl As GridControl = MyGridView.GridControl
oGridControl.DataSource = oMyDocDatatable
@@ -260,14 +292,14 @@ Public Class frmResultDoc
MyGridView.Columns.Item("ICON").MinWidth = 24
MyGridView.OptionsView.BestFitMaxRowCount = -1
MyGridView.BestFitColumns(True)
Return MyGridView
Catch ex As Exception
Logger.Error(ex)
End Try
End Function
End Sub
Private Function Get_DocGrid_Layout_Filename(oIndex As Integer)
Dim oFilename As String = String.Format("GridViewDoc_Search-{0}-{1}-UserLayout.xml", oIndex, CurrSearchID)
Dim oPath = System.IO.Path.Combine(Application.UserAppDataPath(), oFilename)
Dim oPath = Path.Combine(Application.UserAppDataPath(), oFilename)
Return oPath
End Function
Private Sub GridControlDocSearch_Leave(sender As Object, e As EventArgs) Handles GridControlDocSearch1.Leave, GridControlDocSearch2.Leave, GridControlDocSearch3.Leave, GridControlDocSearch4.Leave, GridControlDocSearch5.Leave
@@ -277,7 +309,6 @@ Public Class frmResultDoc
Sub SaveDocGridLayout()
Dim oXMLPath = Get_DocGrid_Layout_Filename(XtraTabControlDocs.SelectedTabPageIndex)
clsWMDocGrid.ActiveDocGrid.SaveLayoutToXml(oXMLPath)
End Sub
Private Sub EigenschaftenDateiToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenDateiToolStripMenuItem.Click
@@ -288,23 +319,13 @@ Public Class frmResultDoc
MsgBox("Could not read file Parameters!", MsgBoxStyle.Exclamation)
Exit Sub
End If
Cursor = Cursors.WaitCursor
For Each oRow As DataRow In clsWMDocGrid.DTDocuments.Rows
If oRow.Item("DOC_PATH") <> "" Then
Cursor = Cursors.WaitCursor
Dim sei As New SHELLEXECUTEINFO
sei.cbSize = Marshal.SizeOf(sei)
sei.lpVerb = "properties"
sei.lpFile = oRow.Item("DOC_PATH")
sei.nShow = SW_SHOW
sei.fMask = SEE_MASK_INVOKEIDLIST
If Not ShellExecuteEx(sei) Then
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
MsgBox("Error in Open file propertys: " & ex.Message, MsgBoxStyle.Critical)
Logger.Error(ex)
End If
End If
Cursor = Cursors.Default
Dim oWindows As New Windows(LogConfig)
oWindows.ShowFileProperties(oRow.Item("DOC_PATH"))
Next
Cursor = Cursors.Default
End Sub
Private Sub DateiÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem.Click
@@ -326,14 +347,12 @@ Public Class frmResultDoc
Private Shared Sub File_SYSOPEN(RESULT_DOC_PATH As Object, DocID As String)
Try
If RESULT_DOC_PATH <> Nothing Then
BW_DocPath = RESULT_DOC_PATH
BW_DocID = DocID
Dim BWFileHandler As New BackgroundWorker
AddHandler BWFileHandler.DoWork, AddressOf BWFileHandler_DoWork
BWFileHandler.RunWorkerAsync()
End If
Catch ex As Exception
MsgBox("Unexpected Error in File_SYSOPEN:" & vbNewLine & ex.Message & vbNewLine & RESULT_DOC_PATH & vbNewLine & "DocID: " & DocID, MsgBoxStyle.Critical)
@@ -381,8 +400,6 @@ Public Class frmResultDoc
End Try
If ToolStripDropDownButtonFile.Visible = False Then
ToolStripDropDownButtonFile.Visible = True
End If
@@ -405,7 +422,7 @@ Public Class frmResultDoc
End With
End If
Catch ex As Exception
If My.Settings.LoadDocView = True Then
If ConfigManager.Config.LoadDocumentView = True Then
Dim newDocView As New frmDocView
With newDocView
.Show()
@@ -417,21 +434,27 @@ Public Class frmResultDoc
ToolStripButtonDocView.Checked = False
End If
End Try
Me.BringToFront()
BringToFront()
Else
tslblDocID.Text = "DocRow not selected"
ToolStripDropDownButtonFile.Enabled = False
End If
End Sub
Private Sub GridViewDocSearch1_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridViewDocSearch1.FocusedRowChanged
_activeGridView = GridViewDocSearch1
Refresh_DocID(GridViewDocSearch1)
Private Sub GridViewDocSearch_FocusedRowChanged(sender As GridView, e As Views.Base.FocusedRowChangedEventArgs) Handles GridViewDocSearch1.FocusedRowChanged, GridViewDocSearch2.FocusedRowChanged, GridViewDocSearch3.FocusedRowChanged, GridViewDocSearch4.FocusedRowChanged, GridViewDocSearch5.FocusedRowChanged
_activeGridView = sender
Refresh_DocID(sender)
End Sub
Private Sub GridViewDocSearch1_ColumnWidthChanged(sender As Object, e As Views.Base.ColumnEventArgs) Handles GridViewDocSearch1.ColumnWidthChanged
_activeGridView = GridViewDocSearch1
Private Sub GridViewDocSearch_ColumnWidthChanged(sender As GridView, e As Views.Base.ColumnEventArgs) Handles GridViewDocSearch1.ColumnWidthChanged, GridViewDocSearch2.ColumnWidthChanged, GridViewDocSearch3.ColumnWidthChanged, GridViewDocSearch4.ColumnWidthChanged, GridViewDocSearch5.ColumnWidthChanged
_activeGridView = sender
SaveDocGridLayout()
End Sub
Private Sub GridControlDocSearch1_DoubleClick(sender As GridControl, e As EventArgs) Handles GridControlDocSearch1.DoubleClick, GridControlDocSearch2.DoubleClick, GridControlDocSearch3.DoubleClick, GridControlDocSearch4.DoubleClick, GridControlDocSearch5.DoubleClick
Refresh_DocID(sender.DefaultView)
FileShow()
End Sub
Private Sub ÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ÖffnenToolStripMenuItem.Click
FileShow()
End Sub
@@ -440,42 +463,13 @@ Public Class frmResultDoc
Show_File_Properties()
End Sub
Private Sub frmResultDoc_Load(sender As Object, e As EventArgs) Handles Me.Load
ToolStripDropDownButtonFile.Visible = False
If My.Settings.frmResultDocPosition.IsEmpty = False Then
If My.Settings.frmResultDocPosition.X > 0 And My.Settings.frmResultDocPosition.Y > 0 Then
Location = My.Settings.frmResultDocPosition
End If
End If
If My.Settings.frmResultDocSize.IsEmpty = False Then
Size = My.Settings.frmResultDocSize
End If
Load_Searches()
End Sub
Sub Load_Searches()
If Not IsNothing(CurrDocSearch2Load) Then
Dim oSQL = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({CurrDocSearch2Load}) ORDER BY TAB_INDEX"
DTDocSearchDefinition = clsDatabase.Return_Datatable(oSQL)
Dim oindex As Integer
Dim ocounter As Integer = 0
If CurrDocSearch2Load.ToString.Contains(",") Then
End If
For Each oRow As DataRow In DTDocSearchDefinition.Rows
RefreshTabDoc(oRow.Item("PROFILE_ID"), oRow.Item("CONN_ID"), oRow.Item("SQL_COMMAND"), ocounter, oRow.Item("TAB_TITLE"))
ocounter += 1
Next
Else
MsgBox("Sorry but the selection of profile went wrong. (CurrSearch2Load is nothing)", MsgBoxStyle.Critical)
Me.Close()
End If
End Sub
Private Sub frmResultDoc_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
' Position und Größe speichern
My.Settings.frmResultDocSize = Me.Size
My.Settings.frmResultDocPosition = Me.Location
My.Settings.Save()
ConfigManager.Config.ResultDocWindowHeight = Size.Height
ConfigManager.Config.ResultDocWindowWidth = Size.Width
ConfigManager.Config.ResultDocWindowX = Location.X
ConfigManager.Config.ResultDocWindowY = Location.Y
ConfigManager.Save()
Catch ex As Exception
Logger.Error(ex)
Logger.Info("Error in Save FormLayout: " & ex.Message)
@@ -499,7 +493,7 @@ Public Class frmResultDoc
End Try
If frmCollection.Item("frmProfileMatch").IsHandleCreated Then
If frmCollection.Item("frmProfileMatch")?.IsHandleCreated Then
frmProfileMatch.Show()
frmProfileMatch.BringToFront()
End If
@@ -537,82 +531,48 @@ Public Class frmResultDoc
End Try
End Sub
Sub ReLoad_Active_DocTab()
Dim oTabIndex = XtraTabControlDocs.SelectedTabPageIndex
Dim oConID = DTDocSearchDefinition.Rows(oTabIndex).Item("CONN_ID")
Dim oCommand = DTDocSearchDefinition.Rows(oTabIndex).Item("SQL_COMMAND")
Dim oProfID = DTDocSearchDefinition.Rows(oTabIndex).Item("PROFILE_ID")
oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfID)
RefreshTabDoc(oProfID, oConID, oCommand, oTabIndex, DTDocSearchDefinition.Rows(oTabIndex).Item("TAB_TITLE"))
End Sub
Try
Dim oTabIndex = XtraTabControlDocs.SelectedTabPageIndex
Dim oConID = DTDocSearchDefinition.Rows(oTabIndex).Item("CONN_ID")
Dim oCommand = DTDocSearchDefinition.Rows(oTabIndex).Item("SQL_COMMAND")
Dim oProfID = DTDocSearchDefinition.Rows(oTabIndex).Item("PROFILE_ID")
Dim oTabTitle = DTDocSearchDefinition.Rows(oTabIndex).Item("TAB_TITLE")
Dim oDatatable As DataTable
Private Sub GridViewDocSearch1_FocusedColumnChanged(sender As Object, e As Views.Base.FocusedColumnChangedEventArgs) Handles GridViewDocSearch1.FocusedColumnChanged
_activeGridView = GridViewDocSearch1
Refresh_DocID(GridViewDocSearch1)
End Sub
Private Sub GridViewDocSearch2_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch2.FocusedColumnChanged
_activeGridView = GridViewDocSearch2
Refresh_DocID(GridViewDocSearch2)
End Sub
Private Sub GridViewDocSearch3_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch3.FocusedColumnChanged
_activeGridView = GridViewDocSearch3
Refresh_DocID(GridViewDocSearch3)
End Sub
Private Sub GridViewDocSearch4_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch4.FocusedColumnChanged
_activeGridView = GridViewDocSearch4
Refresh_DocID(GridViewDocSearch4)
End Sub
Private Sub GridViewDocSearch5_FocusedColumnChanged(sender As Object, e As FocusedColumnChangedEventArgs) Handles GridViewDocSearch5.FocusedColumnChanged
_activeGridView = GridViewDocSearch5
Refresh_DocID(GridViewDocSearch5)
End Sub
Private Sub GridViewDocSearch2_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch2.FocusedRowChanged
_activeGridView = GridViewDocSearch2
Refresh_DocID(GridViewDocSearch2)
End Sub
Private Sub GridViewDocSearch3_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch3.FocusedRowChanged
_activeGridView = GridViewDocSearch3
Refresh_DocID(GridViewDocSearch3)
End Sub
Private Sub GridViewDocSearch4_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch4.FocusedRowChanged
_activeGridView = GridViewDocSearch4
Refresh_DocID(GridViewDocSearch4)
End Sub
Private Sub GridViewDocSearch5_FocusedRowChanged(sender As Object, e As FocusedRowChangedEventArgs) Handles GridViewDocSearch5.FocusedRowChanged
_activeGridView = GridViewDocSearch5
Refresh_DocID(GridViewDocSearch5)
End Sub
Private Sub frmResultDoc_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
End Sub
Private Sub XtraTabControlDocs_TabIndexChanged(sender As Object, e As EventArgs) Handles XtraTabControlDocs.TabIndexChanged
oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfID)
oDatatable = clsDatabase.Return_Datatable(oCommand)
RefreshTabDoc(oProfID, oDatatable, oTabIndex, oTabTitle)
Catch ex As Exception
Logger.Error(ex)
MsgBox($"Error while reloading tab data: " & vbNewLine & ex.Message)
End Try
End Sub
Private Sub XtraTabControlDocs_SelectedPageChanged(sender As Object, e As TabPageChangedEventArgs) Handles XtraTabControlDocs.SelectedPageChanged
If IsNothing(DTDocSearchDefinition) Then Exit Sub
Dim oConID = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("CONN_ID")
Dim oCommand = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("SQL_COMMAND")
Dim oProfileID = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("PROFILE_ID")
oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID)
Dim oTabIndex = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("TAB_INDEX")
Dim oTabCaption = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex).Item("TAB_TITLE")
RefreshTabDoc(oProfileID, oConID, oCommand, oTabIndex, oTabCaption)
Try
If IsNothing(DTDocSearchDefinition) Then
Exit Sub
End If
Dim oSearchDefinitionRow = DTDocSearchDefinition.Rows(XtraTabControlDocs.SelectedTabPageIndex)
Dim oConID = oSearchDefinitionRow.Item("CONN_ID")
Dim oCommand = oSearchDefinitionRow.Item("SQL_COMMAND")
Dim oProfileID = oSearchDefinitionRow.Item("PROFILE_ID")
Dim oTabIndex = oSearchDefinitionRow.Item("TAB_INDEX")
Dim oTabCaption = oSearchDefinitionRow.Item("TAB_TITLE")
Dim oDatatable As DataTable
oCommand = clsPatterns.ReplaceAllValues(oCommand, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID)
oDatatable = clsDatabase.Return_Datatable(oCommand)
RefreshTabDoc(oProfileID, oDatatable, oTabIndex, oTabCaption)
Catch ex As Exception
Logger.Error(ex)
MsgBox("Error while loading tab data: " & vbNewLine & ex.Message)
End Try
End Sub
Private Sub GridControlDocSearch1_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch1.DoubleClick
Refresh_DocID(GridViewDocSearch1)
FileShow()
End Sub
Private Sub GridControlDocSearch2_DoubleClick(sender As Object, e As EventArgs) Handles GridControlDocSearch2.DoubleClick
Refresh_DocID(GridViewDocSearch2)
FileShow()
@@ -632,11 +592,10 @@ Public Class frmResultDoc
Private Sub OrdnerÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OrdnerÖffnenToolStripMenuItem.Click
Open_Folder()
End Sub
Sub Open_Folder()
Dim oFilepath = Path.GetDirectoryName(clsWMDocGrid.SELECTED_DOC_PATH)
If System.IO.Directory.Exists(oFilepath) = True Then
If Directory.Exists(oFilepath) = True Then
Process.Start(oFilepath)
Else
MsgBox("Folder '" & oFilepath & "' not existing or accessible!", MsgBoxStyle.Exclamation)
@@ -644,7 +603,7 @@ Public Class frmResultDoc
End Sub
Private Sub ToolStripButtonDocView_Click(sender As Object, e As EventArgs) Handles ToolStripButtonDocView.Click
If My.Settings.LoadDocView = False Then
If ConfigManager.Config.LoadDocumentView = False Then
Dim newDocView As New frmDocView
With newDocView
.Show()
@@ -652,18 +611,17 @@ Public Class frmResultDoc
End With
_frmDocView = newDocView
ToolStripButtonDocView.Checked = True
My.Settings.LoadDocView = True
ConfigManager.Config.LoadDocumentView = True
Else
ToolStripButtonDocView.Checked = False
My.Settings.LoadDocView = False
ConfigManager.Config.LoadDocumentView = False
Try
_frmDocView.Close()
Catch ex As Exception
End Try
End If
My.Settings.Save()
ConfigManager.Save()
End Sub
Private Sub ToolStripButtonDocView_CheckedChanged(sender As Object, e As EventArgs) Handles ToolStripButtonDocView.CheckedChanged
@@ -675,7 +633,7 @@ Public Class frmResultDoc
End Sub
Private Sub frmResultDoc_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Me.BringToFront()
BringToFront()
CurrSearchOpen = True
End Sub
End Class