Common: improve file watcher, fix refreshing data after update
This commit is contained in:
parent
533df59b1f
commit
c6e67a967c
@ -0,0 +1 @@
|
||||
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
@ -9,9 +9,10 @@ Public Class ProfileSearches
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
Private _Environment As Environment
|
||||
Private _Params As ClipboardWatcherParams
|
||||
Private _Client As Client
|
||||
|
||||
Private _ClipboardContents As String
|
||||
|
||||
Public Class Search
|
||||
Public Guid As Integer
|
||||
Public DataTable As DataTable
|
||||
@ -21,11 +22,11 @@ Public Class ProfileSearches
|
||||
Public SQLCommand As String
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ClipboardWatcherParams)
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, pClipboardContents As String)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Environment = Environment
|
||||
_Params = Params
|
||||
_ClipboardContents = pClipboardContents
|
||||
Try
|
||||
If _Environment.Service.IsActive = True Then
|
||||
Try
|
||||
@ -84,7 +85,7 @@ Public Class ProfileSearches
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _ClipboardContents)
|
||||
|
||||
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
|
||||
|
||||
@ -150,7 +151,7 @@ Public Class ProfileSearches
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _ClipboardContents)
|
||||
|
||||
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
|
||||
|
||||
|
||||
@ -41,8 +41,11 @@ Public Class frmMatch
|
||||
Private ShouldHideInitially As Boolean = False
|
||||
|
||||
Private Const NO_COUNT_SQL As Integer = 99998
|
||||
|
||||
Private Const INVALID_COUNT_SQL As Integer = 99999
|
||||
|
||||
'Public Event ResultsRefreshed As EventHandler
|
||||
|
||||
Private Enum ProfileType
|
||||
ANY = 0
|
||||
DOCS_ONLY = 1
|
||||
@ -133,7 +136,7 @@ Public Class frmMatch
|
||||
|
||||
If oCreatedTiles = 1 Then
|
||||
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
|
||||
|
||||
If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then
|
||||
_Logger.Debug($"ONLY Docs")
|
||||
@ -308,7 +311,7 @@ Public Class frmMatch
|
||||
Dim oItem As TileItem = e.Item
|
||||
Dim oProfileId As Integer = oItem.Tag
|
||||
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
|
||||
Dim oProfile As ProfileData = _Params.MatchingProfiles.
|
||||
Where(Function(p) p.Guid = oProfileId).
|
||||
ToList().
|
||||
@ -345,7 +348,8 @@ Public Class frmMatch
|
||||
Dim oParams = New DocumentResultList.Params() With {
|
||||
.WindowGuid = oWindowGuid,
|
||||
.WindowTitle = GetResultWindowString(_Params.ClipboardContents),
|
||||
.OperationModeOverride = _Params.OperationModeOverride
|
||||
.OperationModeOverride = _Params.OperationModeOverride,
|
||||
.ProfileGuid = Profile.Guid
|
||||
}
|
||||
|
||||
For Each oSearch In Searches
|
||||
@ -357,8 +361,11 @@ Public Class frmMatch
|
||||
|
||||
Dim oForm As New frmDocumentResultList(_LogConfig, _Environment, oParams)
|
||||
AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
|
||||
AddHandler oForm.NeedsRefresh, AddressOf ProfileResultForm_NeedsRefresh
|
||||
|
||||
OpenForms.Add(oForm)
|
||||
oForm.Show()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub OpenDataResults(Profile As ProfileData, Searches As List(Of ProfileSearches.Search))
|
||||
@ -406,4 +413,23 @@ Public Class frmMatch
|
||||
Show()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Async Sub ProfileResultForm_NeedsRefresh(sender As Object, e As Integer)
|
||||
Dim oThisForm As IResultForm = sender
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params.ClipboardContents)
|
||||
|
||||
If TypeOf sender Is frmDocumentResultList Then
|
||||
Dim oProfileId = e
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfileId)
|
||||
Dim oResults = oSearches.Select(Function(search)
|
||||
Return New DocumentResultList.DocumentResult() With {
|
||||
.Title = search.TabCaption,
|
||||
.Datatable = search.DataTable
|
||||
}
|
||||
End Function).ToList()
|
||||
|
||||
'RaiseEvent ResultsRefreshed(Me, Nothing)
|
||||
oThisForm.RefreshResults(oResults)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -190,6 +190,10 @@
|
||||
<Project>{3DCD6D1A-C830-4241-B7E4-27430E7EA483}</Project>
|
||||
<Name>LookupControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MessageBoxEx\MessageBoxEx.vbproj">
|
||||
<Project>{ef29f400-be45-4283-9d18-ca7acd9accc9}</Project>
|
||||
<Name>MessageBoxEx</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Base\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
@ -303,5 +307,14 @@
|
||||
<ItemGroup>
|
||||
<None Include="Resources\editcolors.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\actions_question.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{94E38DFF-614B-4CBD-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\refreshallpivottable.svg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@ -33,6 +33,8 @@ Public Class frmDataResultList
|
||||
|
||||
Private Property OperationMode As OperationMode Implements IResultForm.OperationMode
|
||||
|
||||
Public Event NeedsRefresh As EventHandler(Of Integer) Implements IResultForm.NeedsRefresh
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As DataResultParams)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
|
||||
@ -10,6 +10,7 @@ Namespace DocumentResultList
|
||||
Public Results As New List(Of DocumentResult)
|
||||
Public ColumnNames As New ColumnNames
|
||||
Public OperationModeOverride As OperationMode = OperationMode.None
|
||||
Public ProfileGuid As Integer
|
||||
End Class
|
||||
|
||||
Public Class DocumentResult
|
||||
|
||||
@ -35,6 +35,7 @@ Namespace DocumentResultList
|
||||
Public ProcessId As Integer
|
||||
Public FilePath As String
|
||||
Public CurrentlyProcessing As Boolean = False
|
||||
Public Exited As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Class FileChangedArgs
|
||||
@ -51,11 +52,11 @@ Namespace DocumentResultList
|
||||
End Sub
|
||||
|
||||
Public Async Function OpenDocument(pDocument As Document) As Task(Of Boolean)
|
||||
Dim oResult As Tuple(Of Process, String) = Nothing
|
||||
Dim oResult As Tuple(Of Integer, String) = Nothing
|
||||
|
||||
If pDocument.FullPath IsNot Nothing AndAlso pDocument.FullPath.Trim <> String.Empty Then
|
||||
' TODO: DONT put into openfiles
|
||||
oResult = OpenFileFromPath(pDocument)
|
||||
oResult = Await OpenFileFromPath(pDocument)
|
||||
|
||||
ElseIf pDocument.Extension IsNot Nothing AndAlso pDocument.Contents IsNot Nothing Then
|
||||
oResult = Await OpenFileFromByteArray(pDocument)
|
||||
@ -67,15 +68,15 @@ Namespace DocumentResultList
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oProcess = oResult.Item1
|
||||
Dim oProcessId = oResult.Item1
|
||||
Dim oFilePath = oResult.Item2
|
||||
|
||||
Logger.Debug("File [{0}] opened with ProcessId [{1}]", oFilePath, oProcess.Id)
|
||||
Logger.Debug("File [{0}] opened with ProcessId [{1}]", oFilePath, oProcessId)
|
||||
|
||||
Dim oOpenFile = New OpenFile With {
|
||||
.Document = pDocument,
|
||||
.FilePath = oFilePath,
|
||||
.ProcessId = oProcess.Id
|
||||
.ProcessId = oProcessId
|
||||
}
|
||||
OpenFiles.Add(oOpenFile)
|
||||
|
||||
@ -97,7 +98,7 @@ Namespace DocumentResultList
|
||||
ProcessedFiles.Remove(pOpenFile)
|
||||
End Sub
|
||||
|
||||
Private Async Function OpenFileFromByteArray(pDocument As Document) As Task(Of Tuple(Of Process, String))
|
||||
Private Async Function OpenFileFromByteArray(pDocument As Document) As Task(Of Tuple(Of Integer, String))
|
||||
Try
|
||||
Dim oTempPath = Path.Combine(Path.GetTempPath(), Constants.TEMP_PATH_SUBFOLDER)
|
||||
Dim oDirectory = Directory.CreateDirectory(oTempPath)
|
||||
@ -110,8 +111,9 @@ Namespace DocumentResultList
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Dim oProcess = DoOpenFile(oFilePath)
|
||||
Return New Tuple(Of Process, String)(oProcess, oFilePath)
|
||||
Dim oProcessId = Await DoOpenFile(oFilePath)
|
||||
|
||||
Return New Tuple(Of Integer, String)(oProcessId, oFilePath)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@ -120,10 +122,10 @@ Namespace DocumentResultList
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function OpenFileFromPath(pDocument As Document) As Tuple(Of Process, String)
|
||||
Private Async Function OpenFileFromPath(pDocument As Document) As Task(Of Tuple(Of Integer, String))
|
||||
Try
|
||||
Dim oProcess = DoOpenFile(pDocument.FullPath)
|
||||
Return New Tuple(Of Process, String)(oProcess, pDocument.FullPath)
|
||||
Dim oProcessId = Await DoOpenFile(pDocument.FullPath)
|
||||
Return New Tuple(Of Integer, String)(oProcessId, pDocument.FullPath)
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@ -131,12 +133,28 @@ Namespace DocumentResultList
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function DoOpenFile(pFilePath As String) As Process
|
||||
Dim oProcess = Process.Start(New ProcessStartInfo With {
|
||||
.FileName = pFilePath
|
||||
})
|
||||
Private Async Function DoOpenFile(pFilePath As String) As Task(Of Integer)
|
||||
Dim _Process = New Process
|
||||
_Process.StartInfo.FileName = pFilePath
|
||||
_Process.EnableRaisingEvents = True
|
||||
|
||||
Return oProcess
|
||||
AddHandler _Process.Exited, AddressOf Process_Exited
|
||||
|
||||
_Process.Start()
|
||||
|
||||
Return _Process.Id
|
||||
End Function
|
||||
|
||||
Private Function Process_Exited(sender As Object, e As EventArgs) As Boolean
|
||||
Debug.WriteLine("Process is exited")
|
||||
|
||||
Dim oProcess As Process = sender
|
||||
Dim oOpenFile = OpenFiles.
|
||||
Where(Function(file) file.ProcessId = oProcess.Id).
|
||||
SingleOrDefault()
|
||||
oOpenFile.Exited = True
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub FileOpenTimer_Elapsed() Handles FileOpenTimer.Elapsed
|
||||
@ -154,9 +172,11 @@ Namespace DocumentResultList
|
||||
|
||||
' Check if the file is currently in use, and skip if it is.
|
||||
Dim oIsLocked = FileEx.TestFileIsLocked(oOpenFile.FilePath)
|
||||
Dim oIsExited = oOpenFile.Exited
|
||||
Debug.WriteLine($"File is locked: [{oIsLocked}]")
|
||||
Debug.WriteLine($"File is exited: [{oIsExited}]")
|
||||
|
||||
If oIsLocked Then
|
||||
If oIsLocked Or oIsExited = False Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
|
||||
Public Interface IResultForm
|
||||
Property OperationMode As OperationMode
|
||||
|
||||
Property ShouldReturnToPreviousForm As Boolean
|
||||
|
||||
|
||||
Event NeedsRefresh As EventHandler(Of Integer)
|
||||
|
||||
Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean
|
||||
End Interface
|
||||
|
||||
20
GUIs.Common/My Project/Resources.Designer.vb
generated
20
GUIs.Common/My Project/Resources.Designer.vb
generated
@ -80,6 +80,16 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
|
||||
'''</summary>
|
||||
Friend ReadOnly Property actions_question() As DevExpress.Utils.Svg.SvgImage
|
||||
Get
|
||||
Dim obj As Object = ResourceManager.GetObject("actions_question", resourceCulture)
|
||||
Return CType(obj,DevExpress.Utils.Svg.SvgImage)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||
'''</summary>
|
||||
@ -230,6 +240,16 @@ Namespace My.Resources
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
|
||||
'''</summary>
|
||||
Friend ReadOnly Property refreshallpivottable() As DevExpress.Utils.Svg.SvgImage
|
||||
Get
|
||||
Dim obj As Object = ResourceManager.GetObject("refreshallpivottable", resourceCulture)
|
||||
Return CType(obj,DevExpress.Utils.Svg.SvgImage)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
|
||||
'''</summary>
|
||||
|
||||
@ -127,6 +127,9 @@
|
||||
<data name="tiff" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\tiff.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_blank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\_blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ZooFlow-Vergroessern" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ZooFlow-Vergroessern.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
@ -172,6 +175,9 @@
|
||||
<data name="zoom_more" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\zoom_more.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="actions_question" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\actions_question.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name="grid" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\grid.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
@ -181,8 +187,8 @@
|
||||
<data name="dxf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\dxf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="_blank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\_blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="editcolors" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\editcolors.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name="singlepageview1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\singlepageview1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
@ -190,7 +196,7 @@
|
||||
<data name="copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\copy.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name="editcolors" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\editcolors.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
<data name="refreshallpivottable" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\refreshallpivottable.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1,3 +1,4 @@
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
15
GUIs.Common/Resources/actions_question.svg
Normal file
15
GUIs.Common/Resources/actions_question.svg
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<svg x="0px" y="0px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="Layer_1" style="enable-background:new 0 0 32 32">
|
||||
<style type="text/css">
|
||||
.Blue{fill:#1177D7;}
|
||||
.Yellow{fill:#FFB115;}
|
||||
.Black{fill:#727272;}
|
||||
.Green{fill:#039C23;}
|
||||
.Red{fill:#D11C1C;}
|
||||
.st0{opacity:0.75;}
|
||||
.st1{opacity:0.5;}
|
||||
</style>
|
||||
<g id="Question">
|
||||
<path d="M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14S23.7,2,16,2z M16,24c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2 s2,0.9,2,2C18,23.1,17.1,24,16,24z M20.7,13.3c-0.2,0.4-0.4,0.7-0.6,1c-0.3,0.3-0.5,0.5-0.8,0.7c-0.3,0.2-0.6,0.4-0.9,0.6 c-0.3,0.2-0.5,0.4-0.7,0.7c-0.2,0.3-0.3,0.6-0.4,1V18h-2.7v-0.9c0-0.6,0.2-1,0.3-1.4c0.2-0.4,0.4-0.7,0.6-1 c0.2-0.3,0.5-0.5,0.8-0.7c0.3-0.2,0.5-0.4,0.8-0.6c0.2-0.2,0.4-0.4,0.6-0.6c0.1-0.2,0.2-0.5,0.2-0.9c0-0.6-0.2-1-0.5-1.3 c-0.3-0.3-0.7-0.4-1.3-0.4c-0.4,0-0.7,0.1-0.9,0.2c-0.3,0.1-0.5,0.3-0.7,0.5c-0.2,0.2-0.3,0.5-0.4,0.8C14,12.1,14,12.7,14,13h-3 c0-0.7,0.1-1.6,0.4-2.1c0.2-0.6,0.6-1.1,1-1.5c0.4-0.4,0.9-0.8,1.5-1c0.6-0.2,1.3-0.4,2-0.4c1,0,1.8,0.1,2.4,0.4 c0.6,0.3,1.2,0.6,1.6,0.9c0.4,0.4,0.7,0.8,0.8,1.2s0.3,0.8,0.3,1.2C21,12.4,20.9,12.9,20.7,13.3z" class="Green" />
|
||||
</g>
|
||||
</svg>
|
||||
7
GUIs.Common/Resources/refreshallpivottable.svg
Normal file
7
GUIs.Common/Resources/refreshallpivottable.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<svg x="0px" y="0px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="Refresh_All_Pivot_Table" style="enable-background:new 0 0 32 32">
|
||||
<style type="text/css">
|
||||
.Green{fill:#039C23;}
|
||||
</style>
|
||||
<path d="M30,2v12h-0.2h-4H18l5-5c-1.8-1.8-4.3-3-7-3c-4.8,0-8.9,3.4-9.8,8h-4C3.1,7.2,8.9,2,16,2 c3.9,0,7.4,1.6,9.9,4.1L30,2z M16,26c-2.8,0-5.2-1.1-7-3l5-5H6.2h-4H2v12l4.1-4.1c2.5,2.5,6,4.1,9.9,4.1c7.1,0,12.9-5.2,13.8-12h-4 C24.9,22.6,20.8,26,16,26z" class="Green" />
|
||||
</svg>
|
||||
14
GUIs.Common/frmDocumentResultList.Designer.vb
generated
14
GUIs.Common/frmDocumentResultList.Designer.vb
generated
@ -43,6 +43,7 @@ Partial Class frmDocumentResultList
|
||||
Me.MenuItemPropertiesECM = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.MenuItemsOpenFileZooFlow = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.MenuItemPropertiesZooFlow = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.ButtonRefresh = New DevExpress.XtraBars.BarButtonItem()
|
||||
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
|
||||
Me.RibbonPageGroup_Navigation = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
Me.RibbonPageGroup_Layout = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
|
||||
@ -150,9 +151,9 @@ Partial Class frmDocumentResultList
|
||||
'RibbonControl
|
||||
'
|
||||
Me.RibbonControl.ExpandCollapseItem.Id = 0
|
||||
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.SwitchMainContainerHorizontal, Me.SwitchDetailContainerHorizontal, Me.BarButtonItemExportGrid1, Me.BarStaticItem1, Me.labelResultCount, Me.BarButtonBack, Me.BarButtonResetLayout, Me.labelCriticalError, Me.labelWarning, Me.MenuItemFileOpen, Me.MenuItemPropertiesIDB, Me.MenuItemFolderOpen, Me.MenuItemFilepathCopy, Me.MenuItemFolderpathCopy, Me.MenuItemPropertiesECM, Me.MenuItemsOpenFileZooFlow, Me.MenuItemPropertiesZooFlow})
|
||||
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.SwitchMainContainerHorizontal, Me.SwitchDetailContainerHorizontal, Me.BarButtonItemExportGrid1, Me.BarStaticItem1, Me.labelResultCount, Me.BarButtonBack, Me.BarButtonResetLayout, Me.labelCriticalError, Me.labelWarning, Me.MenuItemFileOpen, Me.MenuItemPropertiesIDB, Me.MenuItemFolderOpen, Me.MenuItemFilepathCopy, Me.MenuItemFolderpathCopy, Me.MenuItemPropertiesECM, Me.MenuItemsOpenFileZooFlow, Me.MenuItemPropertiesZooFlow, Me.ButtonRefresh})
|
||||
resources.ApplyResources(Me.RibbonControl, "RibbonControl")
|
||||
Me.RibbonControl.MaxItemId = 29
|
||||
Me.RibbonControl.MaxItemId = 30
|
||||
Me.RibbonControl.Name = "RibbonControl"
|
||||
Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
|
||||
Me.RibbonControl.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemTextEdit1, Me.RepositoryItemTextEdit2})
|
||||
@ -295,6 +296,13 @@ Partial Class frmDocumentResultList
|
||||
Me.MenuItemPropertiesZooFlow.ImageOptions.SvgImage = Global.DigitalData.GUIs.Common.My.Resources.Resources.editcolors
|
||||
Me.MenuItemPropertiesZooFlow.Name = "MenuItemPropertiesZooFlow"
|
||||
'
|
||||
'BarButtonItem1
|
||||
'
|
||||
resources.ApplyResources(Me.ButtonRefresh, "BarButtonItem1")
|
||||
Me.ButtonRefresh.Id = 29
|
||||
Me.ButtonRefresh.ImageOptions.SvgImage = Global.DigitalData.GUIs.Common.My.Resources.Resources.refreshallpivottable
|
||||
Me.ButtonRefresh.Name = "BarButtonItem1"
|
||||
'
|
||||
'RibbonPage1
|
||||
'
|
||||
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup_Navigation, Me.RibbonPageGroup_Layout, Me.RibbonPageGroup_Export})
|
||||
@ -305,6 +313,7 @@ Partial Class frmDocumentResultList
|
||||
'
|
||||
Me.RibbonPageGroup_Navigation.AllowTextClipping = False
|
||||
Me.RibbonPageGroup_Navigation.ItemLinks.Add(Me.BarButtonBack)
|
||||
Me.RibbonPageGroup_Navigation.ItemLinks.Add(Me.ButtonRefresh)
|
||||
Me.RibbonPageGroup_Navigation.Name = "RibbonPageGroup_Navigation"
|
||||
resources.ApplyResources(Me.RibbonPageGroup_Navigation, "RibbonPageGroup_Navigation")
|
||||
'
|
||||
@ -571,4 +580,5 @@ Partial Class frmDocumentResultList
|
||||
Friend WithEvents MenuFullAccess_ZOOFLOW As DevExpress.XtraBars.PopupMenu
|
||||
Friend WithEvents MenuItemsOpenFileZooFlow As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents MenuItemPropertiesZooFlow As DevExpress.XtraBars.BarButtonItem
|
||||
Friend WithEvents ButtonRefresh As DevExpress.XtraBars.BarButtonItem
|
||||
End Class
|
||||
|
||||
@ -426,6 +426,9 @@
|
||||
<data name="MenuItemPropertiesZooFlow.Caption" xml:space="preserve">
|
||||
<value>Eigenschaften</value>
|
||||
</data>
|
||||
<data name="BarButtonItem1.Caption" xml:space="preserve">
|
||||
<value>Ergebnisse aktualisieren</value>
|
||||
</data>
|
||||
<data name="RibbonControl.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
@ -975,6 +978,12 @@
|
||||
<data name=">>MenuItemPropertiesZooFlow.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>BarButtonItem1.Name" xml:space="preserve">
|
||||
<value>BarButtonItem1</value>
|
||||
</data>
|
||||
<data name=">>BarButtonItem1.Type" xml:space="preserve">
|
||||
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name=">>RibbonPage1.Name" xml:space="preserve">
|
||||
<value>RibbonPage1</value>
|
||||
</data>
|
||||
|
||||
@ -20,6 +20,7 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DigitalData.Modules.ZooFlow.Constants
|
||||
Imports DigitalData.Modules.Base.IDB.FileStore
|
||||
Imports DigitalData.Controls.MessageBoxEx
|
||||
|
||||
Public Class frmDocumentResultList
|
||||
Implements IResultForm
|
||||
@ -46,7 +47,6 @@ Public Class frmDocumentResultList
|
||||
Private ReadOnly Logger As Logger
|
||||
Private ReadOnly Config As ConfigManager(Of DocumentResultList.Config)
|
||||
Private ReadOnly Environment As Environment
|
||||
Private ReadOnly ResultLists As List(Of DocumentResultList.DocumentResult)
|
||||
Private ReadOnly Filesystem As Modules.Filesystem.File
|
||||
Private ReadOnly GridBuilder As GridBuilder
|
||||
Private ReadOnly FileEx As Modules.Windows.File
|
||||
@ -59,6 +59,8 @@ Public Class frmDocumentResultList
|
||||
Private Documentloader As DocumentResultList.Loader
|
||||
|
||||
' Runtime variables
|
||||
Private Property _ResultLists As List(Of DocumentResultList.DocumentResult)
|
||||
|
||||
Private _IsLoading As Boolean = True
|
||||
Private _ActiveGrid As GridControl = Nothing
|
||||
Private _ActiveGridBand As GridBand = Nothing
|
||||
@ -72,6 +74,11 @@ Public Class frmDocumentResultList
|
||||
|
||||
Public Property ShouldReturnToPreviousForm As Boolean = False Implements IResultForm.ShouldReturnToPreviousForm
|
||||
|
||||
Public Event NeedsRefresh As EventHandler(Of Integer) Implements IResultForm.NeedsRefresh
|
||||
Public Event ResultsRefreshed As EventHandler(Of List(Of DocumentResultList.DocumentResult))
|
||||
|
||||
Public Delegate Sub SetDatasourceCallback(pDatatable As DataTable)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pParams As DocumentResultList.Params)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
@ -96,7 +103,7 @@ Public Class frmDocumentResultList
|
||||
|
||||
Environment = pEnvironment
|
||||
Params = pParams
|
||||
ResultLists = pParams.Results
|
||||
_ResultLists = pParams.Results
|
||||
|
||||
_Language = Utils.NotNull(Me.Environment.User.Language, State.UserState.LANG_EN_US)
|
||||
End Sub
|
||||
@ -127,6 +134,8 @@ Public Class frmDocumentResultList
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Documentloader = New DocumentResultList.Loader(LogConfig, OperationMode, _IDBClient, Environment.User)
|
||||
|
||||
If Params.WindowTitle <> "" Then
|
||||
@ -316,26 +325,29 @@ Public Class frmDocumentResultList
|
||||
MsgBox($"Beim Speichern der Datei '{oFileInfo.Name}' Fehler ist ein Fehler aufgetreten!", MsgBoxStyle.Critical, Text)
|
||||
Else
|
||||
MsgBox($"Die Datei '{oFileInfo.Name}' wurde erfolgreich gespeichert!", MsgBoxStyle.Information, Text)
|
||||
RaiseEvent NeedsRefresh(Me, Params.ProfileGuid)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Async Function Watcher_Ask(pFile As DocumentResultList.Watcher.OpenFile) As Task
|
||||
Dim oFileInfo = New FileInfo(pFile.FilePath)
|
||||
Dim oMessage = $"Die Datei '{oFileInfo.Name}' wurde außerhalb des Systems verändert. Wollen Sie diese Änderung als neue Version in das System übernehmen? 'Nein' überschreibt die ursprüngliche Datei."
|
||||
Dim oResult As DialogResult = MsgBox(oMessage, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, "Datei verändert")
|
||||
Dim oMessage = $"Die Datei '{oFileInfo.Name}' wurde außerhalb des Systems verändert. Wollen Sie diese Änderung als neue Version in das System übernehmen oder überschreiben?"
|
||||
|
||||
Select Case oResult
|
||||
Case DialogResult.Yes
|
||||
Await Watcher_VersionFile(pFile)
|
||||
Dim oMessageBox As New MsgBoxEx(oMessage, "Datei verändert", MessageBoxIcon.Question)
|
||||
oMessageBox.SetButtons("Überschreiben", "Neue Version", "Abbrechen")
|
||||
oMessageBox.ShowDialog()
|
||||
|
||||
Case DialogResult.No
|
||||
Select Case oMessageBox.Result
|
||||
Case MsgBoxEx.DialogBoxResult.Button1
|
||||
Await Watcher_OverwriteFile(pFile)
|
||||
|
||||
Case MsgBoxEx.DialogBoxResult.Button2
|
||||
Await Watcher_VersionFile(pFile)
|
||||
|
||||
Case Else
|
||||
' Cancel, do nothing
|
||||
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
@ -366,7 +378,8 @@ Public Class frmDocumentResultList
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MessageBox.Show("Error while loading results:" & vbNewLine & vbNewLine & ex.Message, Text)
|
||||
|
||||
MessageBox.Show("Error while loading results:" & vbNewLine & vbNewLine & ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
Return False
|
||||
Finally
|
||||
_IsLoading = False
|
||||
@ -382,37 +395,49 @@ Public Class frmDocumentResultList
|
||||
Throw New ApplicationException($"Datatable is missing Filepath Column [{COLUMN_FILEPATH}] for search {Result.Title}!")
|
||||
End If
|
||||
|
||||
GridControl1.DataSource = Result.Datatable
|
||||
GridControl1.ForceInitialize()
|
||||
' This is needed to update the grid from another form like frmMatch
|
||||
' Another form means another thread, so we need a delegate here
|
||||
If GridControl1.InvokeRequired Then
|
||||
Dim oCallback As New SetDatasourceCallback(AddressOf SetGridDataSource)
|
||||
Invoke(oCallback, Result.Datatable)
|
||||
|
||||
Else
|
||||
SetGridDataSource(Result.Datatable)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SetGridDataSource(pTable As DataTable)
|
||||
GridControl1.DataSource = Nothing
|
||||
GridControl1.DataSource = pTable
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateGridData()
|
||||
' Load Grids
|
||||
For oIndex = 0 To ResultLists.Count - 1
|
||||
For oIndex = 0 To _ResultLists.Count - 1
|
||||
Select Case oIndex
|
||||
Case 0
|
||||
Dim oResult As DocumentResultList.DocumentResult = ResultLists.Item(0)
|
||||
Dim oResult As DocumentResultList.DocumentResult = _ResultLists.Item(0)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView1, oResult)
|
||||
RestoreLayout(GridView1)
|
||||
UpdateGridHeader(ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 1
|
||||
Dim oResult As DocumentResultList.DocumentResult = ResultLists.Item(1)
|
||||
Dim oResult As DocumentResultList.DocumentResult = _ResultLists.Item(1)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView2, oResult)
|
||||
RestoreLayout(GridView2)
|
||||
UpdateGridHeader(ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case 2
|
||||
Dim oResult As DocumentResultList.DocumentResult = ResultLists.Item(2)
|
||||
Dim oResult As DocumentResultList.DocumentResult = _ResultLists.Item(2)
|
||||
|
||||
LoadGridData(oResult)
|
||||
CreateDocumentGrid(GridView3, oResult)
|
||||
RestoreLayout(GridView3)
|
||||
UpdateGridHeader(ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
UpdateGridHeader(_ResultLists, oIndex, oResult.Datatable.Rows.Count)
|
||||
|
||||
Case Else
|
||||
MessageBox.Show(Constants.MESSAGE_TOO_MANY_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
@ -421,7 +446,7 @@ Public Class frmDocumentResultList
|
||||
Next
|
||||
|
||||
' Hide Grids depending on Result count
|
||||
Select Case ResultLists.Count
|
||||
Select Case _ResultLists.Count
|
||||
Case 0
|
||||
|
||||
SplitContainerControl1.SetPanelCollapsed(True)
|
||||
@ -453,7 +478,7 @@ Public Class frmDocumentResultList
|
||||
Private Sub UpdateTotalResults()
|
||||
Dim oTotalResults = 0
|
||||
|
||||
For Each oList In ResultLists
|
||||
For Each oList In _ResultLists
|
||||
oTotalResults += oList.Datatable.Rows.Count
|
||||
Next
|
||||
|
||||
@ -640,17 +665,17 @@ Public Class frmDocumentResultList
|
||||
|
||||
Private Sub GridView1_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView1.ColumnFilterChanged
|
||||
Dim oRowCount = sender.RowCount
|
||||
UpdateGridHeader(ResultLists, 0, oRowCount)
|
||||
UpdateGridHeader(_ResultLists, 0, oRowCount)
|
||||
End Sub
|
||||
|
||||
Private Sub GridView2_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView2.ColumnFilterChanged
|
||||
Dim oRowCount = sender.RowCount
|
||||
UpdateGridHeader(ResultLists, 1, oRowCount)
|
||||
UpdateGridHeader(_ResultLists, 1, oRowCount)
|
||||
End Sub
|
||||
|
||||
Private Sub GridView3_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView3.ColumnFilterChanged
|
||||
Dim oRowCount = sender.RowCount
|
||||
UpdateGridHeader(ResultLists, 2, oRowCount)
|
||||
UpdateGridHeader(_ResultLists, 2, oRowCount)
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonBack.ItemClick
|
||||
@ -825,8 +850,8 @@ Public Class frmDocumentResultList
|
||||
oPropertyDialog.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub MenuItemsOpenFileZooFlow_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemsOpenFileZooFlow.ItemClick
|
||||
'TODO: Save file to temp dir and then open
|
||||
Private Async Sub MenuItemsOpenFileZooFlow_ItemClick(sender As Object, e As ItemClickEventArgs) Handles MenuItemsOpenFileZooFlow.ItemClick
|
||||
Await Watcher.OpenDocument(_CurrentDocument)
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@ -924,14 +949,10 @@ Public Class frmDocumentResultList
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub RibbonControl_Click(sender As Object, e As EventArgs) Handles RibbonControl.Click
|
||||
|
||||
Private Sub ButtonRefresh_ItemClick(sender As Object, e As ItemClickEventArgs) Handles ButtonRefresh.ItemClick
|
||||
RaiseEvent NeedsRefresh(Me, Params.ProfileGuid)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user