Zooflow: MASSIVE Clean up in Globix Module
This commit is contained in:
@@ -50,11 +50,10 @@ Public Class frmFlowForm
|
||||
Private AdminForm As frmAdmin_Start
|
||||
Private Const mSnapOffset As Integer = 35
|
||||
|
||||
|
||||
' Events
|
||||
Public Event ClipboardChanged As EventHandler(Of IDataObject)
|
||||
Private WithEvents HotkeyClass As Hotkey
|
||||
Private WithEvents Watcher As ClipboardWatcher.Watcher = ClipboardWatcher.Watcher.Singleton
|
||||
Private WithEvents Watcher As Watcher = Watcher.Singleton
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New(My.LogConfig)
|
||||
@@ -70,109 +69,14 @@ Public Class frmFlowForm
|
||||
' === Show Splash Screen ===
|
||||
SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False)
|
||||
|
||||
' === Clean up logfiles ===
|
||||
FileClass = New Filesystem.File(My.LogConfig)
|
||||
FileClass.RemoveFiles(My.LogConfig.LogDirectory, 30, String.Empty, "log")
|
||||
|
||||
' === Initialize AppServer Database Connection with Failover
|
||||
AppServerOrDB = New ClassDataASorDB(My.LogConfig)
|
||||
|
||||
|
||||
|
||||
' === Initialization ===
|
||||
Init = New ClassInit(My.LogConfig, Me)
|
||||
AddHandler Init.Completed, AddressOf Init_Completed
|
||||
Init.InitializeApplication()
|
||||
End Sub
|
||||
Protected Overrides Sub WndProc(ByRef m As Message)
|
||||
' Listen for operating system messages
|
||||
Select Case m.Msg
|
||||
Case WM_WINDOWPOSCHANGING
|
||||
SnapToDesktopBorder(Me, m.LParam, 0)
|
||||
End Select
|
||||
|
||||
MyBase.WndProc(m)
|
||||
End Sub
|
||||
Public Shared Sub SnapToDesktopBorder(ByVal clientForm As Form, ByVal LParam As IntPtr, ByVal widthAdjustment As Integer)
|
||||
If clientForm Is Nothing Then
|
||||
' Satisfies rule: Validate parameters
|
||||
Throw New ArgumentNullException("clientForm")
|
||||
End If
|
||||
|
||||
' Snap client to the top, left, bottom or right desktop border
|
||||
' as the form is moved near that border.
|
||||
|
||||
Try
|
||||
' Marshal the LPARAM value which is a WINDOWPOS struct
|
||||
Dim NewPosition As New NativeMethods.WINDOWPOS
|
||||
NewPosition = CType(Marshal.PtrToStructure(LParam, GetType(NativeMethods.WINDOWPOS)), NativeMethods.WINDOWPOS)
|
||||
|
||||
If NewPosition.y = 0 OrElse NewPosition.x = 0 Then
|
||||
Return ' Nothing to do!
|
||||
End If
|
||||
|
||||
' Adjust the client size for borders and caption bar
|
||||
Dim ClientRect As Rectangle =
|
||||
clientForm.RectangleToScreen(clientForm.ClientRectangle)
|
||||
ClientRect.Width +=
|
||||
SystemInformation.FrameBorderSize.Width - widthAdjustment
|
||||
ClientRect.Height += (SystemInformation.FrameBorderSize.Height +
|
||||
SystemInformation.CaptionHeight)
|
||||
|
||||
' Now get the screen working area (without taskbar)
|
||||
Dim WorkingRect As Rectangle =
|
||||
System.Windows.Forms.Screen.GetWorkingArea(clientForm.ClientRectangle)
|
||||
|
||||
' Left border
|
||||
If NewPosition.x >= WorkingRect.X - mSnapOffset AndAlso
|
||||
NewPosition.x <= WorkingRect.X + mSnapOffset Then
|
||||
NewPosition.x = WorkingRect.X
|
||||
End If
|
||||
|
||||
' Get screen bounds and taskbar height
|
||||
' (when taskbar is horizontal)
|
||||
Dim ScreenRect As Rectangle =
|
||||
System.Windows.Forms.Screen.GetBounds(System.Windows.Forms.Screen.PrimaryScreen.Bounds)
|
||||
Dim TaskbarHeight As Integer =
|
||||
ScreenRect.Height - WorkingRect.Height
|
||||
|
||||
' Top border (check if taskbar is on top
|
||||
' or bottom via WorkingRect.Y)
|
||||
If NewPosition.y >= -mSnapOffset AndAlso
|
||||
(WorkingRect.Y > 0 AndAlso NewPosition.y <=
|
||||
(TaskbarHeight + mSnapOffset)) OrElse
|
||||
(WorkingRect.Y <= 0 AndAlso NewPosition.y <=
|
||||
(mSnapOffset)) Then
|
||||
If TaskbarHeight > 0 Then
|
||||
NewPosition.y = WorkingRect.Y ' Horizontal Taskbar
|
||||
Else
|
||||
NewPosition.y = 0 ' Vertical Taskbar
|
||||
End If
|
||||
End If
|
||||
|
||||
' Right border
|
||||
If NewPosition.x + ClientRect.Width <=
|
||||
WorkingRect.Right + mSnapOffset AndAlso
|
||||
NewPosition.x + ClientRect.Width >=
|
||||
WorkingRect.Right - mSnapOffset Then
|
||||
NewPosition.x = WorkingRect.Right - (ClientRect.Width +
|
||||
SystemInformation.FrameBorderSize.Width)
|
||||
End If
|
||||
|
||||
' Bottom border
|
||||
If NewPosition.y + ClientRect.Height <=
|
||||
WorkingRect.Bottom + mSnapOffset AndAlso
|
||||
NewPosition.y + ClientRect.Height >=
|
||||
WorkingRect.Bottom - mSnapOffset Then
|
||||
NewPosition.y = WorkingRect.Bottom - (ClientRect.Height +
|
||||
SystemInformation.FrameBorderSize.Height)
|
||||
End If
|
||||
|
||||
' Marshal it back
|
||||
Marshal.StructureToPtr(NewPosition, LParam, True)
|
||||
Catch ex As ArgumentException
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Completed(sender As Object, e As EventArgs)
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
@@ -258,8 +162,8 @@ Public Class frmFlowForm
|
||||
If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then
|
||||
FileDrop = New ClassFileDrop(My.LogConfig)
|
||||
FileHandle = New ClassFilehandle()
|
||||
FolderWatch = New ClassFolderwatcher
|
||||
Refresh_RegexTable()
|
||||
FolderWatch = New ClassFolderwatcher()
|
||||
NNRefresh_RegexTable()
|
||||
|
||||
Dim oFileExclusions As New ClassExclusions()
|
||||
If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then
|
||||
@@ -388,7 +292,7 @@ Public Class frmFlowForm
|
||||
End Sub
|
||||
|
||||
Sub ExitZooflow()
|
||||
Dim oResult As DialogResult = MessageBox.Show("Exit Zooflow", "Are you sure you want to close ZooFlow", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
Dim oResult As DialogResult = MessageBox.Show("Exit Zooflow", "Are you sure you want to close ZooFlow?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If oResult = DialogResult.Yes Then
|
||||
Application.Exit()
|
||||
Else
|
||||
@@ -399,7 +303,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) Handles PictureBox1.Click
|
||||
Private Sub PictureBox1_Click(sender As Object, e As EventArgs)
|
||||
frmSearchNeu.Show()
|
||||
|
||||
'Open_FlowSearch()
|
||||
@@ -854,45 +758,47 @@ Public Class frmFlowForm
|
||||
|
||||
oState.CurrentClipboardContents = ClipboardContents
|
||||
|
||||
If oState.MonitoringActive = False Then
|
||||
Dim oMessage As String = "Clipboard Watcher is not active!"
|
||||
Logger.Info(oMessage)
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
' TODO: These messages are so fucking annoying
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
'If oState.MonitoringActive = False Then
|
||||
' Dim oMessage As String = "Clipboard Watcher is not active!"
|
||||
' Logger.Info(oMessage)
|
||||
' MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
|
||||
If oState.UserProfiles Is Nothing Then
|
||||
Dim oMessage As String = "User Profiles are empty!"
|
||||
Logger.Info(oMessage)
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
'If oState.UserProfiles Is Nothing Then
|
||||
' Dim oMessage As String = "User Profiles are empty!"
|
||||
' Logger.Info(oMessage)
|
||||
' MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
|
||||
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
|
||||
Dim oMessage As String = "Profile Processes are empty!"
|
||||
Logger.Info(oMessage)
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
'If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
|
||||
' Dim oMessage As String = "Profile Processes are empty!"
|
||||
' Logger.Info(oMessage)
|
||||
' MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
|
||||
If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
|
||||
Dim oMessage As String = "Profile Processes are empty!"
|
||||
Logger.Info(oMessage)
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
'If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then
|
||||
' Dim oMessage As String = "Profile Processes are empty!"
|
||||
' Logger.Info(oMessage)
|
||||
' MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
|
||||
If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
|
||||
Dim oMessage As String = "Profile Processes are empty!"
|
||||
Logger.Info(oMessage)
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
'If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then
|
||||
' Dim oMessage As String = "Profile Processes are empty!"
|
||||
' Logger.Info(oMessage)
|
||||
' MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
Dim oWindowInfo = ClassWindow.GetWindowInfo()
|
||||
|
||||
@@ -901,9 +807,7 @@ Public Class frmFlowForm
|
||||
oState.MatchTreeView.Nodes.Clear()
|
||||
|
||||
ProfileFilter = New ProfileFilter(My.LogConfig,
|
||||
oState.UserProfiles, oState.ProfileProcesses,
|
||||
oState.ProfileWindows, oState.ProfileControls,
|
||||
oState.MatchTreeView)
|
||||
oState.UserProfiles, oState.ProfileProcesses, oState.ProfileWindows, oState.ProfileControls, oState.MatchTreeView)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Fehlermeldung: " & ex.Message, MsgBoxStyle.Critical, Text)
|
||||
@@ -1008,5 +912,9 @@ Public Class frmFlowForm
|
||||
frmtest.Show()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SucheTestToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SucheTestToolStripMenuItem.Click
|
||||
frmSearchNeu.Show()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user