Merge branch 'master' of http://dd-vmp07-com04:3000/AppStd/Monorepo
This commit is contained in:
@@ -11,9 +11,135 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.Modules.Messaging
|
||||
Imports DigitalData.Modules.Windows
|
||||
Imports DigitalData.GUIs.Common.Base
|
||||
|
||||
Public Class frmFlowForm
|
||||
#Region "Sidebar DllImport"
|
||||
<DllImport("SHELL32", CallingConvention:=CallingConvention.StdCall)>
|
||||
Private Shared Function SHAppBarMessage(ByVal dwMessage As Integer, ByRef BarrData As AppDeskBar) As Integer
|
||||
End Function
|
||||
<DllImport("User32.dll", CharSet:=CharSet.Auto)>
|
||||
Public Shared Function RegisterWindowMessage(ByVal msg As String) As Integer
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Sidebar Variablen"
|
||||
Private AppDeskData As AppDeskBar
|
||||
Private fBarRegistered As Boolean = False
|
||||
Private Property uCallBack As Integer
|
||||
|
||||
Private Structure RECT
|
||||
Public left As Integer
|
||||
Public top As Integer
|
||||
Public right As Integer
|
||||
Public bottom As Integer
|
||||
End Structure
|
||||
Private Structure AppDeskBar
|
||||
Public cbSize As Integer
|
||||
Public hWnd As IntPtr
|
||||
Public uCallbackMessage As Integer
|
||||
Public uEdge As Integer
|
||||
Public rc As RECT
|
||||
Public lParam As IntPtr
|
||||
End Structure
|
||||
Private Enum ABMsg
|
||||
ABM_NEW = 0
|
||||
ABM_REMOVE = 1
|
||||
ABM_QUERYPOS = 2
|
||||
ABM_SETPOS = 3
|
||||
ABM_GETSTATE = 4
|
||||
ABM_GETTASKBARPOS = 5
|
||||
ABM_ACTIVATE = 6
|
||||
ABM_GETAUTOHIDEBAR = 7
|
||||
ABM_SETAUTOHIDEBAR = 8
|
||||
ABM_WINDOWPOSCHANGED = 9
|
||||
ABM_SETSTATE = 10
|
||||
End Enum
|
||||
Public Enum ABEdge
|
||||
ABE_LEFT = 0
|
||||
ABE_TOP
|
||||
ABE_RIGHT
|
||||
ABE_BOTTOM
|
||||
End Enum
|
||||
Private Enum ABNotify
|
||||
ABN_STATECHANGE = 0
|
||||
ABN_POSCHANGED
|
||||
ABN_FULLSCREENAPP
|
||||
ABN_WINDOWARRANGE
|
||||
End Enum
|
||||
#End Region
|
||||
|
||||
#Region "Sidebar Enum Properties Register"
|
||||
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
|
||||
If m.Msg = uCallBack Then
|
||||
Select Case m.WParam.ToInt32()
|
||||
Case CInt(ABNotify.ABN_POSCHANGED)
|
||||
ABSetPos(ABEdge.ABE_RIGHT)
|
||||
End Select
|
||||
End If
|
||||
MyBase.WndProc(m)
|
||||
End Sub
|
||||
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
|
||||
Get
|
||||
Dim cp As CreateParams = MyBase.CreateParams
|
||||
cp.Style = cp.Style And Not &HC00000 ' WS_CAPTION
|
||||
cp.Style = cp.Style And Not &H800000 ' WS_BORDER
|
||||
cp.ExStyle = &H80 Or &H8 ' WS_EX_TOOLWINDOW | WS_EX_TOPMOST
|
||||
Return cp
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Private Sub ABSetPos(ByVal dockEdge As ABEdge)
|
||||
Dim abd As New AppDeskBar()
|
||||
abd.cbSize = Marshal.SizeOf(abd)
|
||||
abd.hWnd = Me.Handle
|
||||
abd.uEdge = CInt(dockEdge)
|
||||
If abd.uEdge = CInt(ABEdge.ABE_LEFT) Or abd.uEdge = CInt(ABEdge.ABE_RIGHT) Then
|
||||
abd.rc.top = 0
|
||||
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
|
||||
If abd.uEdge = CInt(ABEdge.ABE_LEFT) Then
|
||||
abd.rc.left = 0
|
||||
abd.rc.right = Size.Width
|
||||
Else
|
||||
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
|
||||
abd.rc.left = abd.rc.right - Size.Width
|
||||
End If
|
||||
Else
|
||||
abd.rc.left = 0
|
||||
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
|
||||
If abd.uEdge = CInt(ABEdge.ABE_TOP) Then
|
||||
abd.rc.top = 0
|
||||
abd.rc.bottom = Size.Height
|
||||
Else
|
||||
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
|
||||
abd.rc.top = abd.rc.bottom - Size.Height
|
||||
End If
|
||||
End If
|
||||
' Query the system for an approved size and position.
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_QUERYPOS), abd)
|
||||
' Adjust the rectangle, depending on the edge to which the
|
||||
' appbar is anchored.
|
||||
Select Case abd.uEdge
|
||||
Case CInt(ABEdge.ABE_LEFT)
|
||||
abd.rc.right = abd.rc.left + Size.Width
|
||||
Case CInt(ABEdge.ABE_RIGHT)
|
||||
abd.rc.left = abd.rc.right - Size.Width
|
||||
Case CInt(ABEdge.ABE_TOP)
|
||||
abd.rc.bottom = abd.rc.top + Size.Height
|
||||
Case CInt(ABEdge.ABE_BOTTOM)
|
||||
abd.rc.top = abd.rc.bottom - Size.Height
|
||||
End Select
|
||||
' Pass the final bounding rectangle to the system.
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_SETPOS), abd)
|
||||
' Move and size the appbar so that it conforms to the
|
||||
' bounding rectangle passed to the system.
|
||||
|
||||
Me.Location = New Point(abd.rc.left, abd.rc.top)
|
||||
Dim PSBH = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
|
||||
Dim TaskBarHeight = PSBH - System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height
|
||||
Me.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - TaskBarHeight
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
' Constants
|
||||
Private Const OPACITY_INITIAL = 0
|
||||
@@ -25,6 +151,8 @@ Public Class frmFlowForm
|
||||
' Common Helpers Classes
|
||||
Private Init As ClassInit
|
||||
Private FileClass As Filesystem.File
|
||||
Private ErrorHandler As BaseErrorHandler
|
||||
Private Logger As Logger
|
||||
|
||||
' Globix Helper Classes
|
||||
Private FileDrop As ClassFileDrop
|
||||
@@ -35,11 +163,6 @@ Public Class frmFlowForm
|
||||
Private ClassWindow As Window
|
||||
Private ProfileFilter As ProfileFilter
|
||||
Private ProfileLoader As ClassProfileLoader
|
||||
'Private Animator As New Animator() With {
|
||||
' .PopupColor = Color.FromArgb(255, 214, 49),
|
||||
' .PopupOpacity = 0.8,
|
||||
' .PopupSize = New Size(100, 30)
|
||||
'}
|
||||
|
||||
' Runtime Flags
|
||||
Private ApplicationLoading As Boolean = True
|
||||
@@ -50,22 +173,11 @@ Public Class frmFlowForm
|
||||
Private IndexForm As frmGlobix_Index
|
||||
Private AdminForm As frmAdmin_Start
|
||||
|
||||
|
||||
' Events
|
||||
Public Event ClipboardChanged As EventHandler(Of IDataObject)
|
||||
Private WithEvents HotkeyClass As Hotkey
|
||||
Private WithEvents Watcher As Watcher = Watcher.Singleton
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New(My.LogConfig)
|
||||
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
|
||||
' === Hide form initially ===
|
||||
Opacity = OPACITY_INITIAL
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
' === Show Splash Screen ===
|
||||
SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False)
|
||||
@@ -75,9 +187,12 @@ Public Class frmFlowForm
|
||||
AddHandler Init.Completed, AddressOf Init_Completed
|
||||
Init.InitializeApplication()
|
||||
|
||||
' Register Form as Sidebar
|
||||
My.Application.Sidebar = New Sidebar(Handle)
|
||||
My.Application.Sidebar.RegisterSidebar(My.UIConfig.SidebarScreen)
|
||||
' === Register Sidebar ===
|
||||
RegisterBar(ABEdge.ABE_RIGHT)
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
UnregisterBar()
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Completed(sender As Object, e As EventArgs)
|
||||
@@ -86,6 +201,15 @@ Public Class frmFlowForm
|
||||
ApplicationLoading = False
|
||||
SplashScreenManager.CloseForm(False)
|
||||
|
||||
' === Initialize Error Handler ===
|
||||
Logger = My.LogConfig.GetLogger()
|
||||
ErrorHandler = New BaseErrorHandler(My.LogConfig, Logger, Me)
|
||||
|
||||
' Register Form as Sidebar
|
||||
My.Application.Sidebar = New Sidebar2(Me)
|
||||
My.Application.Sidebar.RegisterBar(Sidebar2.ABEdge.ABE_RIGHT)
|
||||
'RegisterBar(ABEdge.ABE_RIGHT)
|
||||
|
||||
' === Setup Timers ===
|
||||
AddHandler TimerRefreshData.Tick, AddressOf TimerRefreshData_Tick
|
||||
TimerRefreshData.Enabled = True
|
||||
@@ -93,13 +217,6 @@ Public Class frmFlowForm
|
||||
' === Register As Event Listener ===
|
||||
EventBus.Instance.Register(Me)
|
||||
|
||||
' === Set Form Properties ===
|
||||
TopMost = True
|
||||
AllowDrop = True
|
||||
ShowInTaskbar = False
|
||||
Opacity = OPACITY_SHOWN
|
||||
Location = My.UIConfig.FlowForm.Location
|
||||
|
||||
' === Setup Event Handlers ===
|
||||
AddHandler KeyDown, AddressOf frmFlowForm_KeyDown
|
||||
AddHandler KeyUp, AddressOf frmFlowForm_KeyDown
|
||||
@@ -187,6 +304,29 @@ Public Class frmFlowForm
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Public Sub RegisterBar(ByVal dockEdge As ABEdge)
|
||||
AppDeskData = New AppDeskBar()
|
||||
AppDeskData.cbSize = Marshal.SizeOf(AppDeskData)
|
||||
AppDeskData.hWnd = Me.Handle
|
||||
If Not fBarRegistered Then
|
||||
uCallBack = RegisterWindowMessage("AppBarMessage")
|
||||
AppDeskData.uCallbackMessage = uCallBack
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_NEW), AppDeskData) 'ToDo: Unsigned Integers not supported
|
||||
fBarRegistered = True
|
||||
ABSetPos(ABEdge.ABE_RIGHT)
|
||||
Else
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_REMOVE), AppDeskData)
|
||||
fBarRegistered = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub UnregisterBar()
|
||||
If fBarRegistered Then
|
||||
fBarRegistered = False
|
||||
SHAppBarMessage(ABMsg.ABM_REMOVE, AppDeskData)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Init_Folderwatch()
|
||||
Try
|
||||
Dim oSql As String = "SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId
|
||||
@@ -286,6 +426,7 @@ Public Class frmFlowForm
|
||||
Public Sub OnEvent(Params As Object)
|
||||
Logger.Debug("OnEvent called!")
|
||||
End Sub
|
||||
|
||||
Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
|
||||
frmSearchNeu.Show()
|
||||
|
||||
@@ -897,5 +1038,11 @@ Public Class frmFlowForm
|
||||
Private Sub TestFlowSearchToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TestFlowSearchToolStripMenuItem.Click
|
||||
Open_FlowSearch()
|
||||
End Sub
|
||||
|
||||
Private Sub ShowErrorMessage(pEx As Exception)
|
||||
Dim oCallingClass = LogConfig.GetClassFullName(IncludeMethodNames:=True, Parts:=2)
|
||||
ErrorHandler.ShowErrorMessage(pEx, oCallingClass)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user