Zooflow: Fix focus issue with search

This commit is contained in:
Jonathan Jenne 2022-02-23 12:57:09 +01:00
parent d8a0a0504c
commit c72f82ebf9
4 changed files with 151 additions and 170 deletions

View File

@ -11,14 +11,12 @@ Namespace Globix
Public Property CurrentWorkfile As Globix.Models.WorkFile
Public Property CURRENT_IDB_OBJ_ID As Long
Public Property INDEXING_ACTIVE As Boolean = False
Public Property ABORT_INDEXING As Boolean = False
Public Property CURRENT_ISATTACHMENT As Boolean = False
Public Property DeleteOriginalFile As Boolean = False
Public Property CURRENT_LASTDOCTYPE As String
Public Property MULTIINDEXING_ACTIVE As Boolean = False
Public Property CURRENT_PROFILE_LOG_INDEX As String
Public Property Folderwatchstarted As Boolean = False
Public Property DTEXCLUDE_FILES As DataTable
Public Property PATH_FileExclusions As String = Path.Combine(Application.UserAppDataPath(), "FileExclusions.xml")

View File

@ -26,7 +26,7 @@ Partial Class frmFlowForm
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.DigitalData.GUIs.ZooFlow.frmSplash), True, True)
Dim SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.DigitalData.GUIs.ZooFlow.frmSplash), True, True)
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFlowForm))
Me.NotifyIcon = New System.Windows.Forms.NotifyIcon(Me.components)
Me.ContextMenuSystray = New System.Windows.Forms.ContextMenuStrip(Me.components)
@ -85,9 +85,9 @@ Partial Class frmFlowForm
CType(Me.BarManager1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplashScreenManager
'SplashScreenManager1
'
SplashScreenManager.ClosingDelay = 500
SplashScreenManager1.ClosingDelay = 500
'
'NotifyIcon
'

View File

@ -118,10 +118,10 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="NotifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>189, 17</value>
<value>196, 17</value>
</metadata>
<metadata name="ContextMenuSystray.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>297, 17</value>
<value>304, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="NotifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -1957,13 +1957,13 @@
</value>
</data>
<metadata name="TimerRefreshData.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>461, 17</value>
<value>468, 17</value>
</metadata>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>610, 17</value>
<value>617, 17</value>
</metadata>
<metadata name="TimerFolderwatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>709, 17</value>
<value>716, 17</value>
</metadata>
<assembly alias="DevExpress.Data.v21.2" name="DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="PictureEdit1.EditValue" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -1993,9 +1993,9 @@
</value>
</data>
<metadata name="PopupMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>858, 17</value>
<value>865, 17</value>
</metadata>
<metadata name="BarManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>983, 17</value>
<value>990, 17</value>
</metadata>
</root>

View File

@ -166,7 +166,7 @@ Public Class frmFlowForm
Private ClassWindow As Window
Private ProfileFilter As ProfileFilter
Private ProfileLoader As ClassProfileLoader
Private Property _Environment As Environment
Private Property Environment As Environment
' Runtime Flags
Private ApplicationLoading As Boolean = True
@ -188,141 +188,152 @@ Public Class frmFlowForm
' === Initialization ===
Init = New ClassInit(My.LogConfig, Me)
AddHandler Init.Completed, AddressOf Init_Completed
AddHandler Init.Completed, Async Sub() Await Init_Completed(sender, e)
Init.InitializeApplication()
' === Register Sidebar ===
RegisterBar(ABEdge.ABE_RIGHT)
End Sub
Private Sub frmFlowForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
UnregisterBar()
End Sub
Private Sub Init_Completed(sender As Object, e As EventArgs)
Me.Cursor = Cursors.WaitCursor
' === Initialization Complete ===
ApplicationLoading = False
SplashScreenManager.CloseForm(False)
Private Async Function Init_Completed(sender As Object, e As EventArgs) As Threading.Tasks.Task
Try
Cursor = Cursors.WaitCursor
' === Initialization Complete ===
ApplicationLoading = False
SplashScreenManager.CloseForm(False)
_Environment = My.Application.GetEnvironment()
' === Set Form ===
OverlayWindowOptions.Default.DisableInput = False
' === Initialize Error Handler ===
Logger = My.LogConfig.GetLogger()
ErrorHandler = New BaseErrorHandler(My.LogConfig, Logger, Me)
' === Initialize Environment ===
Logger = My.LogConfig.GetLogger()
Environment = My.Application.GetEnvironment()
ErrorHandler = New BaseErrorHandler(My.LogConfig, Logger, Me)
If My.Application.Palette = "" Then
UserLookAndFeel.Default.SetSkinStyle(My.Application.Skin)
Else
UserLookAndFeel.Default.SetSkinStyle(My.Application.Skin, My.Application.Palette)
End If
' === Setup Timers ===
AddHandler TimerRefreshData.Tick, AddressOf TimerRefreshData_Tick
TimerRefreshData.Enabled = True
' === Register As Event Listener ===
EventBus.Instance.Register(Me)
' === Setup Event Handlers ===
AddHandler KeyDown, AddressOf frmFlowForm_KeyDown
AddHandler KeyUp, AddressOf frmFlowForm_KeyDown
AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged
PictureBoxSearch1.Visible = False
'Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language)
'Dim oDatatable As DataTable = My.Database.GetDatatableIDB(oSQL)
For Each oRow As DataRow In My.Tables.DTIDB_COMMON_SQL.Rows
If oRow.Item("TITLE") = SQLCMD_FLOW_SEARCH_BASE Then
IDBSearchActive = True
PictureBoxSearch1.Visible = True
' === Initialize Theming ===
If My.Application.Palette = "" Then
UserLookAndFeel.Default.SetSkinStyle(My.Application.Skin)
Else
UserLookAndFeel.Default.SetSkinStyle(My.Application.Skin, My.Application.Palette)
End If
Next
'If Not IsNothing(oDatatable) Then
' If oDatatable.Rows.Count > 0 Then
' IDBSearchActive = True
' DTIDB_SEARCHES = oDatatable
' PictureBoxSearch1.Visible = True
' End If
'End If
' === Setup Timers ===
AddHandler TimerRefreshData.Tick, AddressOf TimerRefreshData_Tick
TimerRefreshData.Enabled = True
If My.Application.ModulesActive.Contains(MODULE_CLIPBOARDWATCHER) Then
Try
ClassWindow = New Window(My.LogConfig)
HotkeyClass = New Hotkey(Me)
' === Register As Event Listener ===
EventBus.Instance.Register(Me)
'Add Toggle Hotkey
HotkeyClass.AddHotKey(Keys.T, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
' === Setup Event Handlers ===
AddHandler KeyDown, AddressOf frmFlowForm_KeyDown
AddHandler KeyUp, AddressOf frmFlowForm_KeyDown
AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged
' Add Trigger Hotkey
'Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language)
'Dim oDatatable As DataTable = My.Database.GetDatatableIDB(oSQL)
'TODO: Configure Hotkey
Dim oSearchKey As String = "D"
Dim oFunctionKey As String = "CTRL"
PictureBoxSearch1.Visible = False
For Each oRow As DataRow In My.Tables.DTIDB_COMMON_SQL.Rows
If oRow.Item("TITLE") = SQLCMD_FLOW_SEARCH_BASE Then
IDBSearchActive = True
PictureBoxSearch1.Visible = True
End If
Next
'If Not IsNothing(oDatatable) Then
' If oDatatable.Rows.Count > 0 Then
' IDBSearchActive = True
' DTIDB_SEARCHES = oDatatable
' PictureBoxSearch1.Visible = True
' End If
Dim oConverter As New KeysConverter
Dim oObject As Object = oConverter.ConvertFromString(oSearchKey)
Dim oKeyCode As Keys = oObject
'End If
Select Case oFunctionKey
Case "CTRL"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TRIGGER_WATCHER)
Case "SHIFT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_SHIFT, HOTKEY_TRIGGER_WATCHER)
Case "ALT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_ALT, HOTKEY_TRIGGER_WATCHER)
Case "WIN"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_WIN, HOTKEY_TRIGGER_WATCHER)
End Select
If My.Application.ModulesActive.Contains(MODULE_CLIPBOARDWATCHER) Then
Try
ClassWindow = New Window(My.LogConfig)
HotkeyClass = New Hotkey(Me)
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
'Add Toggle Hotkey
HotkeyClass.AddHotKey(Keys.T, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
ProfileLoader = New ClassProfileLoader(My.LogConfig, My.Database)
ProfileLoader.LoadProfiles()
Catch ex As Exception
ShowErrorMessage(ex)
End Try
Else
My.Application.ClipboardWatcher.MonitoringActive = False
Logger.Info("Clipboard Watcher Module is not active. Hotkey Monitoring will be disabled!")
End If
' Add Trigger Hotkey
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
FileDropNew = New FileDrop(My.LogConfig, "ZooFlow")
FileHandle = New ClassFilehandle(My.LogConfig)
FolderWatch = New ClassFolderwatcher(My.LogConfig)
'TODO: Configure Hotkey
Dim oSearchKey As String = "D"
Dim oFunctionKey As String = "CTRL"
Dim oConverter As New KeysConverter
Dim oObject As Object = oConverter.ConvertFromString(oSearchKey)
Dim oKeyCode As Keys = oObject
Select Case oFunctionKey
Case "CTRL"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TRIGGER_WATCHER)
Case "SHIFT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_SHIFT, HOTKEY_TRIGGER_WATCHER)
Case "ALT"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_ALT, HOTKEY_TRIGGER_WATCHER)
Case "WIN"
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_WIN, HOTKEY_TRIGGER_WATCHER)
End Select
AddHandler HotkeyClass.HotKeyPressed, AddressOf HotkeyClass_HotKeyPressed
ProfileLoader = New ClassProfileLoader(My.LogConfig, My.Database)
ProfileLoader.LoadProfiles()
Catch ex As Exception
ShowErrorMessage(ex)
End Try
Else
My.Application.ClipboardWatcher.MonitoringActive = False
Logger.Info("Clipboard Watcher Module is not active. Hotkey Monitoring will be disabled!")
End If
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
FileDropNew = New FileDrop(My.LogConfig, "ZooFlow")
FileHandle = New ClassFilehandle(My.LogConfig)
FolderWatch = New ClassFolderwatcher(My.LogConfig)
Dim oFileExclusions As New ClassExclusions()
If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then
If My.Application.User.Language = "de-DE" Then
MsgBox("Die Ausschlusskriterien für Dateien in Folderwatch konnten nicht angelegt werden!", MsgBoxStyle.Information)
Else
MsgBox("File-Exclusions in Folderwatch could not be created!", MsgBoxStyle.Information)
End If
Dim oFileExclusions As New ClassExclusions()
If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then
If My.Application.User.Language = "de-DE" Then
MsgBox("Die Ausschlusskriterien für Dateien in Folderwatch konnten nicht angelegt werden!", MsgBoxStyle.Information)
Else
MsgBox("File-Exclusions in Folderwatch could not be created!", MsgBoxStyle.Information)
End If
Init_Folderwatch()
Start_Folderwatch()
GlobixToolStripMenuItem.Visible = True
End If
Init_Folderwatch()
Start_Folderwatch()
GlobixToolStripMenuItem.Visible = True
End If
If IsNothing(My.Tables.DTIDB_CATALOG_USER) Then
Exit Function
End If
Await ConfigureQuicksearch1(False)
If IsNothing(My.Tables.DTIDB_CATALOG_USER) Then
Exit Sub
End If
Quicksearch1(False)
Catch ex As Exception
Logger.Error(ex)
Me.Cursor = Cursors.Default
End Sub
Sub Quicksearch1(Reload As Boolean)
Finally
Cursor = Cursors.Default
End Try
End Function
Async Function ConfigureQuicksearch1(Reload As Boolean) As Threading.Tasks.Task
If Reload Then
Dim oSQL = $"SELECT * FROM TBIDB_CATALOG_USER WHERE USR_ID = {My.Application.User.UserId}"
My.Tables.DTIDB_CATALOG_USER = My.Database.GetDatatableIDB(oSQL)
My.Tables.DTIDB_CATALOG_USER = Await My.Database.GetDatatableIDBAsync(oSQL)
End If
For Each oRow As DataRow In My.Tables.DTIDB_CATALOG_USER.Rows
@ -337,7 +348,7 @@ Public Class frmFlowForm
End If
End If
Next
End Sub
End Function
Public Sub RegisterBar(ByVal dockEdge As ABEdge)
AppDeskData = New AppDeskBar()
AppDeskData.cbSize = Marshal.SizeOf(AppDeskData)
@ -457,10 +468,6 @@ Public Class frmFlowForm
End If
End Sub
Public Sub OnEvent(Params As Object)
Logger.Debug("OnEvent called!")
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
frmSearchNeu.Show()
@ -633,31 +640,12 @@ Public Class frmFlowForm
If oDroppedFiles.Count > 0 Then
Await Globix_Check_Dropped_Files(oDroppedFiles)
End If
'If FileDrop.Drop_File(e) = True Then
' Me.Cursor = Cursors.WaitCursor
' Await Globix_Check_Dropped_Files()
'End If
End Function
Private Async Sub PictureBox1_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBoxDragDrop.DragDrop
Await DragDropForm(e)
End Sub
'Private Async Sub TimerCheckDroppedFiles_Tick(sender As Object, e As EventArgs)
' If Not My.Application.ModulesActive.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then
' Exit Sub
' End If
' Dim oDroppedFiles = FileDropNew.GetFiles(e)
' If oDroppedFiles.Count > 0 Then
' Await Globix_Check_Dropped_Files()
' End If
' 'TimerCheckDroppedFiles.Stop()
' Await Globix_Check_Dropped_Files()
' Me.Cursor = Cursors.Default
'End Sub
Private Async Function Globix_Check_Dropped_Files(pDroppedFiles As List(Of FileDrop.DroppedFile)) As Threading.Tasks.Task
Try
Await My.Database.ExecuteNonQueryECMAsync($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND USER@WORK = '{My.Application.User.UserName}'")
@ -855,8 +843,6 @@ Public Class frmFlowForm
End Sub
Private Sub frmFlowForm_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
My.UIConfig.FlowForm.Location = Location
My.UIConfigManager.Save()
@ -938,40 +924,35 @@ Public Class frmFlowForm
oState.CurrentClipboardContents = ClipboardContents
'If oState.MonitoringActive = False Then
' Dim oMessage As String = "Clipboard Watcher is not active!"
' Logger.Warn(oMessage)
If oState.MonitoringActive = False Then
Dim oMessage As String = "Clipboard Watcher is not active!"
Logger.Warn(oMessage)
' Exit Sub
'End If
End If
'If oState.UserProfiles Is Nothing Then
' Dim oMessage As String = "User Profiles are empty!"
' Logger.Warn(oMessage)
If oState.UserProfiles Is Nothing Then
Dim oMessage As String = "User Profiles are empty!"
Logger.Warn(oMessage)
' Exit Sub
'End If
End If
'If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Processes are empty!"
' Logger.Warn(oMessage)
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
Dim oMessage As String = "Profile Processes are empty!"
Logger.Warn(oMessage)
' Exit Sub
'End If
End If
'If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Windows are empty!"
' Logger.Warn(oMessage)
If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
Dim oMessage As String = "Profile Windows are empty!"
Logger.Warn(oMessage)
' Exit Sub
'End If
End If
'If oState.ProfileControls Is Nothing OrElse oState.ProfileControls.Rows.Count = 0 Then
' Dim oMessage As String = "Profile Processes are empty!"
' Logger.Warn(oMessage)
If oState.ProfileControls Is Nothing OrElse oState.ProfileControls.Rows.Count = 0 Then
Dim oMessage As String = "Profile Processes are empty!"
Logger.Warn(oMessage)
' Exit Sub
'End If
End If
Dim oWindowInfo = ClassWindow.GetWindowInfo()
@ -1089,7 +1070,7 @@ Public Class frmFlowForm
Private Async Sub ProfileResultForm_NeedsRefresh(sender As Object, e As Integer)
Dim oThisForm As IResultForm = sender
Dim oState = My.Application.ClipboardWatcher
Dim oProfileSearch As New ProfileSearches(My.LogConfig, _Environment, oState.CurrentClipboardContents)
Dim oProfileSearch As New ProfileSearches(My.LogConfig, Environment, oState.CurrentClipboardContents)
If TypeOf sender Is frmDocumentResultList Then
Dim oProfileId = e
@ -1110,9 +1091,9 @@ Public Class frmFlowForm
End Sub
Private Sub BasisKonfigurationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BasisKonfigurationToolStripMenuItem.Click
Private Async Sub BasisKonfigurationToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BasisKonfigurationToolStripMenuItem.Click
frmConfigBasic.ShowDialog()
Quicksearch1(True)
Await ConfigureQuicksearch1(True)
End Sub
Private Sub ShowErrorMessage(pEx As Exception)
@ -1154,8 +1135,10 @@ Public Class frmFlowForm
.Title = GetResultWindowString(pSearchText),
.Datatable = oDTDocResult
})
Dim oForm As New frmDocumentResultList(My.LogConfig, _Environment, oParams)
Dim oForm As New frmDocumentResultList(My.LogConfig, Environment, oParams)
oForm.Show()
oForm.BringToFront()
oForm.Focus()
Else
Dim oMessage As String
@ -1232,9 +1215,9 @@ Public Class frmFlowForm
End If
End Sub
Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick
Private Async Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick
frmConfigBasic.ShowDialog()
Quicksearch1(True)
Await ConfigureQuicksearch1(True)
End Sub
End Class