Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.EDMI.API

Namespace My
    ''' <summary>
    ''' Extends the My Namespace
    ''' Example: My.LogConfig
    ''' </summary>
    <HideModuleName()>
    Module Extension
        Property SystemConfigManager As ConfigManager(Of ClassConfig)
        ReadOnly Property SystemConfig As ClassConfig
            Get
                Return SystemConfigManager.Config
            End Get
        End Property

        Property UIConfigManager As ConfigManager(Of ClassUIConfig)
        ReadOnly Property UIConfig As ClassUIConfig
            Get
                Return UIConfigManager.Config
            End Get
        End Property

        Property LogConfig As LogConfig
        Property MainForm As frmAdmin_Start
        Property SearchForm As frmSearchStart

#Region "Database"
        Property Database As DatabaseWithFallback
        Property DatabaseECM As MSSQLServer
        Property DatabaseIDB As MSSQLServer

        Property Tables As New ClassTables
        Property Queries As New ClassQueries
        Property Helpers As ClassHelpers
#End Region

    End Module

    ''' <summary>
    ''' Extends the My.Application Namespace to hold Application State
    ''' Example: My.Application.User
    ''' </summary>
    Partial Friend Class MyApplication
        Public Property Settings As New State.SettingsState
        Public Property User As New State.UserState
        Public Property Service As New State.ServiceState
        Public Property Modules As New Dictionary(Of String, State.ModuleState)
        Public Property ModulesActive As New List(Of String)
        Public Property ClipboardWatcher As New ClipboardWatcher.State
        Public Property IDB_ConnectionString As String
        Public Property Globix As New Globix.State
        Public Property Search As New Search.State
        Public Property Sidebar As Sidebar

        Public CommandLineFunction As String
        Public CommandLineArguments As New Dictionary(Of String, String)

        Public Function GetEnvironment() As Environment
            Return New Environment With {
                .Database = My.DatabaseECM,
                .DatabaseIDB = My.DatabaseIDB,
                .Modules = My.Application.Modules,
                .Service = My.Application.Service,
                .Settings = My.Application.Settings,
                .User = My.Application.User
            }
        End Function
    End Class
End Namespace

