Imports System.Threading
Imports IntraSell_DLL
Imports IntraSell_Net_Base
Imports IntraSell_Net_Starter

Public Class ClassIntraSellUpdate

#Region "CheckUpdates"
    Shared CheckUpdatesThread As New Thread(AddressOf UpdateIntraSellSilent)
    'Silently upgrades 
    Shared Sub CheckUpdates()
        If VarValue_Default("Updates installieren_autostart", "false") Then
            CheckUpdatesThread.Start()
        End If
    End Sub

    Private Shared Sub UpdateIntraSellSilent()
        Thread.Sleep(60000) ' Nach 1 minute
        Dim Update As New ClassUpdate
        Update.UpdateIntraSell(True)

        Dim UpdateDb = New ClassDBUpgrade
        UpdateDb.ProcessAllSQLFiles()
    End Sub

    Public Shared Sub StopCheckUpdates()
        If CheckUpdatesThread IsNot Nothing Then
            CheckUpdatesThread.Abort()
            CheckUpdatesThread = Nothing
        End If
    End Sub
#End Region

End Class
