This commit is contained in:
Digital Data - Marlon Schreiber
2019-09-05 11:47:29 +02:00
9 changed files with 368 additions and 174 deletions

View File

@@ -1,9 +1,7 @@
Imports System.Threading
Imports System.IO
Imports System.Globalization
Imports DD_LIB_Standards
Imports DD_Clipboard_Watcher.ClassConstants
Imports System.Windows.Automation
Imports DD_Clipboard_Watcher.ClassWindowAPI
Public Class frmStart
@@ -75,8 +73,8 @@ Public Class frmStart
End Try
Try
Hotkey.RemoveHotKey(ClassConstants.HOTKEY_TOGGLE_WATCHER)
Hotkey.RemoveHotKey(ClassConstants.HOTKEY_TRIGGER_WATCHER)
Hotkey.RemoveHotKey(HOTKEY_TOGGLE_WATCHER)
Hotkey.RemoveHotKey(HOTKEY_TRIGGER_WATCHER)
Catch ex As Exception
Logger.Error(ex)
Logger.Warn("Hotkeys could not be removed")
@@ -107,10 +105,10 @@ Public Class frmStart
Exit Sub
End If
Dim oWindowInfo = ClassWindowAPI.GetWindowInfo()
Dim oWindowInfo = GetWindowInfo()
Dim ClipboardContents As String = Clipboard.GetText()
Dim oProfileFilter As ClassProfileFilter
Dim newoResult As IntPtr = FocusedControlinActiveWindow(Handle)
Dim oFocusedControl As IntPtr = FocusedControlinActiveWindow(Handle)
Try
oProfileFilter = New ClassProfileFilter(DT_USER_PROFILES, DTPROFILE_REL_PROCESS, DTPROFILE_REL_WINDOW, DTPROFILE_REL_CONTROL)
Catch ex As Exception
@@ -124,29 +122,9 @@ Public Class frmStart
CurrMatchTreeView.SelectedImageIndex = 0
oProfiles = oProfileFilter.FilterProfilesByClipboardRegex(oProfiles, ClipboardContents)
If oProfiles.Count > 0 Then
oProfiles = oProfileFilter.FilterProfilesByProcess(oProfiles, oWindowInfo.ProcessName)
If oProfiles.Count > 0 Then
oProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oProfiles, oWindowInfo.WindowTitle)
If oProfiles.Count > 0 Then
' Dim ControlFocusResult
Dim oResult As WindowInfo = GetFocusedControl(Handle)
'Automation = New ClassAutomation(LogConfig)
'If Not IsNothing(Automation.AutomationId) Then
' ControlFocusResult = Automation.AutomationId
'Else
' ControlFocusResult = String.Empty
'End If
' MsgBox(newoResult.ToString)
oProfiles = oProfileFilter.FilterProfilesByFocusedControl(oProfiles, ClipboardContents, newoResult.ToString)
'oProfiles = oProfileFilter.FilterWindowsByWindowClipboardRegex(oProfiles, ClipboardContents)
End If
End If
End If
'oProfiles = oProfileFilter.RemoveDuplicateProfiles()
oProfiles = oProfileFilter.FilterProfilesByProcess(oProfiles, oWindowInfo.ProcessName)
oProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oProfiles, oWindowInfo.WindowTitle)
oProfiles = oProfileFilter.FilterProfilesByFocusedControl(oProfiles, ClipboardContents, oFocusedControl.ToString)
oProfiles = oProfileFilter.ClearNotMatchedProfiles(oProfiles)
oProfiles = oProfiles.ToList()