33 lines
1.3 KiB
VB.net
33 lines
1.3 KiB
VB.net
Imports DigitalData.Controls.SQLConfig
|
|
Imports DigitalData.Modules.Config
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Logging
|
|
|
|
Public Class frmStart
|
|
Public Property LogConfig As LogConfig
|
|
Public Property ConfigManager As ConfigManager(Of Config)
|
|
Public Property Database As MSSQLServer
|
|
|
|
Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Try
|
|
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Monitor")
|
|
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath)
|
|
|
|
If ConfigManager.Config.ConnectionString = String.Empty Then
|
|
Dim oSQLConfig As New frmSQLConfig(LogConfig)
|
|
If oSQLConfig.ShowDialog() = DialogResult.OK Then
|
|
ConfigManager.Config.ConnectionString = oSQLConfig.ConnectionString
|
|
ConfigManager.Save()
|
|
Else
|
|
ShowErrorMessage("No Database configured. Application will close!")
|
|
Application.Exit()
|
|
|
|
End If
|
|
End If
|
|
|
|
Database = New MSSQLServer(LogConfig, ConfigManager.Config.ConnectionString)
|
|
Catch ex As Exception
|
|
ShowErrorMessage(ex)
|
|
End Try
|
|
End Sub
|
|
End Class |