This commit is contained in:
Jonathan Jenne
2019-10-25 16:09:17 +02:00
parent 7280e604fa
commit dbe4abfb39
4 changed files with 118 additions and 140 deletions

View File

@@ -7,11 +7,10 @@ Imports DigitalData.Controls.RegexEditor
Imports DigitalData.Modules.Windows.Window
Public Class ctrlApplicationAssignment
Public AppSelectionString As String
Private Current_ProfileId As Integer
Private Current_WindowId As Integer
Private Current_ProcessGUID As Integer
Private Current_ControlId As Integer
Public SelectedProfileId As Integer = 0
Public SelectedProcessId As Integer = 0
Public SelectedWindowId As Integer = 0
Public SelectedControlId As Integer = 0
Private Sub ctrlApplicationAssignment_Load(sender As Object, e As EventArgs) Handles Me.Load
TBCW_PROFILE_PROCESSTableAdapter.Connection.ConnectionString = MyConnectionString
@@ -24,7 +23,7 @@ Public Class ctrlApplicationAssignment
Public Function AssignProfileID(ProfileId As Integer) As Boolean
Try
Current_ProfileId = ProfileId
SelectedProfileId = ProfileId
Return True
Catch ex As Exception
Logger.Error(ex)
@@ -33,8 +32,6 @@ Public Class ctrlApplicationAssignment
End Function
Public Function Process_Load(ProfileId As Integer) As Boolean
Try
TBCW_PROFILE_PROCESSTableAdapter.Fill(MyDataset.TBCW_PROFILE_PROCESS, ProfileId)
Return True
Catch ex As Exception
@@ -66,7 +63,7 @@ Public Class ctrlApplicationAssignment
End If
End If
Process_Load(Current_ProfileId)
Process_Load(SelectedProfileId)
Return True
Catch ex As Exception
Logger.Error(ex)
@@ -82,7 +79,7 @@ Public Class ctrlApplicationAssignment
Dim oProcessId = GridViewProcessProfile.GetFocusedRowCellValue(GridViewProcessProfile.Columns("GUID"))
Dim oSQL = String.Format("EXEC PRCW_DELETE_PROCESS {0}", oProcessId)
If Database.ExecuteNonQuery(oSQL) Then
Process_Load(Current_ProfileId)
Process_Load(SelectedProfileId)
Return True
End If
@@ -152,7 +149,7 @@ Public Class ctrlApplicationAssignment
Dim oGuid = GridView_Window.GetFocusedRowCellValue(GridView_Window.Columns("GUID"))
Dim oSQL = String.Format("EXEC PRCW_DELETE_WINDOW {0}", oGuid)
If Database.ExecuteNonQuery(oSQL) Then
Process_Load(Current_ProfileId)
Process_Load(SelectedProfileId)
Return True
End If
@@ -182,7 +179,7 @@ Public Class ctrlApplicationAssignment
Public Function Control_Load() As Boolean
Try
TBCW_PROF_REL_CONTROLTableAdapter.Fill(MyDataset.TBCW_PROF_REL_CONTROL, Current_WindowId)
TBCW_PROF_REL_CONTROLTableAdapter.Fill(MyDataset.TBCW_PROF_REL_CONTROL, SelectedWindowId)
Return True
Catch ex As Exception
@@ -205,7 +202,7 @@ Public Class ctrlApplicationAssignment
,[BOTTOMLEFT_TOP],[BOTTOMLEFT_LEFT],[BOTTOMLEFT_RIGHT],[BOTTOMLEFT_BOTTOM]
,[BOTTOMRIGHT_TOP],[BOTTOMRIGHT_LEFT],[BOTTOMRIGHT_RIGHT],[BOTTOMRIGHT_BOTTOM]
) VALUES (
{Current_WindowId}, 'Beispiel Beschreibung', '{oForm.ControlName}', '{Environment.UserName}',
{SelectedWindowId}, 'Beispiel Beschreibung', '{oForm.ControlName}', '{Environment.UserName}',
{oForm.TopLeft.Top}, {oForm.TopLeft.Left}, {oForm.TopLeft.Right}, {oForm.TopLeft.Bottom},
{oForm.TopRight.Top}, {oForm.TopRight.Left}, {oForm.TopRight.Right}, {oForm.TopRight.Bottom},
{oForm.TopLeft.Top}, {oForm.TopLeft.Left}, {oForm.TopLeft.Right}, {oForm.TopLeft.Bottom},
@@ -299,7 +296,7 @@ Public Class ctrlApplicationAssignment
[BOTTOMRIGHT_BOTTOM] = {oForm.BottomRight.Bottom},
[BOTTOMRIGHT_LEFT] = {oForm.BottomRight.Left},
[BOTTOMRIGHT_RIGHT] = {oForm.BottomRight.Right}
WHERE GUID = {Current_ControlId}
WHERE GUID = {SelectedControlId}
"
If Database.ExecuteNonQuery(oSql) = False Then
@@ -360,11 +357,12 @@ Public Class ctrlApplicationAssignment
Dim oSelectedRow As DataRow = GridViewProcessProfile.GetDataRow(e.FocusedRowHandle)
Dim oProcessName As String = oSelectedRow.Item("PROC_NAME")
Dim oPRocessGUID = oSelectedRow.Item("GUID")
AppSelectionString = $"Selected Profile: {oPRocessGUID}-{oProcessName}"
CURRENT_PROCESSID = oPRocessGUID
Dim oProcessGUID = oSelectedRow.Item("GUID")
CURRENT_PROCESSID = oProcessGUID
CURRENT_PROCESSNAME = oProcessName
SelectedProcessId = oProcessGUID
If Window_Load() = False Then
MsgBox($"Error while loading windows for process {oProcessName}", vbCritical, "")
End If
@@ -384,27 +382,26 @@ Public Class ctrlApplicationAssignment
Dim oSelectedRow As DataRow = GridView_Window.GetDataRow(e.FocusedRowHandle)
Dim oWindowId As String = oSelectedRow.Item("GUID")
Current_WindowId = oWindowId
AppSelectionString = AppSelectionString & $" / WindowID: {oWindowId}"
If Control_Load() = False Then
MsgBox($"Error while loading controls for window {oWindowId}", vbCritical, "")
End If
SelectedWindowId = oWindowId
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub GridView_Control_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles GridView_Control.FocusedRowChanged
If e.FocusedRowHandle < 0 Then
Current_ControlId = Nothing
SelectedControlId = Nothing
Exit Sub
End If
Dim oSelectedRow As DataRow = GridView_Control.GetDataRow(e.FocusedRowHandle)
Dim oControlGUID = oSelectedRow.Item("GUID")
Current_ControlId = oSelectedRow.Item("GUID")
AppSelectionString = AppSelectionString & $" - Selected ControlGUID: {oControlGUID}"
SelectedControlId = oControlGUID
End Sub
End Class