TVSettings Bugfix

This commit is contained in:
2024-12-23 14:52:57 +01:00
parent 62be483deb
commit ddec6280e9
2 changed files with 29 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ Partial Class frmTvSettings
Private WithEvents cmbLogoSelection As ComboBox ' Neue ComboBox für Logo-Auswahl
Private WithEvents btnSave As Button
'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.
@@ -54,6 +55,7 @@ Partial Class frmTvSettings
Me.numTextBalkenHeight = New System.Windows.Forms.NumericUpDown()
Me.cmbLogoSelection = New System.Windows.Forms.ComboBox()
Me.btnSave = New System.Windows.Forms.Button()
Me.chkReload = New System.Windows.Forms.CheckBox()
Me.numKachelRowGapInPercent = New System.Windows.Forms.NumericUpDown()
Me.Label1 = New System.Windows.Forms.Label()
Me.numTextFLaggeLeft = New System.Windows.Forms.NumericUpDown()
@@ -134,7 +136,7 @@ Partial Class frmTvSettings
'lblLogoSelection
'
Me.lblLogoSelection.AutoSize = True
Me.lblLogoSelection.Location = New System.Drawing.Point(24, 389)
Me.lblLogoSelection.Location = New System.Drawing.Point(24, 393)
Me.lblLogoSelection.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.lblLogoSelection.Name = "lblLogoSelection"
Me.lblLogoSelection.Size = New System.Drawing.Size(85, 13)
@@ -210,7 +212,7 @@ Partial Class frmTvSettings
'
Me.cmbLogoSelection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbLogoSelection.FormattingEnabled = True
Me.cmbLogoSelection.Location = New System.Drawing.Point(167, 387)
Me.cmbLogoSelection.Location = New System.Drawing.Point(167, 391)
Me.cmbLogoSelection.Margin = New System.Windows.Forms.Padding(2)
Me.cmbLogoSelection.Name = "cmbLogoSelection"
Me.cmbLogoSelection.Size = New System.Drawing.Size(91, 21)
@@ -218,7 +220,7 @@ Partial Class frmTvSettings
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(167, 422)
Me.btnSave.Location = New System.Drawing.Point(167, 460)
Me.btnSave.Margin = New System.Windows.Forms.Padding(2)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(90, 24)
@@ -226,6 +228,17 @@ Partial Class frmTvSettings
Me.btnSave.Text = "Speichern"
Me.btnSave.UseVisualStyleBackColor = True
'
'chkReload
'
Me.chkReload.AutoSize = True
Me.chkReload.Location = New System.Drawing.Point(70, 465)
Me.chkReload.Margin = New System.Windows.Forms.Padding(2)
Me.chkReload.Name = "chkReload"
Me.chkReload.Size = New System.Drawing.Size(84, 17)
Me.chkReload.TabIndex = 22
Me.chkReload.Text = "Only Reload"
Me.chkReload.UseVisualStyleBackColor = True
'
'numKachelRowGapInPercent
'
Me.numKachelRowGapInPercent.DecimalPlaces = 2
@@ -260,7 +273,7 @@ Partial Class frmTvSettings
'numTextFlaggeBottom
'
Me.numTextFlaggeBottom.DecimalPlaces = 2
Me.numTextFlaggeBottom.Location = New System.Drawing.Point(165, 348)
Me.numTextFlaggeBottom.Location = New System.Drawing.Point(165, 352)
Me.numTextFlaggeBottom.Margin = New System.Windows.Forms.Padding(2)
Me.numTextFlaggeBottom.Name = "numTextFlaggeBottom"
Me.numTextFlaggeBottom.Size = New System.Drawing.Size(92, 20)
@@ -280,7 +293,7 @@ Partial Class frmTvSettings
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(22, 350)
Me.Label3.Location = New System.Drawing.Point(22, 354)
Me.Label3.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(92, 13)
@@ -291,7 +304,8 @@ Partial Class frmTvSettings
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(291, 506)
Me.ClientSize = New System.Drawing.Size(291, 525)
Me.Controls.Add(Me.chkReload)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.numTextFlaggeBottom)
@@ -339,4 +353,6 @@ Partial Class frmTvSettings
Private WithEvents numTextFlaggeBottom As NumericUpDown
Private WithEvents Label2 As Label
Private WithEvents Label3 As Label
Private WithEvents chkReload As CheckBox ' Deklaration der Checkbox
End Class

View File

@@ -43,6 +43,7 @@ Partial Class frmTvSettings
' Wenn nicht, setze auf den ersten Eintrag
cmbLogoSelection.SelectedIndex = 0
End If
Else
' Standardwerte verwenden, falls keine Einstellungen vorhanden sind
SetDefaultValues()
@@ -70,11 +71,9 @@ Partial Class frmTvSettings
' Methode zur Initialisierung der ComboBox
Private Sub InitializeComboBox()
' Legen Sie die DisplayMember und ValueMember fest
cmbLogoSelection.DisplayMember = "Display"
cmbLogoSelection.ValueMember = "Value"
' Erstellen Sie eine Liste von ComboBoxItem-Objekten
Dim logoItems As New List(Of ComboBoxItem) From {
New ComboBoxItem("VERAG AG", "verag.png"),
New ComboBoxItem("ATILLA", "atilla.png"),
@@ -84,10 +83,9 @@ Partial Class frmTvSettings
New ComboBoxItem("UNISPED", "unisped.jpg")
}
' Binden Sie die Liste als DataSource
cmbLogoSelection.DataSource = logoItems
' Optional: Setzen Sie die Standardauswahl
If logoItems.Count > 0 Then
cmbLogoSelection.SelectedIndex = 0
End If
@@ -109,12 +107,14 @@ Partial Class frmTvSettings
If cmbLogoSelection.Items.Count > 0 Then
cmbLogoSelection.SelectedIndex = 0
End If
' Reload-Checkbox auf nicht aktiviert setzen
chkReload.Checked = False
End Sub
' Ereignis-Handler für den Speichern-Button
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Try
' Holen Sie sich das ausgewählte ComboBoxItem
Dim selectedItem As ComboBoxItem = CType(cmbLogoSelection.SelectedItem, ComboBoxItem)
Dim selectedValue As String = If(selectedItem IsNot Nothing, selectedItem.Value, String.Empty)
@@ -129,7 +129,8 @@ Partial Class frmTvSettings
.KachelRowGapInPercent = CDbl(numKachelRowGapInPercent.Value),
.TextFlaggeBottom = CDbl(numTextFlaggeBottom.Value),
.TextFlaggeLeft = CDbl(numTextFLaggeLeft.Value),
.SelectedLogoValue = selectedValue
.SelectedLogoValue = selectedValue,
.Reload = If(chkReload.Checked, 1, 0) ' Setzen der Reload-Spalte
}
' Einstellungen in der Datenbank speichern