more tweaks

This commit is contained in:
Jonathan Jenne 2019-10-24 13:30:04 +02:00
parent 6c3658853c
commit 68724748a9
5 changed files with 62 additions and 39 deletions

View File

@ -239,8 +239,8 @@ Public Class ClassInit
Dim ProfileSQL As String = $"SELECT DISTINCT GUID, NAME,REGEX_EXPRESSION,COMMENT,PROC_NAME,PROFILE_TYPE FROM VWCW_USER_PROFILE T1 WHERE {oWhereClause}" Dim ProfileSQL 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 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 * FROM VWCW_PROFILE_REL_WINDOW 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 * FROM VWCW_PROFILE_REL_CONTROL 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})"
Try Try
DT_USER_PROFILES = Database.GetDatatable(ProfileSQL) DT_USER_PROFILES = Database.GetDatatable(ProfileSQL)

View File

@ -116,7 +116,10 @@ Public Class ctrlApplicationAssignment
End Sub End Sub
Public Function Window_CreateAssignment(ProfileId As Integer) As Boolean Public Function Window_CreateAssignment(ProfileId As Integer) As Boolean
Dim oForm As New frmProcessCapture() Dim oRow = GridViewProcessProfile.GetDataRow(GridViewProcessProfile.FocusedRowHandle)
Dim oCurrentProcess = oRow.Item("PROC_NAME")
Dim oForm As New frmProcessCapture(oCurrentProcess)
Dim oResult = oForm.ShowDialog() Dim oResult = oForm.ShowDialog()
If oResult = DialogResult.OK Then If oResult = DialogResult.OK Then

View File

@ -55,13 +55,9 @@ Public Class frmControlCapture
txtControlName.Text = oControl.ControlName txtControlName.Text = oControl.ControlName
ControlName = oControl.ControlName ControlName = oControl.ControlName
End If End If
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
MsgBox($"Control Name konnte nicht ausgelesen werden!{vbNewLine}Dies kann ein temporärer Fehler sein. Bitte versuchen Sie es noch einmal.", MsgBoxStyle.Exclamation, Text) MsgBox($"Control Name konnte nicht ausgelesen werden!{vbNewLine}Dies kann ein temporärer Fehler sein. Bitte versuchen Sie es noch einmal.", MsgBoxStyle.Exclamation, Text)
Finally
Logger.EndBlock()
End Try End Try
Try Try
@ -96,9 +92,9 @@ Public Class frmControlCapture
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
MsgBox($"Control Koordinaten konnten nicht ausgelesen werden!{vbNewLine}Dies kann ein temporärer Fehler sein. Bitte versuchen Sie es noch einmal.", MsgBoxStyle.Exclamation, Text) MsgBox($"Control Koordinaten konnten nicht ausgelesen werden!{vbNewLine}Dies kann ein temporärer Fehler sein. Bitte versuchen Sie es noch einmal.", MsgBoxStyle.Exclamation, Text)
Finally
Logger.EndBlock()
End Try End Try
UpdateOKButton()
End Sub End Sub
Public Shared Function GetBoundsString(TopLeft As RectangleInfo, TopRight As RectangleInfo, BottomLeft As RectangleInfo, BottomRight As RectangleInfo) Public Shared Function GetBoundsString(TopLeft As RectangleInfo, TopRight As RectangleInfo, BottomLeft As RectangleInfo, BottomRight As RectangleInfo)
@ -120,27 +116,30 @@ Public Class frmControlCapture
Return oResult Return oResult
End Function End Function
Private Sub UpdateOKButton()
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlName.CheckedChanged If rbControlName.Checked Then
txtControlName.Enabled = rbControlName.Checked txtControlName.Enabled = rbControlName.Checked
txtControlBounds.Enabled = Not rbControlName.Checked txtControlBounds.Enabled = Not rbControlName.Checked
btnOK.Enabled = rbControlName.Checked And ControlName <> String.Empty btnOK.Enabled = rbControlName.Checked And ControlName <> String.Empty
End Sub ElseIf rbControlPosition.Checked Then
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlPosition.CheckedChanged
txtControlBounds.Enabled = rbControlPosition.Checked txtControlBounds.Enabled = rbControlPosition.Checked
txtControlName.Enabled = Not rbControlPosition.Checked txtControlName.Enabled = Not rbControlPosition.Checked
btnOK.Enabled = rbControlPosition.Checked And TopLeft IsNot Nothing btnOK.Enabled = rbControlPosition.Checked And TopLeft IsNot Nothing
End If
End Sub
Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlName.CheckedChanged
UpdateOKButton()
End Sub
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles rbControlPosition.CheckedChanged
UpdateOKButton()
End Sub End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnOK.Click Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnOK.Click
If txtControlName.Text = String.Empty And txtControlBounds.Text = String.Empty Then
MsgBox("Kein Control gefunden!")
DialogResult = DialogResult.Cancel
End If
If rbControlPosition.Checked Then If rbControlPosition.Checked Then
ControlName = String.Empty ControlName = String.Empty
ElseIf rbControlName.Checked Then ElseIf rbControlName.Checked Then

