clean up
This commit is contained in:
parent
c03bb248fc
commit
b6508ba650
@ -248,7 +248,7 @@ Public Class ClassInit
|
||||
Try
|
||||
Dim oSql = String.Format("SELECT DISTINCT GUID, NAME,REGEX_EXPRESSION,COMMENT,PROC_NAME,PROFILE_TYPE FROM VWCW_USER_PROFILE WHERE ACTIVE = 1 AND USER_ID = {0} OR GROUP_ID IN (SELECT DISTINCT GUID FROM TBDD_GROUPS WHERE GUID IN (SELECT GROUP_ID FROM TBDD_GROUPS_USER WHERE USER_ID = {0}))", USER_ID)
|
||||
DT_USER_PROFILES = Database.GetDatatable(oSql)
|
||||
If DT_USER_PROFILES.Rows.Count = 0 Then
|
||||
If DT_USER_PROFILES Is Nothing OrElse DT_USER_PROFILES.Rows.Count = 0 Then
|
||||
MsgBox("No profiles configured for this user so far!", MsgBoxStyle.Exclamation)
|
||||
Else
|
||||
oSql = $"SELECT T.* FROM TBCW_PROFILE_PROCESS T, VWPM_PROFILE_USER T1 WHERE T.PROFILE_ID = T1.PROFIL_ID AND T1.USER_ID = {USER_ID}"
|
||||
|
||||
@ -89,32 +89,24 @@ Public Class ClassProfileFilter
|
||||
Return _Profiles
|
||||
End Function
|
||||
|
||||
Friend Function RemoveDuplicateProfiles() As Object
|
||||
Return _Profiles.
|
||||
GroupBy(Function(p) p.Guid).
|
||||
Select(Function(p) p.FirstOrDefault())
|
||||
End Function
|
||||
Private Function NodeFind(ByVal n As TreeNode, searchTerm As String)
|
||||
Dim aNode As TreeNode
|
||||
For Each aNode In n.Nodes
|
||||
If aNode.Text = searchTerm Then
|
||||
Return aNode
|
||||
Private Function FindNode(ByVal Node As TreeNode, SearchTerm As String)
|
||||
Dim oNode As TreeNode
|
||||
For Each oNode In Node.Nodes
|
||||
If oNode.Text = SearchTerm Then
|
||||
Return oNode
|
||||
End If
|
||||
Next
|
||||
Return n
|
||||
Return Node
|
||||
End Function
|
||||
Private Function GetLowestNode(ByVal n As TreeNode)
|
||||
Dim aNode As TreeNode
|
||||
If n.GetNodeCount(False) = 1 Then
|
||||
For Each aNode In n.Nodes
|
||||
Return GetLowestNode(aNode)
|
||||
Next
|
||||
|
||||
Private Function GetLowestNode(ByVal Node As TreeNode) As TreeNode
|
||||
If Node.GetNodeCount(False) = 1 Then
|
||||
Return GetLowestNode(Node.Nodes.Item(0))
|
||||
Else
|
||||
Return n
|
||||
Return Node
|
||||
End If
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Public Function FilterProfilesByClipboardRegex(Profiles As List(Of ProfileData), ClipboardContents As String) As List(Of ProfileData)
|
||||
Dim oFilteredProfiles As New List(Of ProfileData)
|
||||
For Each oProfile In Profiles
|
||||
|
||||
@ -73,8 +73,9 @@
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Database.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=1.0.0.5, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem, Version=0.0.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
@ -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,35 +122,12 @@ 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.FilterProfilesByFocusedControl(oProfiles, ClipboardContents, oFocusedControl.ToString)
|
||||
oProfiles = oProfileFilter.ClearNotMatchedProfiles(oProfiles)
|
||||
oProfiles = oProfiles.ToList()
|
||||
|
||||
|
||||
|
||||
|
||||
CURRENT_MATCHING_PROFILES = oProfiles
|
||||
CURRENT_CLIPBOARD_CONTENTS = ClipboardContents
|
||||
End Sub
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user