Public Class TraceSwitch
    Inherits SourceSwitch

    Public Sub New(Name As String)
        MyBase.New("System.ServiceModel")
        Level = SourceLevels.Information
        WcfTracesController.Instance.LevelController = AddressOf WcfTracesLevelController
    End Sub

    Public Sub WcfTracesLevelController(ByVal level As SourceLevels)
        Me.Level = level
    End Sub
End Class

Public Class WcfTracesController
    Private Shared Controller As WcfTracesController = Nothing

    Private Sub New()
    End Sub

    Public Delegate Sub TraceLevelController(ByVal level As SourceLevels)
    Public LevelController As TraceLevelController

    Public Shared ReadOnly Property Instance As WcfTracesController
        Get

            If Controller Is Nothing Then
                Controller = New WcfTracesController()
            End If

            Return Controller
        End Get
    End Property
End Class
