This commit is contained in:
Digital Data - Marlon Schreiber 2019-07-16 10:24:38 +02:00
commit 9be176d4ad
14 changed files with 309 additions and 267 deletions

View File

@ -6,4 +6,26 @@ Public Class ClassConfig
Public Property LogErrorsOnly As Boolean = True
Public Property HotkeyFunctionKey As String = "strg"
Public Property HotkeySearchKey As String = "f"
Public Property LoadDocumentView As Boolean = False
Public Property ViewerWindowX As Integer = 0
Public Property ViewerWindowY As Integer = 0
Public Property ViewerWindowWidth As Integer = 1024
Public Property ViewerWindowHeight As Integer = 786
Public Property MatchWindowX As Integer = 0
Public Property MatchWindowY As Integer = 0
Public Property MatchWindowWidth As Integer = 1024
Public Property MatchWindowHeight As Integer = 786
Public Property ResultDocWindowX As Integer = 0
Public Property ResultDocWindowY As Integer = 0
Public Property ResultDocWindowWidth As Integer = 1024
Public Property ResultDocWindowHeight As Integer = 786
Public Property ResultDataWindowX As Integer = 0
Public Property ResultDataWindowY As Integer = 0
Public Property ResultDataWindowWidth As Integer = 1024
Public Property ResultDataWindowHeight As Integer = 786
End Class

View File

@ -58,6 +58,8 @@
<Reference Include="DevExpress.Printing.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGauges.v18.1.Core, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGauges.v18.1.Win, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
@ -232,6 +234,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>MyDataset.xsd</DependentUpon>
</Compile>
<Compile Include="Windows.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmAbout.resx">

View File

@ -1,4 +1,5 @@
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v15.2, Version=15.2.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGauges.Win.GaugeControl, DevExpress.XtraGauges.v18.1.Win, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@ -0,0 +1,61 @@
Imports System.Runtime.InteropServices
Imports DigitalData.Modules.Logging
Public Class Windows
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_FLAG_NO_UI = &H400
Private Const SW_SHOW As Short = 5
Private _LogConfig As LogConfig
Private _Logger As Logger
<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
Public Sub New(LogConfig As LogConfig)
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
End Sub
Public Sub ShowFileProperties(FilePath As String)
If FilePath = String.Empty OrElse Not IO.File.Exists(FilePath) Then
Logger.Warn("Could not show file properties. FilePath '{0}' is invalid or does not exist.", FilePath)
Exit Sub
End If
Dim oInfo As New ShellExecuteInfo With {
.cbSize = Marshal.SizeOf(oInfo),
.lpVerb = "properties",
.lpFile = FilePath,
.nShow = SW_SHOW,
.fMask = SEE_MASK_INVOKEIDLIST
}
If Not ShellExecuteEx(oInfo) Then
Dim ex As New ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
Logger.Warn("Could not show file properties. Reason: {0}", ex.Message)
Logger.Error(ex)
End If
End Sub
End Class

View File

