Refactor btnLink enabling logic by profile type

EnableBtnLink() now enables/disables btnLink based on the selected profile's type, applying specific logic for "db", "activedirectory", "xml", and "fulltext". The method is also called after regex and XML tree changes to keep the button state in sync with the UI.
This commit is contained in:
OlgunR
2026-03-16 11:17:16 +01:00
parent a55b90e352
commit a90bf67575

View File

@@ -1396,9 +1396,30 @@ Public Class frmNIVerknuepfungen
End Function
Private Sub EnableBtnLink()
If Me._selectedProfil Is Nothing Then
btnLink.Enabled = False
Return
End If
Select Case Me._selectedProfil.Ni_Art
Case "db", "activedirectory"
btnLink.Enabled =
lbxWMIndex.SelectedItems.Count > 0 And
(lbxQuelle1.SelectedItems.Count > 0 OrElse txtManIndexwert.Text <> "")
Case "xml"
btnLink.Enabled =
lbxWMIndex.SelectedItems.Count > 0 And
(trvwxml.SelectedNode IsNot Nothing OrElse txtManIndexwert.Text <> "")
Case "fulltext"
btnLink.Enabled =
lbxWMIndex.SelectedItems.Count > 0 And
(txtregex.Text <> "" OrElse txtManIndexwert.Text <> "")
Case Else
btnLink.Enabled = False
End Select
End Sub
Private Sub btnLink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLink.Click
@@ -3463,6 +3484,7 @@ Public Class frmNIVerknuepfungen
End If
End If
EnableBtnLink()
'Catch ex As Exception
' MsgBox("Fehler bei Check Änderung Regex:" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical)
'End Try
@@ -3611,8 +3633,7 @@ Public Class frmNIVerknuepfungen
End Sub
Private Sub trvwxml_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles trvwxml.AfterSelect
EnableBtnLink()
End Sub
Private Sub tabctrlbottom_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tabctrlbottom.SelectedIndexChanged