Fix Automatic Profile by Regex

This commit is contained in:
Jonathan Jenne 2021-04-09 16:38:02 +02:00
parent a8531bc454
commit 0f9ad5659b

View File

@ -1581,8 +1581,9 @@ Public Class frmIndex
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
End If
Else
If DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
End If
If ComboboxDoctype.SelectedItem Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then
For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows
Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
@ -1593,17 +1594,15 @@ Public Class frmIndex
Dim oFoundDocType = ComboboxDoctype.Properties.Items.
Cast(Of DocType)().
Where(Function(dt) dt.Name = CURRENT_LASTDOKART).
Where(Function(dt) dt.Guid = oRoW.Item("DOCTYPE_ID")).
FirstOrDefault()
If oFoundDocType IsNot Nothing Then
ComboboxDoctype.SelectedItem = oFoundDocType
End If
Exit For
End If
Next
End If
Next
End If
Catch ex As Exception
ShowErrorMessage(ex, "Form Shown")
@ -1626,10 +1625,8 @@ Public Class frmIndex
For Each oRow As DataRow In oDoctypes.Rows
ComboboxDoctype.Properties.Items.Add(New DocType With {
.Guid = oRow.Item("DOCTYPE_ID"),
.Name = oRow.Item("DOCTYPE")
})
Dim oDocType = New DocType With {.Guid = oRow.Item("DOCTYPE_ID"), .Name = oRow.Item("DOCTYPE")}
ComboboxDoctype.Properties.Items.Add(oDocType)
Next
ComboboxDoctype.SelectedIndex = -1