zooflow
This commit is contained in:
@@ -5,12 +5,16 @@ Imports DigitalData.Modules.ZooFlow
|
||||
Imports DevExpress.LookAndFeel
|
||||
Imports DigitalData.Products.ClipboardWatcher
|
||||
Imports DigitalData.Modules.ZooFlow.Params
|
||||
Imports System.Threading.Tasks
|
||||
Imports DigitalData.Modules.Messaging
|
||||
|
||||
Partial Public Class frmMain
|
||||
Private WithEvents FlowForm As frmFlowForm
|
||||
|
||||
Private Init As ClassInit
|
||||
Private Loading As Boolean = True
|
||||
Private Logger As Logger = My.LogConfig.GetLogger
|
||||
Private MatchingProfiles As List(Of ProfileData)
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
@@ -24,6 +28,28 @@ Partial Public Class frmMain
|
||||
|
||||
' === Layout and Skin ===
|
||||
UserLookAndFeel.Default.SetSkinStyle(My.UIConfig.SkinName)
|
||||
|
||||
' === Register As Event Listener ===
|
||||
EventBus.Instance.Register(Me)
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
|
||||
EventBus.Instance.Unregister(Me)
|
||||
End Sub
|
||||
|
||||
Public Sub OnEvent(e As OnFlowFormInteractionEvent)
|
||||
Select Case e.Interaction
|
||||
Case OnFlowFormInteractionEvent.FlowFormInteraction.Click
|
||||
Dim oEnvironment As New Environment() With {
|
||||
.User = My.Application.User,
|
||||
.Modules = My.Application.Modules
|
||||
}
|
||||
Dim oParams As New ClipboardWatcherParams() With {
|
||||
.MatchingProfiles = MatchingProfiles
|
||||
}
|
||||
Dim oForm As New frmMatch(My.LogConfig, oEnvironment, oParams)
|
||||
oForm.Show()
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Completed(sender As Object, e As EventArgs)
|
||||
@@ -41,7 +67,6 @@ Partial Public Class frmMain
|
||||
|
||||
' === Load Data ===
|
||||
RefreshData()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub TimerRefreshData_Tick(sender As Object, e As EventArgs)
|
||||
@@ -52,7 +77,7 @@ Partial Public Class frmMain
|
||||
Hide()
|
||||
End Sub
|
||||
|
||||
Private Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
||||
Private Async Sub FlowForm_ClipboardChangedAsync(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
|
||||
@@ -66,7 +91,11 @@ 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)
|
||||
oProfileFilter = New ClassProfileFilter(My.LogConfig,
|
||||
My.Application.ClipboardWatcher.UserProfiles,
|
||||
My.Application.ClipboardWatcher.ProfileProcesses,
|
||||
My.Application.ClipboardWatcher.ProfileWindows,
|
||||
My.Application.ClipboardWatcher.ProfileControls)
|
||||
|
||||
oMatchingProfiles = oProfileFilter.Profiles
|
||||
Logger.Debug("Profiles before filtering: {0}", oMatchingProfiles.Count)
|
||||
@@ -78,8 +107,11 @@ Partial Public Class frmMain
|
||||
Logger.Debug("Profiles after FilterWindowsByWindowTitleRegex: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, oFocusedControl.ToString)
|
||||
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.ClearNotMatchedProfiles(oMatchingProfiles)
|
||||
Logger.Debug("Profiles after ClearNotMatchedProfiles: {0}", oMatchingProfiles.Count)
|
||||
|
||||
oMatchingProfiles = oMatchingProfiles.ToList()
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor.", MsgBoxStyle.Critical, Text)
|
||||
@@ -91,15 +123,9 @@ Partial Public Class frmMain
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oEnvironment As New Environment() With {
|
||||
.User = My.Application.User,
|
||||
.Modules = My.Application.Modules
|
||||
}
|
||||
Dim oParams As New ClipboardWatcherParams() With {
|
||||
.MatchingProfiles = oMatchingProfiles
|
||||
}
|
||||
Dim oForm As New frmMatch(My.LogConfig, oEnvironment, oParams)
|
||||
oForm.Show()
|
||||
MatchingProfiles = oMatchingProfiles
|
||||
|
||||
EventBus.Instance.PostEvent(New OnFlowFormStateChangedEvent(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults))
|
||||
End Sub
|
||||
|
||||
#Region "Notify Icon Menu"
|
||||
@@ -166,4 +192,6 @@ Partial Public Class frmMain
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user