WIP: cleanup, work on doc result form
This commit is contained in:
113
GUIs.ZooFlow/frmFlowForm.vb
Normal file
113
GUIs.ZooFlow/frmFlowForm.vb
Normal file
@@ -0,0 +1,113 @@
|
||||
Imports DigitalData.Modules.Messaging
|
||||
|
||||
Public Class frmFlowForm
|
||||
Private WithEvents Watcher As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
|
||||
Private ActiveModules As List(Of String)
|
||||
|
||||
Private CurrentState As OnFlowFormStateChangedEvent.FlowFormState = OnFlowFormStateChangedEvent.FlowFormState.Default
|
||||
|
||||
Public Event ClipboardChanged As EventHandler(Of IDataObject)
|
||||
|
||||
Public Sub New(ActiveModules As List(Of String))
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
|
||||
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
||||
Me.ActiveModules = ActiveModules
|
||||
End Sub
|
||||
|
||||
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 MouseClick, New MouseEventHandler(AddressOf Form_MouseClick)
|
||||
AddHandler MouseMove, New MouseEventHandler(AddressOf Form_MouseMove)
|
||||
|
||||
' === Register As Event Listener ===
|
||||
EventBus.Instance.Register(Me)
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_Closed(sender As Object, e As EventArgs) Handles Me.Closed
|
||||
EventBus.Instance.Unregister(Me)
|
||||
End Sub
|
||||
|
||||
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)
|
||||
End Sub
|
||||
|
||||
Public Sub SetFlowFormState(State As OnFlowFormStateChangedEvent.FlowFormState)
|
||||
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 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.HasFileDropped)
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||||
' Handle a message dragged from Outlook
|
||||
e.Effect = DragDropEffects.Copy
|
||||
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.HasFileDropped)
|
||||
Else
|
||||
' Otherwise, do not handle
|
||||
e.Effect = DragDropEffects.None
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_DragLeave(sender As Object, e As EventArgs) Handles Me.DragLeave
|
||||
SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.Default)
|
||||
End Sub
|
||||
|
||||
Private Sub Watcher_ClipboardChanged(sender As Object, e As IDataObject) Handles Watcher.ClipboardChanged
|
||||
If ActiveModules.Contains(ClassConstants.MODULE_CLIPBOARDWATCHER) Then
|
||||
RaiseEvent ClipboardChanged(sender, e)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'''' <summary>
|
||||
'''' DragDrop Support
|
||||
'''' </summary>
|
||||
'Protected Overrides Sub WndProc(ByRef m As Message)
|
||||
' If m.Msg = &H84 Then
|
||||
' m.Result = CType(2, IntPtr)
|
||||
' Return
|
||||
' End If
|
||||
|
||||
' MyBase.WndProc(m)
|
||||
'End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user