View File

@ -42,7 +42,7 @@ Partial Class frmProcessCapture
Me.txtPID.Location = New System.Drawing.Point(132, 4) Me.txtPID.Location = New System.Drawing.Point(132, 4)
Me.txtPID.Name = "txtPID" Me.txtPID.Name = "txtPID"
Me.txtPID.ReadOnly = True Me.txtPID.ReadOnly = True
Me.txtPID.Size = New System.Drawing.Size(224, 21) Me.txtPID.Size = New System.Drawing.Size(218, 21)
Me.txtPID.TabIndex = 1 Me.txtPID.TabIndex = 1
' '
'txtName 'txtName
@ -51,14 +51,14 @@ Partial Class frmProcessCapture
Me.txtName.Location = New System.Drawing.Point(132, 32) Me.txtName.Location = New System.Drawing.Point(132, 32)
Me.txtName.Name = "txtName" Me.txtName.Name = "txtName"
Me.txtName.ReadOnly = True Me.txtName.ReadOnly = True
Me.txtName.Size = New System.Drawing.Size(224, 21) Me.txtName.Size = New System.Drawing.Size(218, 21)
Me.txtName.TabIndex = 2 Me.txtName.TabIndex = 2
' '
'Label1 'Label1
' '
Me.Label1.AutoSize = True Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(12, 9) Me.Label1.Location = New System.Drawing.Point(9, 7)
Me.Label1.Name = "Label1" Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(62, 13) Me.Label1.Size = New System.Drawing.Size(62, 13)
Me.Label1.TabIndex = 3 Me.Label1.TabIndex = 3
@ -68,7 +68,7 @@ Partial Class frmProcessCapture
' '
Me.Label2.AutoSize = True Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(12, 35) Me.Label2.Location = New System.Drawing.Point(9, 35)
Me.Label2.Name = "Label2" Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(78, 13) Me.Label2.Size = New System.Drawing.Size(78, 13)
Me.Label2.TabIndex = 3 Me.Label2.TabIndex = 3
@ -76,10 +76,10 @@ Partial Class frmProcessCapture
' '
'Label3 'Label3
' '
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(12, 98) Me.Label3.Location = New System.Drawing.Point(12, 98)
Me.Label3.Name = "Label3" Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(344, 42) Me.Label3.Size = New System.Drawing.Size(338, 42)
Me.Label3.TabIndex = 4 Me.Label3.TabIndex = 4
Me.Label3.Text = "Auswertung von aktivem Fenster läuft! Wechseln Sie durch die aktiven Anwendungen!" & Me.Label3.Text = "Auswertung von aktivem Fenster läuft! Wechseln Sie durch die aktiven Anwendungen!" &
"" ""
@ -94,14 +94,14 @@ Partial Class frmProcessCapture
Me.txtWindowTitle.Location = New System.Drawing.Point(132, 58) Me.txtWindowTitle.Location = New System.Drawing.Point(132, 58)
Me.txtWindowTitle.Name = "txtWindowTitle" Me.txtWindowTitle.Name = "txtWindowTitle"
Me.txtWindowTitle.ReadOnly = True Me.txtWindowTitle.ReadOnly = True
Me.txtWindowTitle.Size = New System.Drawing.Size(224, 21) Me.txtWindowTitle.Size = New System.Drawing.Size(218, 21)
Me.txtWindowTitle.TabIndex = 2 Me.txtWindowTitle.TabIndex = 2
' '
'Label4 'Label4
' '
Me.Label4.AutoSize = True Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label4.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(12, 61) Me.Label4.Location = New System.Drawing.Point(9, 61)
Me.Label4.Name = "Label4" Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(71, 13) Me.Label4.Size = New System.Drawing.Size(71, 13)
Me.Label4.TabIndex = 3 Me.Label4.TabIndex = 3
@ -112,7 +112,7 @@ Partial Class frmProcessCapture
Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button2.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.cancel Me.Button2.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.cancel
Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft Me.Button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button2.Location = New System.Drawing.Point(197, 155) Me.Button2.Location = New System.Drawing.Point(191, 153)
Me.Button2.Name = "Button2" Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(159, 34) Me.Button2.Size = New System.Drawing.Size(159, 34)
Me.Button2.TabIndex = 0 Me.Button2.TabIndex = 0
@ -125,7 +125,7 @@ Partial Class frmProcessCapture
Me.Button1.Enabled = False Me.Button1.Enabled = False
Me.Button1.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.add Me.Button1.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.add
Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button1.Location = New System.Drawing.Point(18, 155) Me.Button1.Location = New System.Drawing.Point(12, 153)
Me.Button1.Name = "Button1" Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(159, 34) Me.Button1.Size = New System.Drawing.Size(159, 34)
Me.Button1.TabIndex = 0 Me.Button1.TabIndex = 0

