prepare zooflow, add profilefilter
This commit is contained in:
@@ -22,7 +22,6 @@ Public Class ClassClipboardWatcher
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub WndProc(ByRef m As Message)
|
||||
|
||||
Select Case m.Msg
|
||||
Case WM_DRAWCLIPBOARD
|
||||
Dim oData As IDataObject = Clipboard.GetDataObject
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Public Enum FlowFormState
|
||||
[Default]
|
||||
HasSearchResults
|
||||
HasFileDropped
|
||||
End Enum
|
||||
|
||||
Public ReadOnly Property State As FlowFormState
|
||||
|
||||
@@ -90,7 +90,6 @@
|
||||
<Compile Include="ClassClipboardWatcher.vb" />
|
||||
<Compile Include="ClassInit.vb" />
|
||||
<Compile Include="ClassPatterns.vb" />
|
||||
<Compile Include="ClassProfileFilter.vb" />
|
||||
<Compile Include="ClipboardWatcher\State.vb" />
|
||||
<Compile Include="Events\OnFlowFormInteractionEvent.vb" />
|
||||
<Compile Include="Events\OnFlowFormStateChangedEvent.vb" />
|
||||
@@ -188,6 +187,10 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ClipboardWatcher\ClipboardWatcher.vbproj">
|
||||
<Project>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</Project>
|
||||
<Name>ClipboardWatcher</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
||||
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
||||
<Name>Filesystem</Name>
|
||||
@@ -216,10 +219,6 @@
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Products.ClipboardWatcher\ClipboardWatcher.vbproj">
|
||||
<Project>{1fba063d-60a5-4fc8-a529-a3d1ecfd640c}</Project>
|
||||
<Name>ClipboardWatcher</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Windows\Windows.vbproj">
|
||||
<Project>{5efaef9b-90b9-4f05-9f70-f79ad77fff86}</Project>
|
||||
<Name>Windows</Name>
|
||||
|
||||
@@ -39,27 +39,29 @@ Public Class frmFlowForm
|
||||
Select Case State
|
||||
Case OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults
|
||||
SetBitmap(My.Resources.CW_GEFUNDEN_klein)
|
||||
Case OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped
|
||||
SetBitmap(My.Resources.GLOBIX_GEFUNDEN_klein)
|
||||
Case Else
|
||||
SetBitmap(My.Resources.ZOOFLOW_Home_klein)
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_DragOver(sender As Object, e As DragEventArgs) Handles Me.DragOver
|
||||
If ActiveModules.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then
|
||||
If Not ActiveModules.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then
|
||||
e.Effect = DragDropEffects.None
|
||||
Else
|
||||
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
||||
' Handle file dragged from Windows
|
||||
e.Effect = DragDropEffects.Copy
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults)
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped)
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||||
' Handle a message dragged from Outlook
|
||||
e.Effect = DragDropEffects.Copy
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults)
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped)
|
||||
ElseIf e.Data.GetDataPresent("aryFileGroupDescriptor") AndAlso (e.Data.GetDataPresent("FileContents")) Then
|
||||
' Handle a message dragged from Thunderbird?
|
||||
e.Effect = DragDropEffects.Copy
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults)
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped)
|
||||
Else
|
||||
' Otherwise, do not handle
|
||||
e.Effect = DragDropEffects.None
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABU
|
||||
CwAAAk1TRnQBSQFMAgEBBQEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CwAAAk1TRnQBSQFMAgEBBQEAATgBAAE4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
||||
@@ -6,8 +6,8 @@ Imports DigitalData.Modules.Windows
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
Imports DigitalData.Modules.Messaging
|
||||
Imports DigitalData.Modules.ZooFlow.Params
|
||||
Imports DigitalData.Products.ClipboardWatcher
|
||||
Imports DigitalData.GUIs.ZooFlow.OnFlowFormStateChangedEvent.FlowFormState
|
||||
Imports DigitalData.Modules.ClipboardWatcher
|
||||
|
||||
Partial Public Class frmMain
|
||||
Private WithEvents FlowForm As frmFlowForm
|
||||
@@ -21,7 +21,7 @@ Partial Public Class frmMain
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
' === Initialization ===
|
||||
Init = New ClassInit(My.LogConfig, Me)
|
||||
AddHandler Init.Completed, AddressOf Init_Completed
|
||||
@@ -34,7 +34,7 @@ Partial Public Class frmMain
|
||||
EventBus.Instance.Register(Me)
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
|
||||
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs)
|
||||
EventBus.Instance.Unregister(Me)
|
||||
End Sub
|
||||
|
||||
@@ -74,17 +74,17 @@ Partial Public Class frmMain
|
||||
RefreshData()
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs)
|
||||
Hide()
|
||||
End Sub
|
||||
|
||||
Private Async Sub FlowForm_ClipboardChangedAsync(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
||||
Private Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
||||
If My.Application.ClipboardWatcher.UserProfiles.Rows.Count = 0 Then
|
||||
Logger.Warn("Clipboard Changed but no profiles configured!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oProfileFilter As ClassProfileFilter
|
||||
Dim oProfileFilter As ProfileFilter
|
||||
Dim oMatchingProfiles As List(Of ProfileData)
|
||||
Dim oWindow As New Window(My.LogConfig)
|
||||
Dim oWindowInfo = oWindow.GetWindowInfo()
|
||||
@@ -99,27 +99,22 @@ Partial Public Class frmMain
|
||||
Dim oClipboardContents As String = Clipboard.GetText()
|
||||
|
||||
Try
|
||||
oProfileFilter = New ClassProfileFilter(My.LogConfig,
|
||||
My.Application.ClipboardWatcher.UserProfiles,
|
||||
My.Application.ClipboardWatcher.ProfileProcesses,
|
||||
My.Application.ClipboardWatcher.ProfileWindows,
|
||||
My.Application.ClipboardWatcher.ProfileControls)
|
||||
Dim oTreeView As New TreeView
|
||||
|
||||
oProfileFilter = New ProfileFilter(My.LogConfig,
|
||||
My.Application.ClipboardWatcher.UserProfiles,
|
||||
My.Application.ClipboardWatcher.ProfileProcesses,
|
||||
My.Application.ClipboardWatcher.ProfileWindows,
|
||||
My.Application.ClipboardWatcher.ProfileControls,
|
||||
oTreeView)
|
||||
|
||||
oMatchingProfiles = oProfileFilter.Profiles
|
||||
Logger.Debug("Profiles before filtering: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByClipboardRegex(oMatchingProfiles, oClipboardContents)
|
||||
Logger.Debug("Profiles after FilterProfilesByClipboardRegex: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByProcess(oMatchingProfiles, oWindowInfo.ProcessName)
|
||||
Logger.Debug("Profiles after FilterProfilesByProcess: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oMatchingProfiles, oWindowInfo.WindowTitle)
|
||||
Logger.Debug("Profiles after FilterWindowsByWindowTitleRegex: {0}", oMatchingProfiles.Count)
|
||||
'oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, oFocusedControl.hWnd.ToString)
|
||||
'oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents)
|
||||
Logger.Debug("Profiles after FilterProfilesByFocusedControl: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = Await Task.Run(Function() oProfileFilter.FilterProfilesBySearchResults(oMatchingProfiles))
|
||||
Logger.Debug("Profiles after FilterProfilesBySearchResults: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents, Handle)
|
||||
'oMatchingProfiles = Await Task.Run(Function() oProfileFilter.FilterProfilesBySearchResults(oMatchingProfiles))
|
||||
oMatchingProfiles = oProfileFilter.ClearNotMatchedProfiles(oMatchingProfiles)
|
||||
Logger.Debug("Profiles after ClearNotMatchedProfiles: {0}", oMatchingProfiles.Count)
|
||||
|
||||
oMatchingProfiles = oMatchingProfiles.ToList()
|
||||
Catch ex As Exception
|
||||
@@ -127,10 +122,10 @@ Partial Public Class frmMain
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
If oMatchingProfiles.Count = 0 Then
|
||||
Logger.Warn("No matching Profiles found")
|
||||
Exit Sub
|
||||
End If
|
||||
'If oMatchingProfiles.Count = 0 Then
|
||||
' Logger.Warn("No matching Profiles found")
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
MatchingProfiles = oMatchingProfiles
|
||||
|
||||
@@ -201,6 +196,4 @@ Partial Public Class frmMain
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user