@ -2,13 +2,13 @@
Public Class clsWINDOWSApi
Private Declare Function GetForegroundWindow Lib "user32.dll" Alias "GetForegroundWindow" () As IntPtr
Private Declare Auto Function GetWindowText Lib "user32.dll" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
Private Declare Auto Function GetWindowText Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
Private Declare Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, ByRef lpdwProcessID As Integer) As Integer
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As IntPtr, ByVal WinTitle As String, ByVal MaxLength As Integer) As Integer
Private Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Int32) As Integer
Private Shared Function GetClassName(ByVal hWnd As System.IntPtr, _
ByVal lpClassName As System.Text.StringBuilder, _
Private Shared Function GetClassName(ByVal hWnd As IntPtr,
ByVal lpClassName As System.Text.StringBuilder,
ByVal nMaxCount As Integer) As Integer
' Leave function empty
End Function

View File

@ -57,7 +57,7 @@ Public Class frmAdministration
Me.OFDWindreamsuche.FileName = Me.WD_SEARCHTextBox.Text
End If
If Me.OFDWindreamsuche.ShowDialog = Windows.Forms.DialogResult.OK Then
If Me.OFDWindreamsuche.ShowDialog = System.Windows.Forms.DialogResult.OK Then
Me.WD_SEARCHTextBox.Text = Me.OFDWindreamsuche.FileName
End If
End Sub

View File

@ -31,7 +31,6 @@ Public Class frmConfig_Basic
'Set the construction string
MyConnectionString = con 'csb.ConnectionString
clsDatabase.Init(MyConnectionString)
My.Settings.Save()
If chkbxUserAut.Checked = False Then
Dim wrapper As New clsEncryption("!35452didalog=")
Dim cipherText As String = wrapper.EncryptData(Me.txtPasswort.Text)

View File

@ -60,14 +60,14 @@ Public Class frmDocView
ResetSearch()
UpdateMainUi()
If My.Settings.frmViewerPosition.IsEmpty = False Then
If My.Settings.frmViewerPosition.X > 0 And My.Settings.frmViewerPosition.Y > 0 Then
Location = My.Settings.frmViewerPosition
End If
End If
If My.Settings.frmViewerSize.IsEmpty = False Then
Size = My.Settings.frmViewerSize
If ConfigManager.Config.ViewerWindowX > 0 And ConfigManager.Config.ViewerWindowY > 0 Then
Dim oLocation As New Point(ConfigManager.Config.ViewerWindowX, ConfigManager.Config.ViewerWindowY)
Location = oLocation
End If
Dim oSize As New Size(ConfigManager.Config.ViewerWindowWidth, ConfigManager.Config.ViewerWindowHeight)
Size = oSize
End Sub
Public Sub Load_File_from_Path(filepath As String)
@ -755,10 +755,11 @@ Public Class frmDocView
Private Sub frmDocView_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
Try
' Position und Größe speichern
My.Settings.frmViewerSize = Me.Size
My.Settings.frmViewerPosition = Me.Location
My.Settings.Save()
ConfigManager.Config.ViewerWindowHeight = Size.Height
ConfigManager.Config.ViewerWindowWidth = Size.Width
ConfigManager.Config.ViewerWindowX = Location.X
ConfigManager.Config.ViewerWindowY = Location.Y
ConfigManager.Save()
Catch ex As Exception
Logger.Error(ex)
Logger.Info("Error in Save FormLayout: " & ex.Message)

View File

@ -2,7 +2,7 @@
Option Infer On
Option Strict On
Imports System
Imports System.Windows.Forms
Imports GdPicture14
Public Class frmPrint
@ -88,8 +88,8 @@ Public Class frmPrint
txtPageRangeStart.Text = "1"
txtPageRangeEnd.Text = m_owner.PageCount.ToString()
btnPrint.DialogResult = Windows.Forms.DialogResult.OK
btnCancel.DialogResult = Windows.Forms.DialogResult.Cancel
btnPrint.DialogResult = DialogResult.OK
btnCancel.DialogResult = DialogResult.Cancel
End Sub
Private Sub btnPrinterProperties_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPrinterProperties.Click

View File

@ -1,17 +1,15 @@
Imports DevExpress.XtraEditors
Imports DevExpress.XtraGrid.Views.Tile
Imports DevExpress.XtraGrid.Views.Tile.ViewInfo
Public Class frmProfileMatch
Private Sub frmProfileMatch_Load(sender As Object, e As EventArgs) Handles Me.Load
If My.Settings.frmProfileMatchPosition.IsEmpty = False Then
If My.Settings.frmProfileMatchPosition.X > 0 And My.Settings.frmProfileMatchPosition.Y > 0 Then
Location = My.Settings.frmProfileMatchPosition
End If
End If
If My.Settings.frmProfileMatchSize.IsEmpty = False Then
Size = My.Settings.frmProfileMatchSize
If ConfigManager.Config.MatchWindowX > 0 And ConfigManager.Config.MatchWindowY > 0 Then
Dim oLocation As New Point(ConfigManager.Config.MatchWindowX, ConfigManager.Config.MatchWindowY)
Location = oLocation
End If
Dim oSize As New Size(ConfigManager.Config.MatchWindowWidth, ConfigManager.Config.MatchWindowHeight)
Size = oSize
If USER_LANGUAGE = "de-DE" Then
Me.Label1.Text = $"Clipboard Watcher hat mehr als einen Match für Ihre Suche [{CURR_MATCH_RESULT}] gefunden:"
Else
@ -78,10 +76,11 @@ Public Class frmProfileMatch
Private Sub frmProfileMatch_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
' Position und Größe speichern
My.Settings.frmProfileMatchSize = Me.Size
My.Settings.frmProfileMatchPosition = Me.Location
My.Settings.Save()
ConfigManager.Config.MatchWindowHeight = Size.Height
ConfigManager.Config.MatchWindowWidth = Size.Width
ConfigManager.Config.MatchWindowX = Location.X
ConfigManager.Config.MatchWindowY = Location.Y
ConfigManager.Save()
Catch ex As Exception
Logger.Error(ex)
Logger.Info("Error in Save FormLayout: " & ex.Message)

View File

@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmResultDoc
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@ -20,10 +20,9 @@ Partial Class frmResultDoc
'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()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim GridLevelNode1 As DevExpress.XtraGrid.GridLevelNode = New DevExpress.XtraGrid.GridLevelNode()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmResultDoc))
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tslblDocID = New System.Windows.Forms.ToolStripStatusLabel()
@ -97,11 +96,12 @@ Partial Class frmResultDoc
'
Me.tslblState.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.StatusAnnotations_Alert_32xMD_color
Me.tslblState.Name = "tslblState"
Me.tslblState.Size = New System.Drawing.Size(107, 17)
Me.tslblState.Text = "No action so far"
Me.tslblState.Size = New System.Drawing.Size(75, 17)
Me.tslblState.Text = "Loading..."
'
'ToolStrip1
'
Me.ToolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripDropDownButtonFile, Me.ToolStripButtonDocView})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
@ -123,14 +123,14 @@ Partial Class frmResultDoc
'
Me.ÖffnenToolStripMenuItem.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.OpenFile
Me.ÖffnenToolStripMenuItem.Name = "ÖffnenToolStripMenuItem"
Me.ÖffnenToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.ÖffnenToolStripMenuItem.Size = New System.Drawing.Size(148, 22)
Me.ÖffnenToolStripMenuItem.Text = "Öffnen"
'
'EigenschaftenToolStripMenuItem
'
Me.EigenschaftenToolStripMenuItem.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.properties_16xMD
Me.EigenschaftenToolStripMenuItem.Name = "EigenschaftenToolStripMenuItem"
Me.EigenschaftenToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.EigenschaftenToolStripMenuItem.Size = New System.Drawing.Size(148, 22)
Me.EigenschaftenToolStripMenuItem.Text = "Eigenschaften"
'
'ToolStripButtonDocView
@ -165,8 +165,6 @@ Partial Class frmResultDoc
'
Me.GridControlDocSearch1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridControlDocSearch1.EmbeddedNavigator.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
GridLevelNode1.RelationName = "Level1"
Me.GridControlDocSearch1.LevelTree.Nodes.AddRange(New DevExpress.XtraGrid.GridLevelNode() {GridLevelNode1})
Me.GridControlDocSearch1.Location = New System.Drawing.Point(0, 0)
Me.GridControlDocSearch1.MainView = Me.GridViewDocSearch1
Me.GridControlDocSearch1.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)

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
@ -539,82 +533,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()
@ -634,11 +594,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)
@ -646,7 +605,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()
@ -654,18 +613,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
@ -677,7 +635,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

