JJ 23.09.15

This commit is contained in:
JenneJ
2015-09-23 15:51:55 +02:00
parent 3f25fc766f
commit b5e2174ab8
6 changed files with 225 additions and 31 deletions

View File

@@ -6,7 +6,6 @@ Public Class ClassInit
Public Sub InitLogger()
ClassLogger.Init("", Environment.UserName)
'Throw New Exception("Dummy Fehler!")
End Sub
Public Sub InitDatabase()
@@ -34,6 +33,34 @@ Public Class ClassInit
End If
End Sub
Public Sub InitInterface(mainForm As frmMain)
Dim SQL As String = "SELECT BACKGROUND_IMAGE, PRODUCT_NAME1 FROM TBDD_MODULES WHERE NAME = 'Record-Organizer'"
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
If dt.Rows.Count > 0 Then
Dim row As DataRow = dt.Rows(0)
If Not IsDBNull(row.Item("BACKGROUND_IMAGE")) Then
Dim bimage() As Byte = CType(row.Item("BACKGROUND_IMAGE"), Byte())
Dim image As Bitmap = ByteArrayToBitmap(bimage)
mainForm.SetWindowBackground(image)
End If
If Not IsDBNull(row.Item("PRODUCT_NAME1")) Then
Dim title As String = row.Item("PRODUCT_NAME1")
mainForm.SetWindowTitle(title)
End If
End If
End Sub
Public Sub InitUserLogin()
Dim sql = sql_UserID
sql = sql.Replace("@user", Environment.UserName)

View File

