initialize zooflow
This commit is contained in:
parent
b0cb37e52c
commit
5c7375d124
66
Filesystem/EncryptionLegacy.vb
Normal file
66
Filesystem/EncryptionLegacy.vb
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
Imports System.Security.Cryptography
|
||||||
|
|
||||||
|
Public Class EncryptionLegacy
|
||||||
|
Private TripleDes As New TripleDESCryptoServiceProvider
|
||||||
|
Sub New(ByVal key As String)
|
||||||
|
' Initialize the crypto provider.
|
||||||
|
TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8)
|
||||||
|
TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function TruncateHash(ByVal key As String, ByVal length As Integer) As Byte()
|
||||||
|
Dim sha1 As New SHA1CryptoServiceProvider
|
||||||
|
|
||||||
|
' Hash the key.
|
||||||
|
Dim keyBytes() As Byte =
|
||||||
|
System.Text.Encoding.Unicode.GetBytes(key)
|
||||||
|
Dim hash() As Byte = sha1.ComputeHash(keyBytes)
|
||||||
|
|
||||||
|
' Truncate or pad the hash.
|
||||||
|
ReDim Preserve hash(length - 1)
|
||||||
|
Return hash
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function EncryptData(ByVal plaintext As String) As String
|
||||||
|
|
||||||
|
' Convert the plaintext string to a byte array.
|
||||||
|
Dim plaintextBytes() As Byte =
|
||||||
|
System.Text.Encoding.Unicode.GetBytes("!Didalog35452Heuchelheim=" & plaintext)
|
||||||
|
|
||||||
|
' Create the stream.
|
||||||
|
Dim ms As New System.IO.MemoryStream
|
||||||
|
' Create the encoder to write to the stream.
|
||||||
|
Dim encStream As New CryptoStream(ms,
|
||||||
|
TripleDes.CreateEncryptor(),
|
||||||
|
System.Security.Cryptography.CryptoStreamMode.Write)
|
||||||
|
|
||||||
|
' Use the crypto stream to write the byte array to the stream.
|
||||||
|
encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
|
||||||
|
encStream.FlushFinalBlock()
|
||||||
|
|
||||||
|
' Convert the encrypted stream to a printable string.
|
||||||
|
Return Convert.ToBase64String(ms.ToArray)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
'Entschlüsselt die Zeichenfolge
|
||||||
|
Public Function DecryptData(ByVal encryptedtext As String) As String
|
||||||
|
' Convert the encrypted text string to a byte array.
|
||||||
|
Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)
|
||||||
|
|
||||||
|
' Create the stream.
|
||||||
|
Dim ms As New System.IO.MemoryStream
|
||||||
|
' Create the decoder to write to the stream.
|
||||||
|
Dim decStream As New CryptoStream(ms,
|
||||||
|
TripleDes.CreateDecryptor(),
|
||||||
|
System.Security.Cryptography.CryptoStreamMode.Write)
|
||||||
|
|
||||||
|
' Use the crypto stream to write the byte array to the stream.
|
||||||
|
decStream.Write(encryptedBytes, 0, encryptedBytes.Length)
|
||||||
|
decStream.FlushFinalBlock()
|
||||||
|
Dim result = System.Text.Encoding.Unicode.GetString(ms.ToArray)
|
||||||
|
result = result.Replace("!Didalog35452Heuchelheim=", "")
|
||||||
|
' Convert the plaintext stream to a string.
|
||||||
|
Return result
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
|
||||||
@ -77,6 +77,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Compression.vb" />
|
<Compile Include="Compression.vb" />
|
||||||
<Compile Include="DocumentObject.vb" />
|
<Compile Include="DocumentObject.vb" />
|
||||||
|
<Compile Include="EncryptionLegacy.vb" />
|
||||||
<Compile Include="FileContainer.vb" />
|
<Compile Include="FileContainer.vb" />
|
||||||
<Compile Include="Encryption.vb" />
|
<Compile Include="Encryption.vb" />
|
||||||
<Compile Include="File.vb">
|
<Compile Include="File.vb">
|
||||||
|
|||||||
@ -2,4 +2,6 @@
|
|||||||
Public Const PROVIDER_MSSQL = "MS-SQL"
|
Public Const PROVIDER_MSSQL = "MS-SQL"
|
||||||
Public Const PROVIDER_ORACLE = "ORACLE"
|
Public Const PROVIDER_ORACLE = "ORACLE"
|
||||||
Public Const PROVIDER_ODBC = "ODBC"
|
Public Const PROVIDER_ODBC = "ODBC"
|
||||||
|
|
||||||
|
Public Const DEFAULT_TIMEOUT = 120
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
44
ZooFlow/ApplicationEvents.vb
Normal file
44
ZooFlow/ApplicationEvents.vb
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
Imports Microsoft.VisualBasic.ApplicationServices
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DigitalData.Modules.Config
|
||||||
|
Imports DigitalData.Modules.Logging.LogConfig
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
' Für MyApplication sind folgende Ereignisse verfügbar:
|
||||||
|
' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst.
|
||||||
|
' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung mit einem Fehler beendet wird.
|
||||||
|
' UnhandledException: Wird bei einem Ausnahmefehler ausgelöst.
|
||||||
|
' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn die Anwendung bereits aktiv ist.
|
||||||
|
' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst.
|
||||||
|
Partial Friend Class MyApplication
|
||||||
|
Private _Logger As Logger
|
||||||
|
|
||||||
|
Private _BaseUserConfigPath As String = Windows.Forms.Application.UserAppDataPath
|
||||||
|
Private _BaseLocalUserConfigPath As String = Windows.Forms.Application.LocalUserAppDataPath
|
||||||
|
Private _BaseMachineConfigPath As String = Windows.Forms.Application.CommonAppDataPath
|
||||||
|
|
||||||
|
Public Sub App_Startup() Handles Me.Startup
|
||||||
|
Dim oLogConfig As New LogConfig(PathType.AppData)
|
||||||
|
|
||||||
|
' System Config files like Service Url will be saved in %LocalAppdata% so they will remain on the machine
|
||||||
|
Dim oSystemConfigManager As New ConfigManager(Of ClassConfig)(oLogConfig,
|
||||||
|
_BaseLocalUserConfigPath,
|
||||||
|
_BaseMachineConfigPath)
|
||||||
|
|
||||||
|
' Layout files will be saved in %Appdata% (Roaming) so they will be syncronized with the user profile
|
||||||
|
Dim oUIConfigPath = IO.Path.Combine(_BaseUserConfigPath, ClassConstants.FOLDER_NAME_LAYOUT)
|
||||||
|
Dim oUIConfigManager As New ConfigManager(Of ClassUIConfig)(oLogConfig, oUIConfigPath, oUIConfigPath)
|
||||||
|
|
||||||
|
LogConfig = oLogConfig
|
||||||
|
SystemConfigManager = oSystemConfigManager
|
||||||
|
UIConfigManager = oUIConfigManager
|
||||||
|
|
||||||
|
_Logger = LogConfig.GetLogger()
|
||||||
|
_Logger.Debug("Starting Client Suite..")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub App_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown
|
||||||
|
_Logger.Debug("Shutting down Client Suite..")
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
22
ZooFlow/Base/BaseClass.vb
Normal file
22
ZooFlow/Base/BaseClass.vb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
|
||||||
|
Namespace Base
|
||||||
|
''' <summary>
|
||||||
|
''' Base Class which supplies a Logger/LogConfig
|
||||||
|
''' </summary>
|
||||||
|
Public Class BaseClass
|
||||||
|
Protected LogConfig As LogConfig
|
||||||
|
Protected Logger As Logger
|
||||||
|
|
||||||
|
Public Sub New(LogConfig As LogConfig)
|
||||||
|
Dim oClassName = Me.GetType().Name
|
||||||
|
|
||||||
|
Me.LogConfig = LogConfig
|
||||||
|
Me.Logger = LogConfig.GetLogger(oClassName)
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
25
ZooFlow/ClassConstants.vb
Normal file
25
ZooFlow/ClassConstants.vb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Public Class ClassConstants
|
||||||
|
Public Const SERVICE_MAX_MESSAGE_SIZE = 2147483647
|
||||||
|
Public Const SERVICE_MAX_BUFFER_SIZE = 2147483647
|
||||||
|
Public Const SERVICE_MAX_ARRAY_LENGTH = 2147483647
|
||||||
|
Public Const SERVICE_MAX_STRING_LENGTH = 2147483647
|
||||||
|
Public Const SERVICE_MAX_CONNECTIONS = 10000
|
||||||
|
Public Const SERVICE_OPEN_TIMEOUT = 3
|
||||||
|
|
||||||
|
Public Const CONTROL_TEXTEDIT = "TextBox"
|
||||||
|
Public Const CONTROL_MEMOEDIT = "Memoedit"
|
||||||
|
Public Const CONTROL_COMBOEDIT = "Combobox"
|
||||||
|
Public Const CONTROL_CHECKEDIT = "Checkbox"
|
||||||
|
Public Const CONTROL_RADIOEDIT = "Radiobutton"
|
||||||
|
Public Const CONTROL_DATEEDIT = "Datepicker"
|
||||||
|
|
||||||
|
Public Const FOLDER_NAME_LAYOUT = "Layout"
|
||||||
|
|
||||||
|
Public Const ATTRIBUTE_ID_COLUMN = "RECORD_ID"
|
||||||
|
|
||||||
|
Public Const DB_USER_ATTRIBUTE_ID = 1
|
||||||
|
Public Const DB_USER_ATTRIBUTE_SYSKEY = "001"
|
||||||
|
|
||||||
|
Public Const DB_GROUP_ATTRIBUTE_ID = 2
|
||||||
|
Public Const DB_GROUP_ATTRIBUTE_SYSKEY = "002"
|
||||||
|
End Class
|
||||||
60
ZooFlow/ClassErrorHandler.vb
Normal file
60
ZooFlow/ClassErrorHandler.vb
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
Imports System.Reflection
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Public Class ClassErrorHandler
|
||||||
|
Private _Logger As Logger
|
||||||
|
|
||||||
|
Private Const UNKNOWN_METHOD = "Unknown Method"
|
||||||
|
Private Const UNKNOWN_FORM = "Unknown Form"
|
||||||
|
|
||||||
|
Public Sub New(Logger As Logger)
|
||||||
|
_Logger = Logger
|
||||||
|
End Sub
|
||||||
|
Public Sub ShowErrorMessage(Exception As Exception)
|
||||||
|
_Logger.Error(Exception)
|
||||||
|
MsgBox(GetMessage(Exception), MsgBoxStyle.Critical, "Unexpected Error")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetMessage(Exception As Exception)
|
||||||
|
Dim oTargetSite = Exception.TargetSite
|
||||||
|
Dim oMethodName = GetMethodName(Exception)
|
||||||
|
Dim oFormName = GetFormName(Exception)
|
||||||
|
Dim oMessage As String = String.Empty
|
||||||
|
|
||||||
|
oMessage &= $"Form: {oFormName}{vbNewLine}"
|
||||||
|
oMessage &= $"Method: {oMethodName}{vbNewLine}"
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||||
|
oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}"
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||||
|
oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}"
|
||||||
|
End If
|
||||||
|
|
||||||
|
oMessage &= $"{vbNewLine}"
|
||||||
|
oMessage &= $"Please report this error to error@digitaldata.works"
|
||||||
|
|
||||||
|
Return oMessage
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetMethodName(Exception As Exception) As String
|
||||||
|
Dim oMethodName = Exception.TargetSite?.ReflectedType?.Name
|
||||||
|
|
||||||
|
If oMethodName Is Nothing Then
|
||||||
|
Return UNKNOWN_METHOD
|
||||||
|
Else
|
||||||
|
Return oMethodName
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetFormName(Exception As Exception) As String
|
||||||
|
Dim oFormName = Exception.TargetSite?.ReflectedType?.ReflectedType?.Name
|
||||||
|
|
||||||
|
If oFormName Is Nothing Then
|
||||||
|
Return UNKNOWN_FORM
|
||||||
|
Else
|
||||||
|
Return oFormName
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
78
ZooFlow/ClassInit.vb
Normal file
78
ZooFlow/ClassInit.vb
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
Imports System.ComponentModel
|
||||||
|
Imports DevExpress.XtraSplashScreen
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports DigitalData.Modules.Filesystem
|
||||||
|
|
||||||
|
Public Class ClassInit
|
||||||
|
Private _MainForm As frmMain
|
||||||
|
|
||||||
|
Public Sub New(ParentForm As frmMain)
|
||||||
|
_MainForm = ParentForm
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub InitializeApplication()
|
||||||
|
' Init Connectivity
|
||||||
|
' - Database / Service / Application Server
|
||||||
|
' (Init Licensing)
|
||||||
|
' Init User
|
||||||
|
' Zeile -> Objekt / NameValue List
|
||||||
|
|
||||||
|
If Not InitializeDatabase() Then
|
||||||
|
MsgBox("Verbindung konnte nicht hergestellt werden! Anwendung wird beendet", MsgBoxStyle.Critical, _MainForm.Text)
|
||||||
|
Application.Exit()
|
||||||
|
Else
|
||||||
|
Dim oInit As New ClassInitLoader()
|
||||||
|
oInit.AddStep("Checking connectivity..", AddressOf CheckConnectivity, True)
|
||||||
|
oInit.AddStep("Checking connectivity..2", AddressOf CheckConnectivity, True)
|
||||||
|
oInit.AddStep("Checking connectivity..3", AddressOf CheckConnectivity, True)
|
||||||
|
oInit.AddStep("Checking connectivity..4", AddressOf CheckConnectivity, True)
|
||||||
|
oInit.AddStep("Checking connectivity..5", AddressOf CheckConnectivity, True)
|
||||||
|
oInit.AddStep("Checking connectivity..6", AddressOf CheckConnectivity, True)
|
||||||
|
|
||||||
|
AddHandler oInit.ProgressChanged, AddressOf ProgressChanged
|
||||||
|
AddHandler oInit.InitCompleted, AddressOf InitCompleted
|
||||||
|
|
||||||
|
SplashScreenManager.ActivateParentOnSplashFormClosing = True
|
||||||
|
SplashScreenManager.ShowForm(_MainForm, GetType(frmSplash), False, False)
|
||||||
|
|
||||||
|
oInit.Run()
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ProgressChanged(sender As Object, Progress As ClassInitLoader.InitProgress)
|
||||||
|
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetProgress, Progress.CurrentPercent)
|
||||||
|
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetActionName, Progress.CurrentStep.Name)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub InitCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
|
||||||
|
SplashScreenManager.CloseForm(False)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CheckConnectivity()
|
||||||
|
Dim oCrypt As New EncryptionLegacy("!35452didalog=")
|
||||||
|
Dim oBuilder = My.SystemConfig.GetConnectionStringBuilder(My.SystemConfig.ConnectionString)
|
||||||
|
oBuilder.Password = oCrypt.DecryptData(oBuilder.Password)
|
||||||
|
Dim oDecryptedConnectionString = oBuilder.ToString
|
||||||
|
|
||||||
|
My.Database = New MSSQLServer(My.LogConfig, oDecryptedConnectionString)
|
||||||
|
|
||||||
|
If My.Database.DBInitialized = False Then
|
||||||
|
Throw New ApplicationException()
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function InitializeDatabase() As Boolean
|
||||||
|
If My.SystemConfig.ConnectionString = String.Empty Then
|
||||||
|
Dim oResult = frmConfigDatabase.ShowDialog()
|
||||||
|
|
||||||
|
If oResult = DialogResult.Cancel Then
|
||||||
|
MsgBox("Es wurde keine Datenbank hinterlegt. Die Anwendung wird beendet.")
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
92
ZooFlow/ClassInitLoader.vb
Normal file
92
ZooFlow/ClassInitLoader.vb
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
Imports System.ComponentModel
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Public Class ClassInitLoader
|
||||||
|
Private _Worker As BackgroundWorker
|
||||||
|
Private _Logger As Logger
|
||||||
|
Private _CurrentStep As InitStep
|
||||||
|
|
||||||
|
Public Steps As New List(Of InitStep)
|
||||||
|
Public Event ProgressChanged As EventHandler(Of InitProgress)
|
||||||
|
Public Event InitCompleted As EventHandler(Of RunWorkerCompletedEventArgs)
|
||||||
|
|
||||||
|
Public Sub New()
|
||||||
|
_Logger = My.LogConfig.GetLogger()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub AddStep(Name As String, Action As Action, Optional Fatal As Boolean = False)
|
||||||
|
Steps.Add(New InitStep() With {
|
||||||
|
.Name = Name,
|
||||||
|
.Action = Action,
|
||||||
|
.Fatal = Fatal
|
||||||
|
})
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Function Run() As Boolean
|
||||||
|
_Worker = New BackgroundWorker()
|
||||||
|
_Worker.WorkerReportsProgress = True
|
||||||
|
|
||||||
|
AddHandler _Worker.DoWork, AddressOf DoWork
|
||||||
|
AddHandler _Worker.ProgressChanged, Sub(sender As Object, e As ProgressChangedEventArgs)
|
||||||
|
Dim oProgress As New InitProgress() With {
|
||||||
|
.CurrentStep = _CurrentStep,
|
||||||
|
.CurrentPercent = e.ProgressPercentage
|
||||||
|
}
|
||||||
|
RaiseEvent ProgressChanged(sender, oProgress)
|
||||||
|
End Sub
|
||||||
|
AddHandler _Worker.RunWorkerCompleted, Sub(sender As Object, e As RunWorkerCompletedEventArgs)
|
||||||
|
RaiseEvent InitCompleted(sender, e)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
_Worker.RunWorkerAsync()
|
||||||
|
|
||||||
|
Return True
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub DoWork(sender As Object, e As DoWorkEventArgs)
|
||||||
|
Dim oStepCounter = 0
|
||||||
|
|
||||||
|
For Each oStep In Steps
|
||||||
|
_CurrentStep = oStep
|
||||||
|
|
||||||
|
Try
|
||||||
|
oStep.Action.Invoke()
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
_Logger.Warn("Init Step '{0}' failed!", oStep.Name)
|
||||||
|
|
||||||
|
If oStep.Fatal Then
|
||||||
|
_Logger.Warn("Fatal error in '{0}'. Init will be aborted!", oStep.Name)
|
||||||
|
e.Cancel = True
|
||||||
|
End If
|
||||||
|
End Try
|
||||||
|
|
||||||
|
oStepCounter += 1
|
||||||
|
|
||||||
|
Dim oPercentComplete As Integer = CInt(Math.Truncate(oStepCounter / Steps.Count * 100))
|
||||||
|
_Worker.ReportProgress(oPercentComplete)
|
||||||
|
|
||||||
|
Threading.Thread.Sleep(600)
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Class InitProgress
|
||||||
|
Public CurrentStep As InitStep
|
||||||
|
Public CurrentPercent As Integer
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Class InitStep
|
||||||
|
''' <summary>
|
||||||
|
''' Human Readable Name of init step
|
||||||
|
''' </summary>
|
||||||
|
Public Name As String
|
||||||
|
''' <summary>
|
||||||
|
''' The function to execute
|
||||||
|
''' </summary>
|
||||||
|
Public Action As Action
|
||||||
|
''' <summary>
|
||||||
|
''' Should init be aborted if this step fails?
|
||||||
|
''' </summary>
|
||||||
|
Public Fatal As Boolean
|
||||||
|
End Class
|
||||||
|
End Class
|
||||||
48
ZooFlow/Config/ClassConfig.vb
Normal file
48
ZooFlow/Config/ClassConfig.vb
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
Imports System.Xml.Serialization
|
||||||
|
Imports DigitalData.Modules.Config.ConfigAttributes
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' --- User Config for EDMI ---
|
||||||
|
'''
|
||||||
|
''' All settings are simple properties that should have a default value where possible
|
||||||
|
'''
|
||||||
|
''' More complex properties (for example, ServiceConnection) are built from simple ones,
|
||||||
|
''' should be readonly and have an `XmlIgnore` Attribute to prevent them from being saved to the config file.
|
||||||
|
'''
|
||||||
|
''' They can make saving and loading complex properties more easy.
|
||||||
|
'''
|
||||||
|
''' The config is loaded with `ConfigManager` which is initialized in ApplicationEvents
|
||||||
|
''' to ensure that the config is loaded before any of the forms (that might need a config)
|
||||||
|
'''
|
||||||
|
''' The config object can be accessed in two ways:
|
||||||
|
'''
|
||||||
|
''' - My.ConfigManager.Config
|
||||||
|
''' - My.Config (which simply points to My.ConfigManager.Config)
|
||||||
|
'''
|
||||||
|
''' After changing a config value, My.ConfigManager.Save() must be called to persist the change in the config file
|
||||||
|
''' </summary>
|
||||||
|
Public Class ClassConfig
|
||||||
|
Public Function GetConnectionStringBuilder(ConnectionString As String) As SqlClient.SqlConnectionStringBuilder
|
||||||
|
Try
|
||||||
|
If ConnectionString = String.Empty Then
|
||||||
|
Return Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim oBuilder As New SqlClient.SqlConnectionStringBuilder(ConnectionString)
|
||||||
|
Return oBuilder
|
||||||
|
Catch ex As Exception
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
' === Service Configuration ===
|
||||||
|
<ConnectionString>
|
||||||
|
Public Property ConnectionString As String = String.Empty
|
||||||
|
|
||||||
|
' === Logging Configuration
|
||||||
|
Public Property LogDebug As Boolean = False
|
||||||
|
|
||||||
|
' === User Configuration ===
|
||||||
|
Public Property UserLanguage As String = "de-DE"
|
||||||
|
End Class
|
||||||
12
ZooFlow/Config/ClassUIConfig.vb
Normal file
12
ZooFlow/Config/ClassUIConfig.vb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Public Class ClassUIConfig
|
||||||
|
Public Property SkinName As String = "Office 2016 Colorful"
|
||||||
|
|
||||||
|
Public Property EditFormConfigs As New List(Of EditFormConfig)
|
||||||
|
|
||||||
|
Public Class EditFormConfig
|
||||||
|
Public Property SysKey As String
|
||||||
|
|
||||||
|
Public Property SplitterDistance As Integer = 700
|
||||||
|
Public Property SplitterHorizontal As Boolean = True
|
||||||
|
End Class
|
||||||
|
End Class
|
||||||
@ -1,3 +1,8 @@
|
|||||||
DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
DevExpress.XtraEditors.PictureEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
|
||||||
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraEditors.ProgressBarControl, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||||
|
|||||||
42
ZooFlow/MyApplication.vb
Normal file
42
ZooFlow/MyApplication.vb
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
Imports DigitalData.Modules.Config
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
|
||||||
|
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 frmMain
|
||||||
|
Property Database As MSSQLServer
|
||||||
|
End Module
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Extends the My.Application Namespace to hold Application State
|
||||||
|
''' Example: My.Application.User
|
||||||
|
''' </summary>
|
||||||
|
Partial Class MyApplication
|
||||||
|
' User Config
|
||||||
|
Public User As New ClassUserState()
|
||||||
|
Public Service As New ClassServiceState()
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
|
|
||||||
4
ZooFlow/State/ClassServiceState.vb
Normal file
4
ZooFlow/State/ClassServiceState.vb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Public Class ClassServiceState
|
||||||
|
Public Property Online As Boolean = True
|
||||||
|
Public Property LastChecked As DateTime = DateTime.Now
|
||||||
|
End Class
|
||||||
20
ZooFlow/State/ClassUserState.vb
Normal file
20
ZooFlow/State/ClassUserState.vb
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Imports System.Threading
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Helper Class to hold User State
|
||||||
|
''' </summary>
|
||||||
|
Public Class ClassUserState
|
||||||
|
Public UserName As String
|
||||||
|
Public MachineName As String
|
||||||
|
Public Language As String
|
||||||
|
Public IsAdmin As Boolean
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' Initialize user object with values that can be read from the environment
|
||||||
|
''' </summary>
|
||||||
|
Public Sub New()
|
||||||
|
Language = Thread.CurrentThread.CurrentCulture.Name
|
||||||
|
UserName = Environment.UserName
|
||||||
|
MachineName = Environment.MachineName
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
@ -50,8 +50,17 @@
|
|||||||
<Reference Include="DevExpress.XtraBars.v18.1" />
|
<Reference Include="DevExpress.XtraBars.v18.1" />
|
||||||
<Reference Include="DevExpress.Sparkline.v18.1.Core" />
|
<Reference Include="DevExpress.Sparkline.v18.1.Core" />
|
||||||
<Reference Include="DevExpress.XtraEditors.v18.1" />
|
<Reference Include="DevExpress.XtraEditors.v18.1" />
|
||||||
|
<Reference Include="DevExpress.XtraLayout.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.5.11\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@ -73,9 +82,23 @@
|
|||||||
<Import Include="System" />
|
<Import Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ApplicationEvents.vb" />
|
||||||
|
<Compile Include="Base\BaseClass.vb" />
|
||||||
<Compile Include="ClassClipboardWatcher.vb" />
|
<Compile Include="ClassClipboardWatcher.vb" />
|
||||||
|
<Compile Include="ClassInit.vb" />
|
||||||
|
<Compile Include="Config\ClassConfig.vb" />
|
||||||
|
<Compile Include="ClassConstants.vb" />
|
||||||
<Compile Include="ClassEnvironment.vb" />
|
<Compile Include="ClassEnvironment.vb" />
|
||||||
|
<Compile Include="ClassErrorHandler.vb" />
|
||||||
<Compile Include="ClassFlowForm.vb" />
|
<Compile Include="ClassFlowForm.vb" />
|
||||||
|
<Compile Include="ClassInitLoader.vb" />
|
||||||
|
<Compile Include="Config\ClassUIConfig.vb" />
|
||||||
|
<Compile Include="frmConfigDatabase.Designer.vb">
|
||||||
|
<DependentUpon>frmConfigDatabase.vb</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="frmConfigDatabase.vb">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="frmMain.vb">
|
<Compile Include="frmMain.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -99,6 +122,12 @@
|
|||||||
<DependentUpon>Application.myapp</DependentUpon>
|
<DependentUpon>Application.myapp</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||||
|
<Compile Include="MyApplication.vb" />
|
||||||
|
<Compile Include="State\ClassServiceState.vb" />
|
||||||
|
<Compile Include="State\ClassUserState.vb" />
|
||||||
|
<EmbeddedResource Include="frmConfigDatabase.resx">
|
||||||
|
<DependentUpon>frmConfigDatabase.vb</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="frmMain.resx">
|
<EmbeddedResource Include="frmMain.resx">
|
||||||
<DependentUpon>frmMain.vb</DependentUpon>
|
<DependentUpon>frmMain.vb</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@ -137,11 +166,30 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Resources\CW_hatwas_klein.png" />
|
<None Include="Resources\CW_hatwas_klein.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\CW_wartet_klein.png" />
|
<None Include="Resources\CW_wartet_klein.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filesystem\Filesystem.vbproj">
|
||||||
|
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
|
||||||
|
<Name>Filesystem</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Modules.Config\Config.vbproj">
|
||||||
|
<Project>{44982F9B-6116-44E2-85D0-F39650B1EF99}</Project>
|
||||||
|
<Name>Config</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Modules.Database\Database.vbproj">
|
||||||
|
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
|
||||||
|
<Name>Database</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||||
|
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
|
||||||
|
<Name>Logging</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
265
ZooFlow/frmConfigDatabase.Designer.vb
generated
Normal file
265
ZooFlow/frmConfigDatabase.Designer.vb
generated
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||||
|
Partial Class frmConfigDatabase
|
||||||
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
|
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||||
|
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||||
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
|
Try
|
||||||
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
|
components.Dispose()
|
||||||
|
End If
|
||||||
|
Finally
|
||||||
|
MyBase.Dispose(disposing)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
'Wird vom Windows Form-Designer benötigt.
|
||||||
|
Private components As System.ComponentModel.IContainer
|
||||||
|
|
||||||
|
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
||||||
|
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
||||||
|
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||||
|
<System.Diagnostics.DebuggerStepThrough()> _
|
||||||
|
Private Sub InitializeComponent()
|
||||||
|
Me.components = New System.ComponentModel.Container()
|
||||||
|
Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl()
|
||||||
|
Me.txtServerName = New DevExpress.XtraEditors.TextEdit()
|
||||||
|
Me.txtUserName = New DevExpress.XtraEditors.TextEdit()
|
||||||
|
Me.txtPassword = New DevExpress.XtraEditors.TextEdit()
|
||||||
|
Me.cmbDatabase = New DevExpress.XtraEditors.ComboBoxEdit()
|
||||||
|
Me.btnTestConnection = New DevExpress.XtraEditors.SimpleButton()
|
||||||
|
Me.txtConnectionString = New DevExpress.XtraEditors.TextEdit()
|
||||||
|
Me.chkWinAuth = New DevExpress.XtraEditors.CheckEdit()
|
||||||
|
Me.LayoutControlGroup1 = New DevExpress.XtraLayout.LayoutControlGroup()
|
||||||
|
Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.EmptySpaceItem1 = New DevExpress.XtraLayout.EmptySpaceItem()
|
||||||
|
Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.LayoutControlItem6 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem()
|
||||||
|
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.LayoutControl1.SuspendLayout()
|
||||||
|
CType(Me.txtServerName.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.txtUserName.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.txtPassword.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.cmbDatabase.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.txtConnectionString.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.chkWinAuth.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
|
Me.SuspendLayout()
|
||||||
|
'
|
||||||
|
'LayoutControl1
|
||||||
|
'
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.txtServerName)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.txtUserName)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.txtPassword)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.cmbDatabase)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.btnTestConnection)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.txtConnectionString)
|
||||||
|
Me.LayoutControl1.Controls.Add(Me.chkWinAuth)
|
||||||
|
Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.LayoutControl1.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.LayoutControl1.Name = "LayoutControl1"
|
||||||
|
Me.LayoutControl1.Root = Me.LayoutControlGroup1
|
||||||
|
Me.LayoutControl1.Size = New System.Drawing.Size(560, 186)
|
||||||
|
Me.LayoutControl1.TabIndex = 0
|
||||||
|
Me.LayoutControl1.Text = "LayoutControl1"
|
||||||
|
'
|
||||||
|
'txtServerName
|
||||||
|
'
|
||||||
|
Me.txtServerName.Location = New System.Drawing.Point(145, 12)
|
||||||
|
Me.txtServerName.Name = "txtServerName"
|
||||||
|
Me.txtServerName.Size = New System.Drawing.Size(403, 20)
|
||||||
|
Me.txtServerName.StyleController = Me.LayoutControl1
|
||||||
|
Me.txtServerName.TabIndex = 4
|
||||||
|
'
|
||||||
|
'txtUserName
|
||||||
|
'
|
||||||
|
Me.txtUserName.Location = New System.Drawing.Point(145, 36)
|
||||||
|
Me.txtUserName.Name = "txtUserName"
|
||||||
|
Me.txtUserName.Size = New System.Drawing.Size(133, 20)
|
||||||
|
Me.txtUserName.StyleController = Me.LayoutControl1
|
||||||
|
Me.txtUserName.TabIndex = 5
|
||||||
|
'
|
||||||
|
'txtPassword
|
||||||
|
'
|
||||||
|
Me.txtPassword.Location = New System.Drawing.Point(415, 36)
|
||||||
|
Me.txtPassword.Name = "txtPassword"
|
||||||
|
Me.txtPassword.Size = New System.Drawing.Size(133, 20)
|
||||||
|
Me.txtPassword.StyleController = Me.LayoutControl1
|
||||||
|
Me.txtPassword.TabIndex = 6
|
||||||
|
'
|
||||||
|
'cmbDatabase
|
||||||
|
'
|
||||||
|
Me.cmbDatabase.Location = New System.Drawing.Point(145, 60)
|
||||||
|
Me.cmbDatabase.Name = "cmbDatabase"
|
||||||
|
Me.cmbDatabase.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
|
||||||
|
Me.cmbDatabase.Size = New System.Drawing.Size(403, 20)
|
||||||
|
Me.cmbDatabase.StyleController = Me.LayoutControl1
|
||||||
|
Me.cmbDatabase.TabIndex = 7
|
||||||
|
'
|
||||||
|
'btnTestConnection
|
||||||
|
'
|
||||||
|
Me.btnTestConnection.Location = New System.Drawing.Point(12, 107)
|
||||||
|
Me.btnTestConnection.Name = "btnTestConnection"
|
||||||
|
Me.btnTestConnection.Size = New System.Drawing.Size(536, 22)
|
||||||
|
Me.btnTestConnection.StyleController = Me.LayoutControl1
|
||||||
|
Me.btnTestConnection.TabIndex = 8
|
||||||
|
Me.btnTestConnection.Text = "Verbindung zur Datenbank herstellen"
|
||||||
|
'
|
||||||
|
'txtConnectionString
|
||||||
|
'
|
||||||
|
Me.txtConnectionString.Location = New System.Drawing.Point(145, 133)
|
||||||
|
Me.txtConnectionString.Name = "txtConnectionString"
|
||||||
|
Me.txtConnectionString.Properties.ReadOnly = True
|
||||||
|
Me.txtConnectionString.Size = New System.Drawing.Size(403, 20)
|
||||||
|
Me.txtConnectionString.StyleController = Me.LayoutControl1
|
||||||
|
Me.txtConnectionString.TabIndex = 9
|
||||||
|
'
|
||||||
|
'chkWinAuth
|
||||||
|
'
|
||||||
|
Me.chkWinAuth.Location = New System.Drawing.Point(12, 84)
|
||||||
|
Me.chkWinAuth.Name = "chkWinAuth"
|
||||||
|
Me.chkWinAuth.Properties.Caption = "Windows Authentifizierung"
|
||||||
|
Me.chkWinAuth.Size = New System.Drawing.Size(536, 19)
|
||||||
|
Me.chkWinAuth.StyleController = Me.LayoutControl1
|
||||||
|
Me.chkWinAuth.TabIndex = 10
|
||||||
|
'
|
||||||
|
'LayoutControlGroup1
|
||||||
|
'
|
||||||
|
Me.LayoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
|
||||||
|
Me.LayoutControlGroup1.GroupBordersVisible = False
|
||||||
|
Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.LayoutControlItem2, Me.EmptySpaceItem1, Me.LayoutControlItem4, Me.LayoutControlItem3, Me.LayoutControlItem7, Me.LayoutControlItem6, Me.LayoutControlItem5})
|
||||||
|
Me.LayoutControlGroup1.Name = "LayoutControlGroup1"
|
||||||
|
Me.LayoutControlGroup1.Size = New System.Drawing.Size(560, 186)
|
||||||
|
Me.LayoutControlGroup1.TextVisible = False
|
||||||
|
'
|
||||||
|
'LayoutControlItem1
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem1.Control = Me.txtServerName
|
||||||
|
Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 0)
|
||||||
|
Me.LayoutControlItem1.Name = "LayoutControlItem1"
|
||||||
|
Me.LayoutControlItem1.Size = New System.Drawing.Size(540, 24)
|
||||||
|
Me.LayoutControlItem1.Text = "Server Name:"
|
||||||
|
Me.LayoutControlItem1.TextSize = New System.Drawing.Size(130, 13)
|
||||||
|
'
|
||||||
|
'LayoutControlItem2
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem2.Control = Me.txtUserName
|
||||||
|
Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 24)
|
||||||
|
Me.LayoutControlItem2.Name = "LayoutControlItem2"
|
||||||
|
Me.LayoutControlItem2.Size = New System.Drawing.Size(270, 24)
|
||||||
|
Me.LayoutControlItem2.Text = "Benutzername:"
|
||||||
|
Me.LayoutControlItem2.TextSize = New System.Drawing.Size(130, 13)
|
||||||
|
'
|
||||||
|
'EmptySpaceItem1
|
||||||
|
'
|
||||||
|
Me.EmptySpaceItem1.AllowHotTrack = False
|
||||||
|
Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 145)
|
||||||
|
Me.EmptySpaceItem1.Name = "EmptySpaceItem1"
|
||||||
|
Me.EmptySpaceItem1.Size = New System.Drawing.Size(540, 21)
|
||||||
|
Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0)
|
||||||
|
'
|
||||||
|
'LayoutControlItem4
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem4.Control = Me.cmbDatabase
|
||||||
|
Me.LayoutControlItem4.Location = New System.Drawing.Point(0, 48)
|
||||||
|
Me.LayoutControlItem4.Name = "LayoutControlItem4"
|
||||||
|
Me.LayoutControlItem4.Size = New System.Drawing.Size(540, 24)
|
||||||
|
Me.LayoutControlItem4.Text = "Datenbank:"
|
||||||
|
Me.LayoutControlItem4.TextSize = New System.Drawing.Size(130, 13)
|
||||||
|
'
|
||||||
|
'LayoutControlItem3
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem3.Control = Me.txtPassword
|
||||||
|
Me.LayoutControlItem3.Location = New System.Drawing.Point(270, 24)
|
||||||
|
Me.LayoutControlItem3.Name = "LayoutControlItem3"
|
||||||
|
Me.LayoutControlItem3.Size = New System.Drawing.Size(270, 24)
|
||||||
|
Me.LayoutControlItem3.Text = "Passwort:"
|
||||||
|
Me.LayoutControlItem3.TextSize = New System.Drawing.Size(130, 13)
|
||||||
|
'
|
||||||
|
'LayoutControlItem7
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem7.Control = Me.chkWinAuth
|
||||||
|
Me.LayoutControlItem7.Location = New System.Drawing.Point(0, 72)
|
||||||
|
Me.LayoutControlItem7.Name = "LayoutControlItem7"
|
||||||
|
Me.LayoutControlItem7.Size = New System.Drawing.Size(540, 23)
|
||||||
|
Me.LayoutControlItem7.TextSize = New System.Drawing.Size(0, 0)
|
||||||
|
Me.LayoutControlItem7.TextVisible = False
|
||||||
|
'
|
||||||
|
'LayoutControlItem6
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem6.Control = Me.txtConnectionString
|
||||||
|
Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 121)
|
||||||
|
Me.LayoutControlItem6.Name = "LayoutControlItem6"
|
||||||
|
Me.LayoutControlItem6.Size = New System.Drawing.Size(540, 24)
|
||||||
|
Me.LayoutControlItem6.Text = "Aktueller Connectionstring:"
|
||||||
|
Me.LayoutControlItem6.TextSize = New System.Drawing.Size(130, 13)
|
||||||
|
'
|
||||||
|
'LayoutControlItem5
|
||||||
|
'
|
||||||
|
Me.LayoutControlItem5.Control = Me.btnTestConnection
|
||||||
|
Me.LayoutControlItem5.Location = New System.Drawing.Point(0, 95)
|
||||||
|
Me.LayoutControlItem5.Name = "LayoutControlItem5"
|
||||||
|
Me.LayoutControlItem5.Size = New System.Drawing.Size(540, 26)
|
||||||
|
Me.LayoutControlItem5.TextSize = New System.Drawing.Size(0, 0)
|
||||||
|
Me.LayoutControlItem5.TextVisible = False
|
||||||
|
'
|
||||||
|
'frmConfigDatabase
|
||||||
|
'
|
||||||
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
|
Me.ClientSize = New System.Drawing.Size(560, 186)
|
||||||
|
Me.Controls.Add(Me.LayoutControl1)
|
||||||
|
Me.Name = "frmConfigDatabase"
|
||||||
|
Me.Text = "Datenbank Verbindung"
|
||||||
|
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.LayoutControl1.ResumeLayout(False)
|
||||||
|
CType(Me.txtServerName.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.txtUserName.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.txtPassword.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.cmbDatabase.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.txtConnectionString.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.chkWinAuth.Properties, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
|
Me.ResumeLayout(False)
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl
|
||||||
|
Friend WithEvents LayoutControlGroup1 As DevExpress.XtraLayout.LayoutControlGroup
|
||||||
|
Friend WithEvents txtServerName As DevExpress.XtraEditors.TextEdit
|
||||||
|
Friend WithEvents txtUserName As DevExpress.XtraEditors.TextEdit
|
||||||
|
Friend WithEvents txtPassword As DevExpress.XtraEditors.TextEdit
|
||||||
|
Friend WithEvents cmbDatabase As DevExpress.XtraEditors.ComboBoxEdit
|
||||||
|
Friend WithEvents btnTestConnection As DevExpress.XtraEditors.SimpleButton
|
||||||
|
Friend WithEvents txtConnectionString As DevExpress.XtraEditors.TextEdit
|
||||||
|
Friend WithEvents chkWinAuth As DevExpress.XtraEditors.CheckEdit
|
||||||
|
Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents EmptySpaceItem1 As DevExpress.XtraLayout.EmptySpaceItem
|
||||||
|
Friend WithEvents LayoutControlItem4 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents LayoutControlItem3 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents LayoutControlItem7 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents LayoutControlItem6 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
Friend WithEvents LayoutControlItem5 As DevExpress.XtraLayout.LayoutControlItem
|
||||||
|
End Class
|
||||||
120
ZooFlow/frmConfigDatabase.resx
Normal file
120
ZooFlow/frmConfigDatabase.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
117
ZooFlow/frmConfigDatabase.vb
Normal file
117
ZooFlow/frmConfigDatabase.vb
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports DigitalData.Modules.Filesystem
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Public Class frmConfigDatabase
|
||||||
|
Private Const STRING_CONNECTION_SUCCESSFUL = "Die Verbindung wurde erfolgreich aufgebaut!" & vbNewLine & "Möchten Sie diese Verbindung nun in der Anwendung speichern?"
|
||||||
|
|
||||||
|
Private Logger As Logger = My.LogConfig.GetLogger()
|
||||||
|
|
||||||
|
Private Sub frmConfigDatabase_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
Dim oConnectionString = My.SystemConfig.ConnectionString
|
||||||
|
|
||||||
|
If Not oConnectionString = String.Empty Then
|
||||||
|
Dim oBuilder = My.SystemConfig.GetConnectionStringBuilder(oConnectionString)
|
||||||
|
|
||||||
|
If oBuilder Is Nothing Then
|
||||||
|
MsgBox("Connection String ist ungültig!", MsgBoxStyle.Critical)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If oConnectionString.Contains("Trusted") Then
|
||||||
|
chkWinAuth.Checked = True
|
||||||
|
txtConnectionString.Text = oConnectionString
|
||||||
|
Else
|
||||||
|
chkWinAuth.Checked = False
|
||||||
|
txtConnectionString.Text = oConnectionString.Replace(oBuilder.Password, "XXXXXX")
|
||||||
|
txtUserName.Text = oBuilder.UserID
|
||||||
|
End If
|
||||||
|
|
||||||
|
txtServerName.Text = oBuilder.DataSource
|
||||||
|
cmbDatabase.Text = oBuilder.InitialCatalog
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub chkWinAuth_CheckedChanged(sender As Object, e As EventArgs) Handles chkWinAuth.CheckedChanged
|
||||||
|
txtPassword.Enabled = Not chkWinAuth.Checked
|
||||||
|
txtUserName.Enabled = Not chkWinAuth.Checked
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub cmbDatabase_Click(sender As Object, e As EventArgs) Handles cmbDatabase.Click
|
||||||
|
Cursor = Cursors.WaitCursor
|
||||||
|
|
||||||
|
Dim oConnectionString As String = GetConnectionString(False)
|
||||||
|
Dim oDatabase As New MSSQLServer(My.LogConfig, oConnectionString)
|
||||||
|
|
||||||
|
If oDatabase.DBInitialized = False Then
|
||||||
|
MsgBox("Verbindung fehlgeschlagen!", MsgBoxStyle.Critical)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
|
Using oConnection = New SqlClient.SqlConnection(oConnectionString)
|
||||||
|
oConnection.Open()
|
||||||
|
Using cmd As New SqlClient.SqlCommand("sp_databases", oConnection)
|
||||||
|
Using dr As SqlClient.SqlDataReader = cmd.ExecuteReader
|
||||||
|
If dr.HasRows Then
|
||||||
|
cmbDatabase.Properties.Items.Clear()
|
||||||
|
|
||||||
|
Do While dr.Read
|
||||||
|
cmbDatabase.Properties.Items.Add(dr("Database_Name"))
|
||||||
|
Loop
|
||||||
|
cmbDatabase.ShowPopup()
|
||||||
|
Else
|
||||||
|
MsgBox("The standard-databases could not be retrieved. The default database will be set!" & vbNewLine & "Check rights in sql-server for user: " & Me.txtUserName.Text, MsgBoxStyle.Exclamation)
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Cursor = Cursors.Default
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetConnectionString(WithDatabase As Boolean) As String
|
||||||
|
Dim oConnectionString As String
|
||||||
|
|
||||||
|
If chkWinAuth.Checked Then
|
||||||
|
oConnectionString = $"Data Source={txtServerName.Text};Trusted_Connection=True;"
|
||||||
|
Else
|
||||||
|
oConnectionString = $"Server={txtServerName.Text};User Id={txtUserName.Text};Password={txtPassword.Text};"
|
||||||
|
End If
|
||||||
|
|
||||||
|
If WithDatabase Then
|
||||||
|
oConnectionString &= $"Database={cmbDatabase.Text};"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return oConnectionString
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub btnTestConnection_Click(sender As Object, e As EventArgs) Handles btnTestConnection.Click
|
||||||
|
Try
|
||||||
|
Dim oConnectionString = GetConnectionString(True)
|
||||||
|
|
||||||
|
Using oConnection As New SqlClient.SqlConnection(oConnectionString)
|
||||||
|
oConnection.Open()
|
||||||
|
oConnection.Close()
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Dim oResult = MessageBox.Show(STRING_CONNECTION_SUCCESSFUL, Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||||
|
|
||||||
|
If oResult = DialogResult.Yes Then
|
||||||
|
Dim oCrypt As New EncryptionLegacy("!35452didalog=")
|
||||||
|
Dim oEncryptedPassword = oCrypt.EncryptData(txtPassword.Text)
|
||||||
|
Dim oEncryptedConnectionString = $"Server={txtServerName.Text};Database={cmbDatabase.Text};User Id={txtUserName.Text};Password={oEncryptedPassword};"
|
||||||
|
|
||||||
|
My.SystemConfig.ConnectionString = oEncryptedConnectionString
|
||||||
|
My.SystemConfigManager.Save()
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
MsgBox("Error while connecting to Database")
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
@ -1,22 +1,26 @@
|
|||||||
|
Imports System.ComponentModel
|
||||||
Imports DevExpress.XtraSplashScreen
|
Imports DevExpress.XtraSplashScreen
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports DigitalData.Modules.Filesystem
|
||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
|
||||||
Partial Public Class frmMain
|
Partial Public Class frmMain
|
||||||
Private WithEvents FlowForm As New frmFlowForm()
|
Private WithEvents FlowForm As New frmFlowForm()
|
||||||
|
Private Logger As Logger = My.LogConfig.GetLogger
|
||||||
|
|
||||||
Public Sub New()
|
Public Sub New()
|
||||||
InitializeComponent()
|
InitializeComponent()
|
||||||
InitializeApplication()
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
FlowForm.Show()
|
Dim oInit As New ClassInit(Me)
|
||||||
|
oInit.InitializeApplication()
|
||||||
ToastNotificationsManager.ShowNotification(ToastNotificationsManager.Notifications.First)
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||||
Hide()
|
Hide()
|
||||||
|
FlowForm.Show()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
Private Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged
|
||||||
@ -49,16 +53,17 @@ Partial Public Class frmMain
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub InitializeApplication()
|
|
||||||
SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False, False)
|
|
||||||
|
|
||||||
' The splash screen will be opened in a separate thread. To interact with it, use the SendCommand method.
|
|
||||||
For i As Integer = 1 To 100
|
|
||||||
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetProgress, i)
|
|
||||||
'To process commands, override the SplashScreen.ProcessCommand method.
|
|
||||||
Threading.Thread.Sleep(25)
|
|
||||||
Next i
|
|
||||||
|
|
||||||
|
Private Sub ProgressChanged(sender As Object, Progress As ClassInitLoader.InitProgress)
|
||||||
|
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetProgress, Progress.CurrentPercent)
|
||||||
|
SplashScreenManager.Default.SendCommand(frmSplash.SplashScreenCommand.SetActionName, Progress.CurrentStep.Name)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub InitCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
|
||||||
SplashScreenManager.CloseForm(False)
|
SplashScreenManager.CloseForm(False)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
20
ZooFlow/frmSplash.Designer.vb
generated
20
ZooFlow/frmSplash.Designer.vb
generated
@ -26,7 +26,7 @@ Partial Class frmSplash
|
|||||||
Me.pictureEdit2 = New DevExpress.XtraEditors.PictureEdit()
|
Me.pictureEdit2 = New DevExpress.XtraEditors.PictureEdit()
|
||||||
Me.pictureEdit1 = New DevExpress.XtraEditors.PictureEdit()
|
Me.pictureEdit1 = New DevExpress.XtraEditors.PictureEdit()
|
||||||
Me.labelControl2 = New DevExpress.XtraEditors.LabelControl()
|
Me.labelControl2 = New DevExpress.XtraEditors.LabelControl()
|
||||||
Me.LabelControl3 = New DevExpress.XtraEditors.LabelControl()
|
Me.txtActionName = New DevExpress.XtraEditors.LabelControl()
|
||||||
Me.Version = New DevExpress.XtraEditors.LabelControl()
|
Me.Version = New DevExpress.XtraEditors.LabelControl()
|
||||||
Me.ProgressBarControl1 = New DevExpress.XtraEditors.ProgressBarControl()
|
Me.ProgressBarControl1 = New DevExpress.XtraEditors.ProgressBarControl()
|
||||||
CType(Me.pictureEdit2.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.pictureEdit2.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
@ -75,14 +75,14 @@ Partial Class frmSplash
|
|||||||
Me.labelControl2.TabIndex = 12
|
Me.labelControl2.TabIndex = 12
|
||||||
Me.labelControl2.Text = "Starting..."
|
Me.labelControl2.Text = "Starting..."
|
||||||
'
|
'
|
||||||
'LabelControl3
|
'txtActionName
|
||||||
'
|
'
|
||||||
Me.LabelControl3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
|
Me.txtActionName.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
|
||||||
Me.LabelControl3.Location = New System.Drawing.Point(12, 321)
|
Me.txtActionName.Location = New System.Drawing.Point(12, 321)
|
||||||
Me.LabelControl3.Name = "LabelControl3"
|
Me.txtActionName.Name = "txtActionName"
|
||||||
Me.LabelControl3.Size = New System.Drawing.Size(75, 13)
|
Me.txtActionName.Size = New System.Drawing.Size(45, 13)
|
||||||
Me.LabelControl3.TabIndex = 12
|
Me.txtActionName.TabIndex = 12
|
||||||
Me.LabelControl3.Text = "Loading stuff..."
|
Me.txtActionName.Text = "Loading.."
|
||||||
'
|
'
|
||||||
'Version
|
'Version
|
||||||
'
|
'
|
||||||
@ -109,7 +109,7 @@ Partial Class frmSplash
|
|||||||
Me.Controls.Add(Me.pictureEdit2)
|
Me.Controls.Add(Me.pictureEdit2)
|
||||||
Me.Controls.Add(Me.pictureEdit1)
|
Me.Controls.Add(Me.pictureEdit1)
|
||||||
Me.Controls.Add(Me.Version)
|
Me.Controls.Add(Me.Version)
|
||||||
Me.Controls.Add(Me.LabelControl3)
|
Me.Controls.Add(Me.txtActionName)
|
||||||
Me.Controls.Add(Me.labelControl2)
|
Me.Controls.Add(Me.labelControl2)
|
||||||
Me.Name = "frmSplash"
|
Me.Name = "frmSplash"
|
||||||
Me.Text = "Form1"
|
Me.Text = "Form1"
|
||||||
@ -123,7 +123,7 @@ Partial Class frmSplash
|
|||||||
Private WithEvents pictureEdit2 As DevExpress.XtraEditors.PictureEdit
|
Private WithEvents pictureEdit2 As DevExpress.XtraEditors.PictureEdit
|
||||||
Private WithEvents pictureEdit1 As DevExpress.XtraEditors.PictureEdit
|
Private WithEvents pictureEdit1 As DevExpress.XtraEditors.PictureEdit
|
||||||
Private WithEvents labelControl2 As DevExpress.XtraEditors.LabelControl
|
Private WithEvents labelControl2 As DevExpress.XtraEditors.LabelControl
|
||||||
Private WithEvents LabelControl3 As DevExpress.XtraEditors.LabelControl
|
Private WithEvents txtActionName As DevExpress.XtraEditors.LabelControl
|
||||||
Private WithEvents Version As DevExpress.XtraEditors.LabelControl
|
Private WithEvents Version As DevExpress.XtraEditors.LabelControl
|
||||||
Friend WithEvents ProgressBarControl1 As DevExpress.XtraEditors.ProgressBarControl
|
Friend WithEvents ProgressBarControl1 As DevExpress.XtraEditors.ProgressBarControl
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -11,6 +11,8 @@
|
|||||||
Case SplashScreenCommand.SetProgress
|
Case SplashScreenCommand.SetProgress
|
||||||
Dim oPosition As Integer = CInt(Fix(arg))
|
Dim oPosition As Integer = CInt(Fix(arg))
|
||||||
ProgressBarControl1.Position = oPosition
|
ProgressBarControl1.Position = oPosition
|
||||||
|
Case SplashScreenCommand.SetActionName
|
||||||
|
txtActionName.Text = arg.ToString
|
||||||
End Select
|
End Select
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -20,5 +22,6 @@
|
|||||||
|
|
||||||
Public Enum SplashScreenCommand
|
Public Enum SplashScreenCommand
|
||||||
SetProgress
|
SetProgress
|
||||||
|
SetActionName
|
||||||
End Enum
|
End Enum
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
4
ZooFlow/packages.config
Normal file
4
ZooFlow/packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NLog" version="4.5.11" targetFramework="net461" />
|
||||||
|
</packages>
|
||||||
Loading…
x
Reference in New Issue
Block a user