clipboard watcher migration
This commit is contained in:
@@ -91,19 +91,6 @@ Public Class ClassFlowForm
|
||||
TopMost = True
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs)
|
||||
'AddHandler MouseDown, New MouseEventHandler(AddressOf Form_MouseDown)
|
||||
End Sub
|
||||
|
||||
'Private Sub Form_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
|
||||
' If e.Button = MouseButtons.Left Then
|
||||
' Win32.ReleaseCapture()
|
||||
' Win32.SendMessage(Handle, Win32.WM_NCLBUTTONDOWN, Win32.HTCAPTION, 0)
|
||||
' End If
|
||||
'End Sub
|
||||
|
||||
Public Sub SetBitmap(ByVal bitmap As Bitmap)
|
||||
SetBitmap(bitmap, 255, bitmap.Width, bitmap.Height)
|
||||
End Sub
|
||||
|
||||
@@ -18,12 +18,15 @@ Public Class frmFlowForm
|
||||
|
||||
Private Sub frmFlowForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
' === Set Form Properties ===
|
||||
TopMost = True
|
||||
AllowDrop = True
|
||||
ShowInTaskbar = False
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.Default)
|
||||
|
||||
' === Register Events ===
|
||||
AddHandler Click, AddressOf frmFlowForm_Click
|
||||
|
||||
AddHandler MouseClick, New MouseEventHandler(AddressOf Form_MouseClick)
|
||||
AddHandler MouseMove, New MouseEventHandler(AddressOf Form_MouseMove)
|
||||
|
||||
' === Register As Event Listener ===
|
||||
EventBus.Instance.Register(Me)
|
||||
@@ -33,13 +36,20 @@ Public Class frmFlowForm
|
||||
EventBus.Instance.Unregister(Me)
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_Click(sender As Object, e As EventArgs)
|
||||
Private Sub Form_MouseClick(sender As Object, e As EventArgs)
|
||||
If CurrentState = OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults Then
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.Default)
|
||||
EventBus.Instance.PostEvent(New OnFlowFormInteractionEvent(OnFlowFormInteractionEvent.FlowFormInteraction.Click))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Form_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
|
||||
If e.Button = MouseButtons.Left Then
|
||||
Win32.ReleaseCapture()
|
||||
Win32.SendMessage(Handle, Win32.WM_NCLBUTTONDOWN, Win32.HTCAPTION, 0)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub OnEvent(e As OnFlowFormStateChangedEvent)
|
||||
CurrentState = e.State
|
||||
SetFlowFormState(e.State)
|
||||
|
||||
@@ -16,6 +16,7 @@ Partial Public Class frmMain
|
||||
Private Loading As Boolean = True
|
||||
Private Logger As Logger = My.LogConfig.GetLogger
|
||||
Private MatchingProfiles As List(Of ProfileData)
|
||||
Private MatchTreeView As New TreeView
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
@@ -34,6 +35,8 @@ Partial Public Class frmMain
|
||||
EventBus.Instance.Register(Me)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs)
|
||||
EventBus.Instance.Unregister(Me)
|
||||
End Sub
|
||||
@@ -41,12 +44,16 @@ Partial Public Class frmMain
|
||||
Public Sub OnEvent(e As OnFlowFormInteractionEvent)
|
||||
Select Case e.Interaction
|
||||
Case OnFlowFormInteractionEvent.FlowFormInteraction.Click
|
||||
Dim oClipboardContents As String = Clipboard.GetText()
|
||||
Dim oEnvironment As New Environment() With {
|
||||
.User = My.Application.User,
|
||||
.Modules = My.Application.Modules
|
||||
.Modules = My.Application.Modules,
|
||||
.Database = My.Database
|
||||
}
|
||||
Dim oParams As New ClipboardWatcherParams() With {
|
||||
.MatchingProfiles = MatchingProfiles
|
||||
.MatchingProfiles = MatchingProfiles,
|
||||
.MatchTreeView = MatchTreeView,
|
||||
.ClipboardContents = oClipboardContents
|
||||
}
|
||||
Dim oForm As New frmMatch(My.LogConfig, oEnvironment, oParams)
|
||||
oForm.Show()
|
||||
@@ -75,7 +82,7 @@ Partial Public Class frmMain
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs)
|
||||
Hide()
|
||||
WindowState = FormWindowState.Minimized
|
||||
End Sub
|
||||
|
||||
Private Async Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
||||
@@ -91,14 +98,12 @@ Partial Public Class frmMain
|
||||
Dim oClipboardContents As String = Clipboard.GetText()
|
||||
|
||||
Try
|
||||
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)
|
||||
MatchTreeView)
|
||||
|
||||
oMatchingProfiles = oProfileFilter.Profiles
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByClipboardRegex(oMatchingProfiles, oClipboardContents)
|
||||
@@ -112,8 +117,6 @@ Partial Public Class frmMain
|
||||
My.Application.User)
|
||||
End Function)
|
||||
oMatchingProfiles = oProfileFilter.ClearNotMatchedProfiles(oMatchingProfiles)
|
||||
|
||||
oMatchingProfiles = oMatchingProfiles.ToList()
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor.", MsgBoxStyle.Critical, Text)
|
||||
Exit Sub
|
||||
@@ -193,4 +196,6 @@ Partial Public Class frmMain
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user