WIP
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
Imports System.Threading
|
||||
Imports System.Globalization
|
||||
Imports DD_LIB_Standards
|
||||
Imports DD_LIB_Standards
|
||||
Imports DD_Clipboard_Watcher.ClassHotkey.ModfierKey
|
||||
|
||||
Public Class frmConfig_Basic
|
||||
Dim WithEvents Hotkey As New clsHotkey(Me)
|
||||
Dim formloaded As Boolean = False
|
||||
Dim WithEvents Hotkey As New ClassHotkey(Me)
|
||||
|
||||
Private Sub BtnConnect_Click(sender As Object, e As EventArgs) Handles BtnConnect.Click
|
||||
Try
|
||||
Dim con As String
|
||||
@@ -48,7 +48,7 @@ Public Class frmConfig_Basic
|
||||
If chkbxUserAut.Checked = False Then
|
||||
constr = constr.Replace(csb.Password, "XXXXX")
|
||||
End If
|
||||
Me.txtActualConnection.Text = constr
|
||||
txtActualConnection.Text = constr
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Cursor = Cursors.Default
|
||||
@@ -61,25 +61,24 @@ Public Class frmConfig_Basic
|
||||
End Sub
|
||||
Sub Load_Databases()
|
||||
Try
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Dim csb As New SqlClient.SqlConnectionStringBuilder
|
||||
csb.DataSource = Me.txtServer.Text
|
||||
csb.IntegratedSecurity = False
|
||||
csb.UserID = Me.txtUser.Text
|
||||
csb.Password = Me.txtPasswort.Text
|
||||
Cursor = Cursors.WaitCursor
|
||||
Dim csb As New SqlClient.SqlConnectionStringBuilder With {
|
||||
.DataSource = txtServer.Text,
|
||||
.IntegratedSecurity = False,
|
||||
.UserID = txtUser.Text,
|
||||
.Password = txtPasswort.Text
|
||||
}
|
||||
|
||||
Dim con As String
|
||||
If chkbxUserAut.Checked Then
|
||||
con = "Data Source=" & Me.txtServer.Text & ";Trusted_Connection=True;"
|
||||
con = $"Data Source={txtServer.Text};Trusted_Connection=True;"
|
||||
Else
|
||||
'con = "Server=" & Me.txtServer.Text & ";Database=" & Me.cmbDatenbank.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
|
||||
con = "Server=" & Me.txtServer.Text & ";User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPasswort.Text & ";"
|
||||
con = $"Server={txtServer.Text};User Id={txtUser.Text};Password={txtPasswort.Text};"
|
||||
End If
|
||||
Dim connection As New SqlClient.SqlConnection(con) 'csb.ConnectionString)
|
||||
Dim connection As New SqlClient.SqlConnection(con)
|
||||
connection.Open()
|
||||
Dim cmd As New SqlClient.SqlCommand("sp_databases", connection)
|
||||
cmd.CommandType = CommandType.StoredProcedure
|
||||
' Ausführen und Ergebnis in einer ListBox anzeigen
|
||||
Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader
|
||||
If dr.HasRows Then
|
||||
cmbDatenbank.Items.Clear()
|
||||
@@ -100,10 +99,6 @@ Public Class frmConfig_Basic
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub frmConfig_Basic_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmConfig_Basic_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
lblChanges.Visible = False
|
||||
If Not MyConnectionString = String.Empty Then
|
||||
@@ -128,21 +123,16 @@ Public Class frmConfig_Basic
|
||||
|
||||
End Try
|
||||
|
||||
Me.txtActualConnection.Text = constr
|
||||
txtActualConnection.Text = constr
|
||||
chkLogErrorsOnly.Checked = LogErrorsOnly
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in FormLoad: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
|
||||
' Specify that the link was visited.
|
||||
LinkLabel1.LinkVisited = True
|
||||
' Navigate to a URL.
|
||||
Process.Start("http://www.didalog.de/Support")
|
||||
End Sub
|
||||
|
||||
@@ -158,16 +148,10 @@ Public Class frmConfig_Basic
|
||||
LogErrorsOnly = chkLogErrorsOnly.Checked
|
||||
LogConfig.Debug = Not LogErrorsOnly
|
||||
|
||||
'SaveConfigValue("LogErrorsOnly", LogErrorsOnly)
|
||||
ConfigManager.Config.LogErrorsOnly = LogErrorsOnly
|
||||
ConfigManager.Save()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub frmConfig_Basic_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
formloaded = True
|
||||
End Sub
|
||||
|
||||
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
|
||||
Select Case TabControl1.SelectedIndex
|
||||
Case 1
|
||||
@@ -182,36 +166,19 @@ Public Class frmConfig_Basic
|
||||
|
||||
Private Sub chkbxUserAut_CheckedChanged(sender As Object, e As EventArgs) Handles chkbxUserAut.CheckedChanged
|
||||
If chkbxUserAut.Checked Then
|
||||
Me.txtPasswort.Enabled = False
|
||||
Me.txtUser.Enabled = False
|
||||
txtPasswort.Enabled = False
|
||||
txtUser.Enabled = False
|
||||
Else
|
||||
Me.txtPasswort.Enabled = True
|
||||
Me.txtUser.Enabled = True
|
||||
txtPasswort.Enabled = True
|
||||
txtUser.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub txtActualConnection_TextChanged(sender As Object, e As EventArgs) Handles txtActualConnection.TextChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cmbDatenbank_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbDatenbank.SelectedIndexChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub txtPasswort_Leave(sender As Object, e As EventArgs) Handles txtPasswort.Leave
|
||||
|
||||
End Sub
|
||||
Private Sub txtPasswort_TextChanged(sender As Object, e As EventArgs) Handles txtPasswort.TextChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnChangeHotkey_Click(sender As Object, e As EventArgs) Handles btnChangeHotkey.Click
|
||||
Try
|
||||
If cmbfunctionHit.SelectedIndex <> -1 Then
|
||||
Hotkey.RemoveHotKey(ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
|
||||
'SaveConfigValue("HotkeyFunctionKey", cmbfunctionHit.Text)
|
||||
'SaveConfigValue("HotkeySearchKey", txtHotkeySearchKey.Text)
|
||||
ConfigManager.Config.HotkeyFunctionKey = cmbfunctionHit.Text
|
||||
ConfigManager.Config.HotkeySearchKey = txtHotkeySearchKey.Text
|
||||
ConfigManager.Save()
|
||||
@@ -221,13 +188,12 @@ Public Class frmConfig_Basic
|
||||
Dim obj As Object = kc.ConvertFromString(txtHotkeySearchKey.Text.ToUpper)
|
||||
keyCode = CType(obj, Keys)
|
||||
If cmbfunctionHit.Text = ClassConstants.HOTKEY_CTRL Then
|
||||
Hotkey.AddHotKey(keyCode, clsHotkey.MODKEY.MOD_CONTROL, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
Hotkey.AddHotKey(keyCode, MOD_CONTROL, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
ElseIf cmbfunctionHit.Text = "SHIFT" Then
|
||||
Hotkey.AddHotKey(keyCode, clsHotkey.MODKEY.MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
Hotkey.AddHotKey(keyCode, MOD_SHIFT, ClassConstants.HOTKEY_TRIGGER_WATCHER)
|
||||
End If
|
||||
lblChanges.Text = "Hotkey changed - " & Now.ToString & " - Restart required"
|
||||
lblChanges.Visible = True
|
||||
Dim msg = "Die Änderung des Hotkeys war erfolgreich." & vbNewLine & "Da es sich um einen global Hotkey handelt muss die Anwendung aber neugestartet werden!"
|
||||
|
||||
Dim msg = "Die Änderung des Hotkeys war erfolgreich." & vbNewLine & "Da es sich um einen global Hotkey handelt muss die Anwendung neugestartet werden!"
|
||||
If USER_LANGUAGE <> "de-DE" Then
|
||||
msg = "The change of your desired hotkey was successfull." & vbNewLine & "For using it the application must be restarted now!"
|
||||
End If
|
||||
@@ -236,8 +202,7 @@ Public Class frmConfig_Basic
|
||||
Application.Restart()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected Error in ChangeHotkey:")
|
||||
MsgBox("Unexpected Error in ChangeHotkey:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user