@@ -33,9 +33,19 @@ Partial Class frmConfiguration_Basic
Me.chkUnicode = New System.Windows.Forms.CheckBox()
Me.btnsave = New System.Windows.Forms.Button()
Me.lblSaveresult = New System.Windows.Forms.Label()
Me.CheckBox2 = New System.Windows.Forms.CheckBox()
Me.chkChildWindow = New System.Windows.Forms.CheckBox()
Me.pbBackground = New System.Windows.Forms.PictureBox()
Me.GroupBox3 = New System.Windows.Forms.GroupBox()
Me.btnResetBackground = New System.Windows.Forms.Button()
Me.btnSelectBackground = New System.Windows.Forms.Button()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
Me.txtProductName = New System.Windows.Forms.TextBox()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
CType(Me.pbBackground, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox3.SuspendLayout()
Me.GroupBox4.SuspendLayout()
Me.SuspendLayout()
'
'Label1
@@ -92,7 +102,7 @@ Partial Class frmConfiguration_Basic
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.txtDelimiterFile)
Me.GroupBox1.Controls.Add(Me.txtDelimiterVersion)
Me.GroupBox1.Location = New System.Drawing.Point(218, 12)
Me.GroupBox1.Location = New System.Drawing.Point(218, 74)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(293, 105)
Me.GroupBox1.TabIndex = 8
@@ -126,7 +136,7 @@ Partial Class frmConfiguration_Basic
Me.btnsave.Enabled = False
Me.btnsave.Image = Global.DD_Record_Organiser.My.Resources.Resources.save
Me.btnsave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnsave.Location = New System.Drawing.Point(12, 187)
Me.btnsave.Location = New System.Drawing.Point(12, 302)
Me.btnsave.Name = "btnsave"
Me.btnsave.Size = New System.Drawing.Size(87, 22)
Me.btnsave.TabIndex = 10
@@ -140,32 +150,94 @@ Partial Class frmConfiguration_Basic
Me.lblSaveresult.AutoSize = True
Me.lblSaveresult.BackColor = System.Drawing.Color.Yellow
Me.lblSaveresult.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblSaveresult.Location = New System.Drawing.Point(277, 192)
Me.lblSaveresult.Location = New System.Drawing.Point(651, 310)
Me.lblSaveresult.Name = "lblSaveresult"
Me.lblSaveresult.Size = New System.Drawing.Size(234, 17)
Me.lblSaveresult.TabIndex = 78
Me.lblSaveresult.Text = "Änderungen erfolgreich gespeichert!"
Me.lblSaveresult.Visible = False
'
'CheckBox2
'chkChildWindow
'
Me.CheckBox2.AutoSize = True
Me.CheckBox2.Checked = Global.DD_Record_Organiser.My.MySettings.Default.User_DesignPanels_areChild
Me.CheckBox2.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBox2.DataBindings.Add(New System.Windows.Forms.Binding("Checked", Global.DD_Record_Organiser.My.MySettings.Default, "User_DesignPanels_areChild", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.CheckBox2.Location = New System.Drawing.Point(12, 135)
Me.CheckBox2.Name = "CheckBox2"
Me.CheckBox2.Size = New System.Drawing.Size(194, 30)
Me.CheckBox2.TabIndex = 79
Me.CheckBox2.Text = "Design-Panels als Child aufrufen" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(Eingebettet in Hauptformular)"
Me.CheckBox2.UseVisualStyleBackColor = True
Me.chkChildWindow.AutoSize = True
Me.chkChildWindow.Checked = Global.DD_Record_Organiser.My.MySettings.Default.User_DesignPanels_areChild
Me.chkChildWindow.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkChildWindow.DataBindings.Add(New System.Windows.Forms.Binding("Checked", Global.DD_Record_Organiser.My.MySettings.Default, "User_DesignPanels_areChild", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.chkChildWindow.Location = New System.Drawing.Point(12, 135)
Me.chkChildWindow.Name = "chkChildWindow"
Me.chkChildWindow.Size = New System.Drawing.Size(194, 30)
Me.chkChildWindow.TabIndex = 79
Me.chkChildWindow.Text = "Design-Panels als Child aufrufen" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "(Eingebettet in Hauptformular)"
Me.chkChildWindow.UseVisualStyleBackColor = True
'
'pbBackground
'
Me.pbBackground.Location = New System.Drawing.Point(6, 21)
Me.pbBackground.Name = "pbBackground"
Me.pbBackground.Size = New System.Drawing.Size(356, 194)
Me.pbBackground.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage
Me.pbBackground.TabIndex = 80
Me.pbBackground.TabStop = False
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.btnResetBackground)
Me.GroupBox3.Controls.Add(Me.btnSelectBackground)
Me.GroupBox3.Controls.Add(Me.pbBackground)
Me.GroupBox3.Location = New System.Drawing.Point(517, 12)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(368, 256)
Me.GroupBox3.TabIndex = 81
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "Anwendungshintergrund"
'
'btnResetBackground
'
Me.btnResetBackground.Location = New System.Drawing.Point(211, 221)
Me.btnResetBackground.Name = "btnResetBackground"
Me.btnResetBackground.Size = New System.Drawing.Size(151, 23)
Me.btnResetBackground.TabIndex = 82
Me.btnResetBackground.Text = "Hintergrund zurücksetzen"
Me.btnResetBackground.UseVisualStyleBackColor = True
'
'btnSelectBackground
'
Me.btnSelectBackground.Location = New System.Drawing.Point(6, 221)
Me.btnSelectBackground.Name = "btnSelectBackground"
Me.btnSelectBackground.Size = New System.Drawing.Size(151, 23)
Me.btnSelectBackground.TabIndex = 81
Me.btnSelectBackground.Text = "Hintergrund auswählen.."
Me.btnSelectBackground.UseVisualStyleBackColor = True
'
'OpenFileDialog1
'
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
'
'GroupBox4
'
Me.GroupBox4.Controls.Add(Me.txtProductName)
Me.GroupBox4.Location = New System.Drawing.Point(224, 12)
Me.GroupBox4.Name = "GroupBox4"
Me.GroupBox4.Size = New System.Drawing.Size(287, 56)
Me.GroupBox4.TabIndex = 82
Me.GroupBox4.TabStop = False
Me.GroupBox4.Text = "Anwendungsname"
'
'txtProductName
'
Me.txtProductName.Location = New System.Drawing.Point(6, 21)
Me.txtProductName.Name = "txtProductName"
Me.txtProductName.Size = New System.Drawing.Size(238, 22)
Me.txtProductName.TabIndex = 0
'
'frmConfiguration_Basic
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(697, 218)
Me.Controls.Add(Me.CheckBox2)
Me.ClientSize = New System.Drawing.Size(897, 336)
Me.Controls.Add(Me.GroupBox4)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.chkChildWindow)
Me.Controls.Add(Me.lblSaveresult)
Me.Controls.Add(Me.btnsave)
Me.Controls.Add(Me.GroupBox2)
@@ -179,6 +251,10 @@ Partial Class frmConfiguration_Basic
Me.GroupBox1.PerformLayout()
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
CType(Me.pbBackground, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox4.ResumeLayout(False)
Me.GroupBox4.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -194,5 +270,12 @@ Partial Class frmConfiguration_Basic
Friend WithEvents chkUnicode As System.Windows.Forms.CheckBox
Friend WithEvents btnsave As System.Windows.Forms.Button
Friend WithEvents lblSaveresult As System.Windows.Forms.Label
Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
Friend WithEvents chkChildWindow As System.Windows.Forms.CheckBox
Friend WithEvents pbBackground As System.Windows.Forms.PictureBox
Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
Friend WithEvents btnResetBackground As System.Windows.Forms.Button
Friend WithEvents btnSelectBackground As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox
Friend WithEvents txtProductName As System.Windows.Forms.TextBox
End Class

View File

@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -4,13 +4,21 @@
Dim changes_Konfig As Boolean = False
Private Sub frmConfiguration_Basic_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
Dim sql As String = "select * from TBDD_MODULES where NAME = 'Global-Indexer'"
Dim sql As String = "select * from TBDD_MODULES where NAME = 'Record-Organizer'"
Dim dt As DataTable = ClassDatabase.Return_Datatable(sql)
If Not dt Is Nothing Then
If dt.Rows.Count = 1 Then
Me.txtDelimiterVersion.Text = dt.Rows(0).Item("VERSION_DELIMITER")
Me.txtDelimiterFile.Text = dt.Rows(0).Item("FILE_DELIMITER")
Me.txtwddriveletter.Text = dt.Rows(0).Item("STRING1")
Me.txtProductName.Text = dt.Rows(0).Item("PRODUCT_NAME1")
' Hintergrundbild unwandeln und anzeigen
If Not IsDBNull(dt.Rows(0).Item("BACKGROUND_IMAGE")) Then
Dim bimage() As Byte = dt.Rows(0).Item("BACKGROUND_IMAGE")
Dim image = ByteArrayToBitmap(bimage)
Me.pbBackground.Image = image
End If
End If
End If
sql = "select * from TBPMO_KONFIGURATION where GUID = 1"
@@ -26,7 +34,7 @@
loaded = True
End Sub
Private Sub TextChanged_ModuleKonfig(sender As Object, e As EventArgs) Handles txtDelimiterFile.TextChanged, txtDelimiterVersion.TextChanged, txtwddriveletter.TextChanged
Private Sub TextChanged_ModuleKonfig(sender As Object, e As EventArgs) Handles txtDelimiterFile.TextChanged, txtDelimiterVersion.TextChanged, txtwddriveletter.TextChanged, txtProductName.TextChanged
If loaded = True Then
changes_ModuleKonfig = True
btnsave.Enabled = True
@@ -43,12 +51,33 @@
Private Sub btnsave_Click(sender As Object, e As EventArgs) Handles btnsave.Click
If changes_ModuleKonfig = True Then
Try
Dim sql As String = "UPDATE TBDD_MODULES SET VERSION_DELIMITER = '" & Me.txtDelimiterVersion.Text & "',FILE_DELIMITER = '" & Me.txtDelimiterFile.Text & "',STRING1 = '" & Me.txtwddriveletter.Text & "',CHANGED_WHO = '" & Environment.UserName & "' where NAME = 'Global-Indexer'"
If ClassDatabase.Execute_non_Query(sql, True) = True Then
lblSaveresult.Visible = True
' Hintergrund speichern
Dim image As Bitmap = Nothing
Dim bimage() As Byte = Nothing
Dim sql As String = "UPDATE TBDD_MODULES SET VERSION_DELIMITER = @VERSION_DELIMITER, FILE_DELIMITER = @FILE_DELIMITER, STRING1 = @STRING1, BACKGROUND_IMAGE = @BACKGROUND_IMAGE, PRODUCT_NAME1 = @PRODUCT_NAME1, CHANGED_WHO = @CHANGED_WHO WHERE NAME = 'Record-Organizer'"
Dim conn As New SqlClient.SqlConnection(MyConnectionString)
Dim cmd As New SqlClient.SqlCommand(sql, conn)
If pbBackground.ImageLocation IsNot Nothing Then
image = CType(Drawing.Image.FromFile(pbBackground.ImageLocation, True), Bitmap)
bimage = BitmapToByteArray(image)
cmd.Parameters.Add("@BACKGROUND_IMAGE", SqlDbType.VarBinary).Value = bimage
Else
lblSaveresult.Visible = False
cmd.Parameters.Add("@BACKGROUND_IMAGE", SqlDbType.VarBinary).Value = DBNull.Value
End If
cmd.Parameters.Add("@VERSION_DELIMITER", SqlDbType.Text).Value = txtDelimiterVersion.Text
cmd.Parameters.Add("@FILE_DELIMITER", SqlDbType.Text).Value = txtDelimiterFile.Text
cmd.Parameters.Add("@STRING1", SqlDbType.Text).Value = txtwddriveletter.Text
cmd.Parameters.Add("@CHANGED_WHO", SqlDbType.Text).Value = Environment.UserName
cmd.Parameters.Add("@PRODUCT_NAME1", SqlDbType.Text).Value = txtProductName.Text
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
lblSaveresult.Visible = True
Catch ex As Exception
MsgBox("Error in Save ModuleConfig: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -72,8 +101,28 @@
End Sub
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
Private Sub chkChildWindow_CheckedChanged(sender As Object, e As EventArgs) Handles chkChildWindow.CheckedChanged
My.Settings.Save()
End Sub
Private Sub btnSelectBackground_Click(sender As Object, e As EventArgs) Handles btnSelectBackground.Click
OpenFileDialog1.Filter = "PNG Bilder|*.png"
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim path As String = OpenFileDialog1.FileName
pbBackground.ImageLocation = path
btnsave.Enabled = True
changes_ModuleKonfig = True
End If
End Sub
Private Sub btnResetBackground_Click(sender As Object, e As EventArgs) Handles btnResetBackground.Click
If pbBackground.Image IsNot Nothing Then
btnsave.Enabled = True
changes_ModuleKonfig = True
End If
pbBackground.ImageLocation = Nothing
pbBackground.Image = Nothing
End Sub
End Class

View File

@@ -190,6 +190,29 @@ Public Class frmMain
End Try
Next
End Sub
Delegate Sub SetWindowTitleDelegate(t As String)
Public Sub SetWindowTitle(t As String)
If Me.InvokeRequired Then
Dim d As New SetWindowTitleDelegate(AddressOf SetWindowTitle)
Me.Invoke(d, New Object() {t})
Else
Me.Text = t
End If
End Sub
Delegate Sub SetWindowBackgroundDelegate(i As Bitmap)
Public Sub SetWindowBackground(i As Bitmap)
If Me.InvokeRequired Then
Dim d As New SetWindowBackgroundDelegate(AddressOf SetWindowBackground)
Me.Invoke(d, New Object() {i})
Else
Me.BackgroundImage = i
End If
End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
' Form Titel setzen

View File

@@ -4,8 +4,10 @@ Public NotInheritable Class frmSplash
'TODO: Dieses Formular kann einfach als Begrüßungsbildschirm für die Anwendung festgelegt werden, indem Sie zur Registerkarte "Anwendung"
' des Projekt-Designers wechseln (Menü "Projekt", Option "Eigenschaften").
Private InitSteps As Integer = 4
Private InitSteps As Integer = 5
Private bw As New BackgroundWorker()
Private mainForm As Form
Private Sub frmSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Richten Sie den Dialogtext zur Laufzeit gemäß den Assemblyinformationen der Anwendung ein.
@@ -44,6 +46,8 @@ Public NotInheritable Class frmSplash
AddHandler bw.ProgressChanged, AddressOf bw_ProgressChanged
AddHandler bw.RunWorkerCompleted, AddressOf bw_RunWorkerCompleted
mainForm = My.Forms.frmMain
bw.RunWorkerAsync()
End Sub
@@ -58,22 +62,27 @@ Public NotInheritable Class frmSplash
bw.ReportProgress(CalcProgress(1), "Initialisiere Logger")
Init.InitLogger()
System.Threading.Thread.Sleep(600)
System.Threading.Thread.Sleep(500)
bw.ReportProgress(CalcProgress(2), "Initialisiere Datenbank")
Init.InitDatabase()
System.Threading.Thread.Sleep(600)
System.Threading.Thread.Sleep(500)
bw.ReportProgress(CalcProgress(3), "Initialisiere Windream-Einstellungen")
Init.InitWindream()
System.Threading.Thread.Sleep(600)
System.Threading.Thread.Sleep(500)
bw.ReportProgress(CalcProgress(4), "Initialisiere Benutzer")
Init.InitUserLogin()
System.Threading.Thread.Sleep(500)
bw.ReportProgress(CalcProgress(5), "Initialisiere Oberfläche")
Init.InitInterface(mainForm)
System.Threading.Thread.Sleep(500)
End Sub
Private Sub bw_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs)