Add Animator to Clipboard Watcher

This commit is contained in:
Jonathan Jenne 2021-03-03 15:55:55 +01:00
parent da0e4ed240
commit d546f92c50
3 changed files with 220 additions and 183 deletions

View File

@ -113,7 +113,8 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DDMonorepo\Modules.Patterns\bin\Debug\DigitalData.Modules.Patterns.dll</HintPath> <HintPath>..\..\..\DDMonorepo\Modules.Patterns\bin\Debug\DigitalData.Modules.Patterns.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.Windows"> <Reference Include="DigitalData.Modules.Windows, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DDMonorepo\Windows\bin\Debug\DigitalData.Modules.Windows.dll</HintPath> <HintPath>..\..\..\DDMonorepo\Windows\bin\Debug\DigitalData.Modules.Windows.dll</HintPath>
</Reference> </Reference>
<Reference Include="DigitalData.Modules.ZooFlow"> <Reference Include="DigitalData.Modules.ZooFlow">

File diff suppressed because it is too large Load Diff

View File

@ -4,13 +4,20 @@ Imports System.Globalization
Imports DD_Clipboard_Watcher.ClassConstants Imports DD_Clipboard_Watcher.ClassConstants
Imports DD_Clipboard_Watcher.ClassWindowAPI Imports DD_Clipboard_Watcher.ClassWindowAPI
Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.Windows
Imports DigitalData.GUIs.ClipboardWatcher Imports DigitalData.GUIs.ClipboardWatcher
Public Class frmMain Public Class frmMain
Private WithEvents Hotkey As New ClassHotkey(Me) Private WithEvents _Hotkey As New ClassHotkey(Me)
'Private WithEvents _Watcher As ClipboardWatcher = ClipboardWatcher.Singleton Private WithEvents _Watcher As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
Private WithEvents _Watcher2 As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
Private _Animator As New Animator() With {
.PopupColor = Color.FromArgb(255, 214, 49),
.PopupOpacity = 0.8,
.PopupSize = New Size(100, 30)
}
Private _MatchForm As frmMatch = Nothing Private _MatchForm As frmMatch = Nothing
Private _DataASorDB As ClassDataASorDB Private _DataASorDB As ClassDataASorDB
Public Sub New() Public Sub New()
' Dieser Aufruf ist für den Designer erforderlich. ' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent() InitializeComponent()
@ -54,16 +61,16 @@ Public Class frmMain
ClassInit.Refresh_Profile_Links() ClassInit.Refresh_Profile_Links()
_DataASorDB.Refresh_Connections() _DataASorDB.Refresh_Connections()
Try Try
Hotkey.AddHotKey(Keys.T, ClassHotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER) _Hotkey.AddHotKey(Keys.T, ClassHotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
Dim oKeyCode As Keys Dim oKeyCode As Keys
Dim oConverter As New KeysConverter Dim oConverter As New KeysConverter
Dim oObject As Object = oConverter.ConvertFromString(HotkeySearchKey.ToUpper) Dim oObject As Object = oConverter.ConvertFromString(HotkeySearchKey.ToUpper)
oKeyCode = CType(oObject, Keys) oKeyCode = CType(oObject, Keys)
If HotkeyFunctionKey = HOTKEY_CTRL Then If HotkeyFunctionKey = HOTKEY_CTRL Then
Hotkey.AddHotKey(oKeyCode, ClassHotkey.ModfierKey.MOD_CONTROL, ClassConstants.HOTKEY_TRIGGER_WATCHER) _Hotkey.AddHotKey(oKeyCode, ClassHotkey.ModfierKey.MOD_CONTROL, ClassConstants.HOTKEY_TRIGGER_WATCHER)
ElseIf HotkeyFunctionKey = HOTKEY_SHIFT Then ElseIf HotkeyFunctionKey = HOTKEY_SHIFT Then
Hotkey.AddHotKey(oKeyCode, ClassHotkey.ModfierKey.MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER) _Hotkey.AddHotKey(oKeyCode, ClassHotkey.ModfierKey.MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Warn($"Unexpected Error in Hotkey inititialize: {ex.Message}") Logger.Warn($"Unexpected Error in Hotkey inititialize: {ex.Message}")
@ -114,8 +121,8 @@ Public Class frmMain
End Try End Try
Try Try
Hotkey.RemoveHotKey(HOTKEY_TOGGLE_WATCHER) _Hotkey.RemoveHotKey(HOTKEY_TOGGLE_WATCHER)
Hotkey.RemoveHotKey(HOTKEY_TRIGGER_WATCHER) _Hotkey.RemoveHotKey(HOTKEY_TRIGGER_WATCHER)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Logger.Warn("Hotkeys could not be removed") Logger.Warn("Hotkeys could not be removed")
@ -124,7 +131,7 @@ Public Class frmMain
'TempDateien löschen 'TempDateien löschen
For Each oFile In TEMP_FILES For Each oFile In TEMP_FILES
Try Try
File.Delete(oFile) IO.File.Delete(oFile)
Catch ex As Exception Catch ex As Exception
Logger.Warn("Temp file {0} could not be deleted", oFile) Logger.Warn("Temp file {0} could not be deleted", oFile)
Logger.Error(ex) Logger.Error(ex)
@ -133,10 +140,10 @@ Public Class frmMain
End Sub End Sub
Private Sub frmClipboardWatch_Disposed(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Disposed Private Sub frmClipboardWatch_Disposed(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Disposed
_Watcher2.Dispose() _Watcher.Dispose()
End Sub End Sub
Private Sub WatcherChanged_New(ByVal sender As Object, ByVal e As String) Handles _Watcher2.Changed Private Sub WatcherChanged_New(ByVal sender As Object, ByVal e As String) Handles _Watcher.Changed
If MONITORING_ACTIVE = False Then If MONITORING_ACTIVE = False Then
Logger.Info("Clipboard Watcher is inactive!") Logger.Info("Clipboard Watcher is inactive!")
'NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Clipboard-watcher is inactive.", ToolTipIcon.Info) 'NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Clipboard-watcher is inactive.", ToolTipIcon.Info)
@ -218,8 +225,10 @@ Public Class frmMain
End Try End Try
End Sub End Sub
Private Sub ReceiveHotKey(ByVal HotKeyID As String) Handles Hotkey.HotKeyPressed Private Sub ReceiveHotKey(ByVal HotKeyID As String) Handles _Hotkey.HotKeyPressed
If HotKeyID = HOTKEY_TRIGGER_WATCHER Then If HotKeyID = HOTKEY_TRIGGER_WATCHER Then
_Animator.Highlight(Cursor.Position)
If CURRENT_CLIPBOARD_CONTENTS IsNot Nothing Then If CURRENT_CLIPBOARD_CONTENTS IsNot Nothing Then
If MONITORING_ACTIVE = True Then If MONITORING_ACTIVE = True Then
If CURRENT_MATCHING_PROFILES.Count = 0 Then If CURRENT_MATCHING_PROFILES.Count = 0 Then