Imports DigitalData.Modules.Logging

Public Class frmSQLEditor
    Private ReadOnly _LogConfig As LogConfig
    Private ReadOnly _Logger As Logger
    Private ReadOnly _Connections As DataTable

    Public Sub New(LogConfig As LogConfig, DatatableConnections As DataTable)
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()

        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
        _LogConfig = LogConfig
        _Logger = LogConfig.GetLogger()
        _Connections = DatatableConnections
    End Sub

    Private Sub frmSQLEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LoadConnections()
    End Sub

    Private Sub LoadConnections()
        Try
            For Each oRow As DataRow In _Connections.Rows
                cmbConnections.Properties.Items.Add(
                    New Connection() With {
                        .Name = oRow.Item("BEZEICHNUNG"),
                        .Value = oRow.Item("GUID")
                    })
            Next
        Catch ex As Exception
            _Logger.Error(ex)
        End Try
    End Sub

    Private Class Connection
        Public Property Value
        Public Property Name

        Public Overrides Function ToString() As String
            Return Name
        End Function
    End Class
End Class