ZooFlow: WIP Clipboard Watcher integration

This commit is contained in:
Jonathan Jenne
2021-01-14 16:46:06 +01:00
parent cfc4b17c34
commit a86f5e1703
12 changed files with 415 additions and 93 deletions

View File

@@ -14,8 +14,10 @@ Public Class ClassInit
Private _MainForm As frmFlowForm
Private _Logger As Logger
Private _LogConfig As LogConfig
Public Event Completed As EventHandler
Private _DataASorDB As ClassDataASorDB
Private _Loader As ClassInitLoader
Public Event Completed As EventHandler
Public Sub New(LogConfig As LogConfig, ParentForm As frmFlowForm)
_MainForm = ParentForm
@@ -36,22 +38,23 @@ Public Class ClassInit
MsgBox("Keine Verbindungs-Informationen hinterlegt. Anwendung wird beendet.", MsgBoxStyle.Critical, _MainForm.Text)
Application.Exit()
Else
Dim oInit As New ClassInitLoader()
_Loader = New ClassInitLoader()
' === Init Schritte definieren
oInit.AddStep("Checking connectivity..", AddressOf CheckConnectivity, True)
oInit.AddStep("Initializing User..", AddressOf InitializeUser, True)
oInit.AddStep("Initializing IDB Database..", AddressOf InitializeIDBDatabase, True)
oInit.AddStep("Initializing IDB Service..", AddressOf InitializeIDBService, True)
oInit.AddStep("Initializing Language..", AddressOf InitializeLanguage, False)
oInit.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False)
oInit.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False)
_Loader.AddStep("Checking connectivity..", AddressOf CheckConnectivity, True)
_Loader.AddStep("Initializing User..", AddressOf InitializeUser, True)
_Loader.AddStep("Initializing IDB Database..", AddressOf InitializeIDBDatabase, True)
_Loader.AddStep("Initializing IDB Service..", AddressOf InitializeIDBService, True)
_Loader.AddStep("Initializing Language..", AddressOf InitializeLanguage, False)
_Loader.AddStep("Initializing Clipboard Watcher..", AddressOf InitializeClipboardWatcher, False)
_Loader.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False)
_Loader.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False)
' === Init Schritte definieren
AddHandler oInit.ProgressChanged, AddressOf ProgressChanged
AddHandler oInit.InitCompleted, AddressOf InitCompleted
AddHandler _Loader.ProgressChanged, AddressOf ProgressChanged
AddHandler _Loader.InitCompleted, AddressOf InitCompleted
oInit.Run()
_Loader.Run()
End If
End Sub
@@ -96,6 +99,7 @@ Public Class ClassInit
My.Application.User = oMyApplication.User
My.Application.Modules = oMyApplication.Modules
My.Application.ModulesActive = oMyApplication.ModulesActive
My.Application.ClipboardWatcher = oMyApplication.ClipboardWatcher
RaiseEvent Completed(sender, Nothing)
End If
@@ -127,11 +131,9 @@ Public Class ClassInit
Dim oRow As DataRow = oDatatable.Rows.Item(0)
MyApplication.Settings.GdPictureKey = NotNull(oRow.Item("LICENSE"), String.Empty)
My.Application.Settings.GdPictureKey = NotNull(oRow.Item("LICENSE"), String.Empty)
My.Application.GDPictureLicense = My.Application.Settings.GdPictureKey
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error initializing3rdParty!")
Throw New InitException("Error initializing3rdParty!", ex)
End Try
End Sub
Private Sub InitBasicData(MyApplication As My.MyApplication)
@@ -156,7 +158,7 @@ Public Class ClassInit
Next
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitBasicData")
Throw New InitException("Error in InitBasicData", ex)
End Try
End Sub
@@ -182,7 +184,7 @@ Public Class ClassInit
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitBasicData")
Throw New InitException("Error in InitBasicData", ex)
End Try
End Sub
@@ -252,7 +254,40 @@ Public Class ClassInit
Catch ex As Exception
_Logger.Error(ex)
Throw ex
Throw New InitException("Error while initializing user!", ex)
End Try
End Sub
Private Sub InitializeClipboardWatcher(MyApplication As My.MyApplication)
Try
Dim oUserId = My.Application.User.UserId
Dim oWhereClause = $"T1.USER_ID = {oUserId} OR GROUP_ID IN (SELECT DISTINCT GUID FROM TBDD_GROUPS WHERE GUID IN (SELECT GROUP_ID FROM TBDD_GROUPS_USER WHERE USER_ID = {oUserId}))"
Dim oProfileSQL As String = $"SELECT DISTINCT GUID, NAME,REGEX_EXPRESSION,COMMENT,PROC_NAME,PROFILE_TYPE FROM VWCW_USER_PROFILE T1 WHERE {oWhereClause}"
Dim oProcessSQL As String = $"SELECT DISTINCT T.GUID, T.PROFILE_ID,T.PROC_NAME FROM TBCW_PROFILE_PROCESS T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
Dim oWindowSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_WINDOW T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
Dim oControlSQL As String = $"SELECT DISTINCT T.* FROM VWCW_PROFILE_REL_CONTROL T, VWCW_USER_PROFILE T1 WHERE T.PROFILE_ID = T1.GUID AND ({oWhereClause})"
Dim oUserProfiles = My.Database.GetDatatable(oProfileSQL)
If oUserProfiles Is Nothing OrElse oUserProfiles.Rows.Count = 0 Then
MyApplication.ClipboardWatcher.Status = ClipboardWatcher.State.EnumStatus.NoProfilesConfigured
End If
Dim oProfileProcesses = My.Database.GetDatatable(oProcessSQL)
Dim oProfileWindows = My.Database.GetDatatable(oWindowSQL)
Dim oProfileControls = My.Database.GetDatatable(oControlSQL)
MyApplication.ClipboardWatcher.Status = ClipboardWatcher.State.EnumStatus.OK
MyApplication.ClipboardWatcher.UserProfiles = oUserProfiles
MyApplication.ClipboardWatcher.ProfileProcesses = oProfileProcesses
MyApplication.ClipboardWatcher.ProfileWindows = oProfileWindows
MyApplication.ClipboardWatcher.ProfileControls = oProfileControls
MyApplication.ClipboardWatcher.MonitoringActive = True
Catch ex As Exception
MyApplication.ClipboardWatcher.Status = ClipboardWatcher.State.EnumStatus.Exception
_Logger.Error(ex)
Throw New InitException("Error while initializing clipboard watcher!", ex)
End Try
End Sub
@@ -277,7 +312,6 @@ Public Class ClassInit
MyApplication.User.Language = NotNull(oValue.ToString, "de-DE")
End Select
End Sub
Private Sub HandleModuleInfo(MyApplication As My.MyApplication, ModuleName As String, Row As DataRow)
Dim oValue As Object = Row.Item("VALUE")
Dim oName As String = Row.Item("NAME").ToString