View File

@ -117,14 +117,14 @@ Public Class frmResultSQL
End Sub
Private Sub frmResultDoc_Load(sender As Object, e As EventArgs) Handles Me.Load
If My.Settings.frmResultDataPosition.IsEmpty = False Then
If My.Settings.frmResultDataPosition.X > 0 And My.Settings.frmResultDataPosition.Y > 0 Then
Location = My.Settings.frmResultDataPosition
End If
End If
If My.Settings.frmResultDataSize.IsEmpty = False Then
Size = My.Settings.frmResultDataSize
If ConfigManager.Config.ResultDataWindowX > 0 And ConfigManager.Config.ResultDataWindowY > 0 Then
Dim oLocation As New Point(ConfigManager.Config.ResultDataWindowX, ConfigManager.Config.ResultDataWindowY)
Location = oLocation
End If
Dim oSize As New Size(ConfigManager.Config.ResultDataWindowWidth, ConfigManager.Config.ResultDataWindowHeight)
Size = oSize
Load_Searches()
End Sub
Sub Load_Searches()
@ -147,10 +147,11 @@ Public Class frmResultSQL
End Sub
Private Sub frmResultDoc_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
' Position und Größe speichern
My.Settings.frmResultDataSize = Me.Size
My.Settings.frmResultDataPosition = Me.Location
My.Settings.Save()
ConfigManager.Config.ResultDataWindowHeight = Size.Height
ConfigManager.Config.ResultDataWindowWidth = Size.Width
ConfigManager.Config.ResultDataWindowX = Location.X
ConfigManager.Config.ResultDataWindowY = Location.Y
ConfigManager.Save()
Catch ex As Exception
Logger.Error(ex)
Logger.Info("Error in Save FormLayout: " & ex.Message)

View File

@ -160,7 +160,6 @@ Public Class frmStart
clsDatabase.Execute_non_Query(sql, True)
ClassWindowLocation.SaveFormLocationSize(Me, "")
My.Settings.Save()
Catch ex As Exception
End Try