You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
3.5 KiB
113 lines
3.5 KiB
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Public Class frmDBConnection
|
|
Dim ConnectionColleaction As New Collection
|
|
Dim m_connectionstring As String
|
|
Property Connectionstring As String
|
|
Get
|
|
Return m_connectionstring
|
|
End Get
|
|
Set(value As String)
|
|
m_connectionstring = value
|
|
End Set
|
|
End Property
|
|
Private Sub frmDBConnection_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Try
|
|
Program.splashForm.Visible = False
|
|
Catch
|
|
End Try
|
|
|
|
Dim sr As StreamReader = New StreamReader(Application.StartupPath + "\Connectionstrings.cfg")
|
|
Dim s As String
|
|
Do While sr.Peek() >= 0
|
|
s = sr.ReadLine()
|
|
s = Crypto.DecryptText(s, "StefanHutterUnternehmensberatung8808Pfaeffikon")
|
|
Dim splitter() As String
|
|
splitter = s.Split(":")
|
|
ConnectionColleaction.Add(New ConnectionParams(splitter(0), splitter(1)))
|
|
Loop
|
|
sr.Close()
|
|
For i As Integer = 1 To ConnectionColleaction.Count
|
|
Dim x As ConnectionParams = ConnectionColleaction(i)
|
|
Me.ComboBox1.Items.Add(x.name)
|
|
Next
|
|
Me.ComboBox1.SelectedIndex = 0
|
|
Me.ComboBox1.Select()
|
|
If ConnectionColleaction.Count = 1 Then
|
|
For i As Integer = 1 To ConnectionColleaction.Count
|
|
Dim x As ConnectionParams = ConnectionColleaction(i)
|
|
If x.name = ComboBox1.Text Then
|
|
Me.Connectionstring = x.Connectionstring
|
|
Globals.Auswertungsverzeicnis = "\" + x.name
|
|
Globals.Databasename = x.name
|
|
End If
|
|
|
|
Next
|
|
Me.DialogResult = DialogResult.OK
|
|
Me.Close()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
For i As Integer = 1 To ConnectionColleaction.Count
|
|
Dim x As ConnectionParams = ConnectionColleaction(i)
|
|
If x.name = ComboBox1.Text Then
|
|
Me.Connectionstring = x.Connectionstring
|
|
Globals.Auswertungsverzeicnis = "\" + x.name
|
|
Globals.Databasename = x.name
|
|
End If
|
|
|
|
Next
|
|
Me.Close()
|
|
|
|
End Sub
|
|
|
|
Private Sub frmDBConnection_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
Try
|
|
Program.splashForm.Visible = True
|
|
Catch
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles ComboBox1.KeyDown
|
|
If e.KeyCode = Keys.Enter Then
|
|
Me.Button1_Click(sender, e)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
Me.Close()
|
|
End Sub
|
|
End Class
|
|
|
|
Public Class ConnectionParams
|
|
Dim m_name As String
|
|
Property name As String
|
|
Get
|
|
Return m_name
|
|
End Get
|
|
Set(value As String)
|
|
m_name = value
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_connectionstring As String
|
|
Property Connectionstring As String
|
|
Get
|
|
Return m_connectionstring
|
|
End Get
|
|
Set(value As String)
|
|
m_connectionstring = value
|
|
End Set
|
|
End Property
|
|
|
|
Sub New(name As String, Connectionstring As String)
|
|
Me.name = name
|
|
Me.Connectionstring = Connectionstring
|
|
End Sub
|
|
End Class |