ZooFlow: Fix merge
This commit is contained in:
parent
d8f25ecbd2
commit
f5fd5ed1e1
@ -8,10 +8,10 @@ Namespace ClipboardWatcher
|
||||
Exception
|
||||
End Enum
|
||||
|
||||
Public UserProfiles As DataTable = Nothing
|
||||
Public ProfileProcesses As DataTable = Nothing
|
||||
Public ProfileWindows As DataTable = Nothing
|
||||
Public ProfileControls As DataTable = Nothing
|
||||
Public Property UserProfiles As DataTable = Nothing
|
||||
Public Property ProfileProcesses As DataTable = Nothing
|
||||
Public Property ProfileWindows As DataTable = Nothing
|
||||
Public Property ProfileControls As DataTable = Nothing
|
||||
|
||||
Public MatchTreeView As TreeView = New TreeView()
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ Imports DigitalData.GUIs.ClipboardWatcher
|
||||
Imports DigitalData.GUIs.ZooFlow.ClassConstants
|
||||
Imports DigitalData.Modules
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports DigitalData.Modules.Windows
|
||||
|
||||
Public Class frmFlowForm
|
||||
' Constants
|
||||
@ -25,6 +26,7 @@ Public Class frmFlowForm
|
||||
Private ProfileFilter As ProfileFilter
|
||||
Private clsFW As ClassFolderwatcher
|
||||
Private _DataASorDB As ClassDataASorDB
|
||||
Private WindowClass As Window
|
||||
|
||||
' Runtime Flags
|
||||
Private ApplicationLoading As Boolean = True
|
||||
@ -38,7 +40,8 @@ Public Class frmFlowForm
|
||||
|
||||
' Events
|
||||
Public Event ClipboardChanged As EventHandler(Of IDataObject)
|
||||
Private WithEvents Watcher As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
|
||||
Private WithEvents HotkeyClass As Hotkey
|
||||
Private WithEvents Watcher As ClipboardWatcher.Watcher = ClipboardWatcher.Watcher.Singleton
|
||||
|
||||
Public Sub New()
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@ -213,6 +216,8 @@ Public Class frmFlowForm
|
||||
AddHandler oControl.MouseLeave, AddressOf frmFlowForm_MouseLeave
|
||||
Next
|
||||
|
||||
AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged
|
||||
|
||||
Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language)
|
||||
Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSQL)
|
||||
PictureBoxSearch.Visible = False
|
||||
@ -222,6 +227,44 @@ Public Class frmFlowForm
|
||||
DTIDB_SEARCHES = oDatatable
|
||||
PictureBoxSearch.Visible = True
|
||||
End If
|
||||
|
||||
If My.Application.ModulesActive.Contains(MODULE_CLIPBOARDWATCHER) Then
|
||||
Try
|
||||
WindowClass = New Window(My.LogConfig)
|
||||
HotkeyClass = New Hotkey(Me)
|
||||
|
||||
'Add Toggle Hotkey
|
||||
HotkeyClass.AddHotKey(Keys.T, Hotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
|
||||
|
||||
' Add Trigger Hotkey
|
||||
|
||||
'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, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
Case "SHIFT"
|
||||
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
Case "ALT"
|
||||
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_ALT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
Case "WIN"
|
||||
HotkeyClass.AddHotKey(oKeyCode, Hotkey.ModfierKey.MOD_WIN, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox("Error while initializing Hotkeys for Clipboard Watcher!", MsgBoxStyle.Critical, Text)
|
||||
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(ClassConstants.MODULE_GLOBAL_INDEXER) Then
|
||||
FileDrop = New ClassFileDrop(My.LogConfig)
|
||||
FileHandle = New ClassFilehandle()
|
||||
@ -592,7 +635,7 @@ Public Class frmFlowForm
|
||||
My.Application.Globix.CURRENT_WORKFILE_GUID = oFileRow.Item(0)
|
||||
My.Application.Globix.CURRENT_WORKFILE = oFileRow.Item("FILENAME2WORK").ToString
|
||||
Logger.Info(" CURRENT_WORKFILE: " & My.Application.Globix.CURRENT_WORKFILE)
|
||||
If File.Exists(My.Application.Globix.CURRENT_WORKFILE) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then
|
||||
If IO.File.Exists(My.Application.Globix.CURRENT_WORKFILE) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then
|
||||
Globix_Open_IndexDialog()
|
||||
End If
|
||||
Next
|
||||
@ -810,4 +853,88 @@ Public Class frmFlowForm
|
||||
Private Sub TsiGlobixConfig_Click(sender As Object, e As EventArgs) Handles TsiGlobixConfig.Click
|
||||
frmGlobixBasicConfig.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub Watcher_ClipboardChanged(sender As Object, e As IDataObject)
|
||||
If My.Application.ClipboardWatcher.MonitoringActive = False Then
|
||||
Logger.Info("Clipboard Watcher is not active!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If My.Application.ClipboardWatcher.UserProfiles Is Nothing OrElse My.Application.ClipboardWatcher.UserProfiles.Rows.Count = 0 Then
|
||||
Logger.Warn("User Profiles is empty!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If My.Application.ClipboardWatcher.ProfileProcesses Is Nothing OrElse My.Application.ClipboardWatcher.ProfileProcesses.Rows.Count = 0 Then
|
||||
Logger.Warn("Profile Processes is empty!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If My.Application.ClipboardWatcher.ProfileWindows Is Nothing OrElse My.Application.ClipboardWatcher.ProfileWindows.Rows.Count = 0 Then
|
||||
Logger.Warn("Profile Processes is empty!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If My.Application.ClipboardWatcher.ProfileProcesses Is Nothing OrElse My.Application.ClipboardWatcher.ProfileProcesses.Rows.Count = 0 Then
|
||||
Logger.Warn("Profile Processes is empty!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim oWindowInfo = WindowClass.GetWindowInfo()
|
||||
Dim ClipboardContents As String = Clipboard.GetText().Trim()
|
||||
|
||||
Try
|
||||
' Tree View zurücksetzen
|
||||
My.Application.ClipboardWatcher.MatchTreeView.Nodes.Clear()
|
||||
|
||||
ProfileFilter = New ProfileFilter(My.LogConfig,
|
||||
My.Application.ClipboardWatcher.UserProfiles,
|
||||
My.Application.ClipboardWatcher.ProfileProcesses,
|
||||
My.Application.ClipboardWatcher.ProfileWindows,
|
||||
My.Application.ClipboardWatcher.ProfileControls,
|
||||
My.Application.ClipboardWatcher.MatchTreeView
|
||||
)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Mehr Informationen im Log.", MsgBoxStyle.Critical, Text)
|
||||
End Try
|
||||
|
||||
Try
|
||||
Dim oProfiles = ProfileFilter.Profiles
|
||||
Dim oEnvironment = ClassEnvironment.GetEnvironment()
|
||||
|
||||
' Filter by Clipboard Contents
|
||||
oProfiles = ProfileFilter.FilterProfilesByClipboardRegex(oProfiles, ClipboardContents)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "FilterProfilesByClipboardRegex")
|
||||
|
||||
' Filter by Process Name
|
||||
oProfiles = ProfileFilter.FilterProfilesByProcess(oProfiles, oWindowInfo.ProcessName)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "FilterProfilesByProcess")
|
||||
|
||||
' Filter by Window Title
|
||||
oProfiles = ProfileFilter.FilterWindowsByWindowTitleRegex(oProfiles, oWindowInfo.WindowTitle)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "FilterWindowsByWindowTitleRegex")
|
||||
|
||||
' Filter by Focused Control
|
||||
oProfiles = ProfileFilter.FilterProfilesByFocusedControl(oProfiles, ClipboardContents, Handle)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "FilterProfilesByFocusedControl")
|
||||
My.Application.ClipboardWatcher.CurrentMatchingProfiles = oProfiles.ToList()
|
||||
|
||||
' Filter by Search Results
|
||||
oProfiles = ProfileFilter.FilterProfilesBySearchResults(oProfiles, oEnvironment.Database, oEnvironment.User, ClipboardContents)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "FilterProfilesBySearchResults")
|
||||
|
||||
' Clean up Profiles
|
||||
oProfiles = ProfileFilter.ClearNotMatchedProfiles(oProfiles)
|
||||
oProfiles = ProfileFilter.ClearDuplicateProfiles(oProfiles)
|
||||
oProfiles = ProfileFilter.LogRemainingProfiles(oProfiles, "CleanUp")
|
||||
|
||||
My.Application.ClipboardWatcher.CurrentProfilesWithResults = oProfiles.ToList()
|
||||
My.Application.ClipboardWatcher.CurrentClipboardContents = ClipboardContents
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox("Fehler beim Auswerten der Profile. Mehr Informationen im Log.", MsgBoxStyle.Critical, Text)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user