Module modGlobals

    Private _isLoggedIn As Boolean
    Private _accountID As Integer

    'Sets and gets whether the user is logged in or not
    Public Property IsLoggedIn() As Boolean
        Get
            Return _isLoggedIn
        End Get
        Set(ByVal value As Boolean)
            _isLoggedIn = value
        End Set
    End Property


    Public Class ApplicationForms
        Private Shared _loginForm As frmLogin = Nothing
        Private Shared _profileOverview As frmProfileOverview
        Private Shared _createAccount As frmCreateAccount
        Private Shared _recipeOverview As frmRecipeOverview

        
        Public Shared Sub CloseLoginForm()
            If Not _loginForm Is Nothing Then
                _loginForm = Nothing
            End If
        End Sub

        Public Shared Function LoginForm() As frmLogin
            If _loginForm Is Nothing Then
                _loginForm = New frmLogin
            End If

            Return _loginForm

        End Function


        Public Shared Sub CloseProfileOverviewForm()
            If Not _profileOverview Is Nothing Then
                _profileOverview = Nothing
            End If
        End Sub

        Public Shared Function ProfileOverviewForm() As frmProfileOverview
            If _profileOverview Is Nothing Then
                _profileOverview = New frmProfileOverview
            End If

            Return _profileOverview

        End Function


        Public Shared Sub CloseCreateAccountForm()
            If Not _createAccount Is Nothing Then
                _createAccount = Nothing
            End If
        End Sub

        Public Shared Function CreateAccountForm() As frmCreateAccount
            If _createAccount Is Nothing Then
                _createAccount = New frmCreateAccount
            End If

            Return _createAccount
        End Function


        Public Shared Sub CloseRecipeOverviewForm()
            If Not _recipeOverview Is Nothing Then
                _recipeOverview = Nothing
            End If
        End Sub

        Public Shared Function RecipeOverviewForm() As frmRecipeOverview
            If _recipeOverview Is Nothing Then
                _recipeOverview = New frmRecipeOverview
            End If

            Return _recipeOverview
        End Function

    End Class

    Public Property CurrentAccountID() As Integer
        Get
            Return _accountID
        End Get
        Set(ByVal value As Integer)
            _accountID = value
        End Set
    End Property


   
End Module