View File

@ -5,6 +5,21 @@ Public Class frmProcessCapture
Public ProcessName As String Public ProcessName As String
Public WindowTitle As String Public WindowTitle As String
Private _CurrentProcess As String = String.Empty
Public Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
End Sub
Public Sub New(CurrentProcess As String)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_CurrentProcess = CurrentProcess
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim oWindow = ClassWindowAPI.GetWindowInfo() Dim oWindow = ClassWindowAPI.GetWindowInfo()
@ -13,8 +28,9 @@ Public Class frmProcessCapture
End If End If
Dim oProgramName As String = Assembly.GetEntryAssembly().GetName().Name Dim oProgramName As String = Assembly.GetEntryAssembly().GetName().Name
Dim oIsClipboardWatcherWindow = oWindow.ProcessName <> oProgramName
Dim oIsCorrectProcessName = IIf(_CurrentProcess = String.Empty, True, oWindow.ProcessName = _CurrentProcess)
If oWindow.ProcessName <> oProgramName Then
txtPID.Text = oWindow.ProcessId txtPID.Text = oWindow.ProcessId
txtName.Text = oWindow.ProcessName txtName.Text = oWindow.ProcessName
txtWindowTitle.Text = oWindow.WindowTitle txtWindowTitle.Text = oWindow.WindowTitle
@ -22,7 +38,12 @@ Public Class frmProcessCapture
ProcessName = oWindow.ProcessName ProcessName = oWindow.ProcessName
WindowTitle = oWindow.WindowTitle WindowTitle = oWindow.WindowTitle
If oIsClipboardWatcherWindow And oIsCorrectProcessName Then
Button1.Enabled = True Button1.Enabled = True
txtName.BackColor = SystemColors.Control
Else
Button1.Enabled = False
txtName.BackColor = Color.LightSalmon
End If End If
End Sub End Sub