diff --git a/Aviso/App.config b/Aviso/App.config index a1e778d..5a90c87 100644 --- a/Aviso/App.config +++ b/Aviso/App.config @@ -1,15 +1,15 @@ - + -
+
- + - + @@ -21,55 +21,75 @@ 200, 200 - + - + - + - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/Aviso/Aviso.vbproj b/Aviso/Aviso.vbproj index 8a1a7be..1fd998b 100644 --- a/Aviso/Aviso.vbproj +++ b/Aviso/Aviso.vbproj @@ -964,6 +964,12 @@ Form + + frmTvSettings.vb + + + Form + frmWarenbezeichnungBegriffe.vb @@ -1414,6 +1420,9 @@ frmTv.vb + + frmTvSettings.vb + frmWarenbezeichnungBegriffe.vb diff --git a/Aviso/My Project/AssemblyInfo.vb b/Aviso/My Project/AssemblyInfo.vb index 25d4a6f..4f4f35e 100644 --- a/Aviso/My Project/AssemblyInfo.vb +++ b/Aviso/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Aviso/bin/Debug/Resources/ambar_boarder.png b/Aviso/bin/Debug/Resources/ambar_boarder.png deleted file mode 100644 index bc0c101..0000000 Binary files a/Aviso/bin/Debug/Resources/ambar_boarder.png and /dev/null differ diff --git a/Aviso/frmEintragTvNew.Designer.vb b/Aviso/frmEintragTvNew.Designer.vb index c195513..51297e9 100644 --- a/Aviso/frmEintragTvNew.Designer.vb +++ b/Aviso/frmEintragTvNew.Designer.vb @@ -15,48 +15,80 @@ Partial Class frmEintragTvNew Private components As System.ComponentModel.IContainer + ' Deklaration der Steuerelemente + Friend WithEvents cbxStandort As ComboBox + Friend WithEvents lblStandort As Label + Friend WithEvents dgvAVISOTV As DataGridView + Friend WithEvents grpEingabe As GroupBox + Friend WithEvents lblNeueTvTextBezeichnung As Label + Friend WithEvents txtNeueTvTextBezeichnung As TextBox + Friend WithEvents chkIsActive As CheckBox + Friend WithEvents chkIsRecurring As CheckBox + Friend WithEvents grpWochentage As GroupBox + Friend WithEvents chkSunday As CheckBox + Friend WithEvents chkSaturday As CheckBox + Friend WithEvents chkFriday As CheckBox + Friend WithEvents chkThursday As CheckBox + Friend WithEvents chkWednesday As CheckBox + Friend WithEvents chkTuesday As CheckBox + Friend WithEvents chkMonday As CheckBox + Friend WithEvents dtpEndTime As DateTimePicker + Friend WithEvents lblEndTime As Label + Friend WithEvents dtpStartTime As DateTimePicker + Friend WithEvents lblStartTime As Label + Friend WithEvents dtpEndDate As DateTimePicker + Friend WithEvents lblEndDate As Label + Friend WithEvents dtpStartDate As DateTimePicker + Friend WithEvents lblStartDate As Label + Friend WithEvents lblZeile1 As Label + Friend WithEvents cmbTvTextBezeichnungAuswahl As ComboBox + Friend WithEvents lblBezeichnung As Label + Friend WithEvents lblPosition As Label + Friend WithEvents cmbPosition As ComboBox + Friend WithEvents btnSpeichern As Button + Friend WithEvents btnLoeschen As Button + Friend WithEvents btnAbbrechen As Button + Friend WithEvents chkShowInactive As CheckBox + ' Neue Komponenten für Textformatierung - Private WithEvents btnBold As Button - Private WithEvents btnItalic As Button - Private WithEvents btnUnderline As Button - Private WithEvents btnTextColor As Button - Private WithEvents btnBackColor As Button - Private WithEvents btnAlignLeft As Button - Private WithEvents btnAlignCenter As Button - Private WithEvents btnAlignRight As Button - Private WithEvents cmbFontFamily As ComboBox - Private WithEvents cmbFontSize As ComboBox - Private WithEvents colorDialogText As ColorDialog - Private WithEvents rtbZeile1 As RichTextBox ' Geänderte TextBox zu RichTextBox + Friend WithEvents btnBold As Button + Friend WithEvents btnItalic As Button + Friend WithEvents btnUnderline As Button + Friend WithEvents btnTextColor As Button + Friend WithEvents btnBackColor As Button + Friend WithEvents btnAlignLeft As Button + Friend WithEvents btnAlignCenter As Button + Friend WithEvents btnAlignRight As Button + Friend WithEvents cmbFontFamily As ComboBox + Friend WithEvents cmbFontSize As ComboBox + Friend WithEvents colorDialogText As ColorDialog + + ' TabControl und RichTextBoxen + Friend WithEvents tabControlZeilen As TabControl + Friend WithEvents tabPageZeile1 As TabPage + Friend WithEvents tabPageZeile2 As TabPage + Friend WithEvents tabPageZeile3 As TabPage + Friend WithEvents rtbZeile1 As RichTextBox + Friend WithEvents rtbZeile2 As RichTextBox + Friend WithEvents rtbZeile3 As RichTextBox + + Friend WithEvents btnOpenSettings As Button + Private Sub InitializeComponent() + Me.btnOpenSettings = New System.Windows.Forms.Button() Me.cbxStandort = New System.Windows.Forms.ComboBox() Me.lblStandort = New System.Windows.Forms.Label() Me.dgvAVISOTV = New System.Windows.Forms.DataGridView() Me.grpEingabe = New System.Windows.Forms.GroupBox() - Me.btnBold3 = New System.Windows.Forms.Button() - Me.btnItalic3 = New System.Windows.Forms.Button() - Me.btnUnderline3 = New System.Windows.Forms.Button() - Me.btnTextColor3 = New System.Windows.Forms.Button() - Me.btnBackColor3 = New System.Windows.Forms.Button() - Me.btnAlignLeft3 = New System.Windows.Forms.Button() - Me.btnAlignCenter3 = New System.Windows.Forms.Button() - Me.btnAlignRight3 = New System.Windows.Forms.Button() - Me.cmbFontFamily3 = New System.Windows.Forms.ComboBox() - Me.cmbFontSize3 = New System.Windows.Forms.ComboBox() - Me.btnBold2 = New System.Windows.Forms.Button() - Me.btnItalic2 = New System.Windows.Forms.Button() - Me.btnUnderline2 = New System.Windows.Forms.Button() - Me.btnTextColor2 = New System.Windows.Forms.Button() - Me.btnBackColor2 = New System.Windows.Forms.Button() - Me.btnAlignLeft2 = New System.Windows.Forms.Button() - Me.btnAlignCenter2 = New System.Windows.Forms.Button() - Me.btnAlignRight2 = New System.Windows.Forms.Button() - Me.cmbFontFamily2 = New System.Windows.Forms.ComboBox() - Me.cmbFontSize2 = New System.Windows.Forms.ComboBox() - Me.rtbZeile3 = New System.Windows.Forms.RichTextBox() + Me.tabControlZeilen = New System.Windows.Forms.TabControl() + Me.tabPageZeile1 = New System.Windows.Forms.TabPage() + Me.rtbZeile1 = New System.Windows.Forms.RichTextBox() + Me.tabPageZeile2 = New System.Windows.Forms.TabPage() Me.rtbZeile2 = New System.Windows.Forms.RichTextBox() + Me.tabPageZeile3 = New System.Windows.Forms.TabPage() + Me.rtbZeile3 = New System.Windows.Forms.RichTextBox() Me.lblNeueTvTextBezeichnung = New System.Windows.Forms.Label() Me.txtNeueTvTextBezeichnung = New System.Windows.Forms.TextBox() Me.chkIsActive = New System.Windows.Forms.CheckBox() @@ -77,9 +109,6 @@ Partial Class frmEintragTvNew Me.lblEndDate = New System.Windows.Forms.Label() Me.dtpStartDate = New System.Windows.Forms.DateTimePicker() Me.lblStartDate = New System.Windows.Forms.Label() - Me.lblZeile3 = New System.Windows.Forms.Label() - Me.lblZeile2 = New System.Windows.Forms.Label() - Me.rtbZeile1 = New System.Windows.Forms.RichTextBox() Me.lblZeile1 = New System.Windows.Forms.Label() Me.cmbTvTextBezeichnungAuswahl = New System.Windows.Forms.ComboBox() Me.lblBezeichnung = New System.Windows.Forms.Label() @@ -102,8 +131,21 @@ Partial Class frmEintragTvNew Me.colorDialogText = New System.Windows.Forms.ColorDialog() CType(Me.dgvAVISOTV, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpEingabe.SuspendLayout() + Me.tabControlZeilen.SuspendLayout() + Me.tabPageZeile1.SuspendLayout() + Me.tabPageZeile2.SuspendLayout() + Me.tabPageZeile3.SuspendLayout() Me.grpWochentage.SuspendLayout() Me.SuspendLayout() + + Me.btnOpenSettings.Location = New System.Drawing.Point(15, 1010) + Me.btnOpenSettings.Name = "btnOpenSettings" + Me.btnOpenSettings.Size = New System.Drawing.Size(150, 30) + Me.btnOpenSettings.TabIndex = 8 + Me.btnOpenSettings.Text = "TV Einstellungen" + Me.btnOpenSettings.UseVisualStyleBackColor = True + + ' 'cbxStandort ' @@ -138,28 +180,7 @@ Partial Class frmEintragTvNew ' 'grpEingabe ' - Me.grpEingabe.Controls.Add(Me.btnBold3) - Me.grpEingabe.Controls.Add(Me.btnItalic3) - Me.grpEingabe.Controls.Add(Me.btnUnderline3) - Me.grpEingabe.Controls.Add(Me.btnTextColor3) - Me.grpEingabe.Controls.Add(Me.btnBackColor3) - Me.grpEingabe.Controls.Add(Me.btnAlignLeft3) - Me.grpEingabe.Controls.Add(Me.btnAlignCenter3) - Me.grpEingabe.Controls.Add(Me.btnAlignRight3) - Me.grpEingabe.Controls.Add(Me.cmbFontFamily3) - Me.grpEingabe.Controls.Add(Me.cmbFontSize3) - Me.grpEingabe.Controls.Add(Me.btnBold2) - Me.grpEingabe.Controls.Add(Me.btnItalic2) - Me.grpEingabe.Controls.Add(Me.btnUnderline2) - Me.grpEingabe.Controls.Add(Me.btnTextColor2) - Me.grpEingabe.Controls.Add(Me.btnBackColor2) - Me.grpEingabe.Controls.Add(Me.btnAlignLeft2) - Me.grpEingabe.Controls.Add(Me.btnAlignCenter2) - Me.grpEingabe.Controls.Add(Me.btnAlignRight2) - Me.grpEingabe.Controls.Add(Me.cmbFontFamily2) - Me.grpEingabe.Controls.Add(Me.cmbFontSize2) - Me.grpEingabe.Controls.Add(Me.rtbZeile3) - Me.grpEingabe.Controls.Add(Me.rtbZeile2) + Me.grpEingabe.Controls.Add(Me.tabControlZeilen) Me.grpEingabe.Controls.Add(Me.lblNeueTvTextBezeichnung) Me.grpEingabe.Controls.Add(Me.txtNeueTvTextBezeichnung) Me.grpEingabe.Controls.Add(Me.chkIsActive) @@ -173,9 +194,6 @@ Partial Class frmEintragTvNew Me.grpEingabe.Controls.Add(Me.lblEndDate) Me.grpEingabe.Controls.Add(Me.dtpStartDate) Me.grpEingabe.Controls.Add(Me.lblStartDate) - Me.grpEingabe.Controls.Add(Me.lblZeile3) - Me.grpEingabe.Controls.Add(Me.lblZeile2) - Me.grpEingabe.Controls.Add(Me.rtbZeile1) Me.grpEingabe.Controls.Add(Me.lblZeile1) Me.grpEingabe.Controls.Add(Me.cmbTvTextBezeichnungAuswahl) Me.grpEingabe.Controls.Add(Me.lblBezeichnung) @@ -198,202 +216,77 @@ Partial Class frmEintragTvNew Me.grpEingabe.TabStop = False Me.grpEingabe.Text = "Informationen eingeben" ' - 'btnBold3 + 'tabControlZeilen ' - Me.btnBold3.Location = New System.Drawing.Point(100, 449) - Me.btnBold3.Name = "btnBold3" - Me.btnBold3.Size = New System.Drawing.Size(30, 30) - Me.btnBold3.TabIndex = 45 - Me.btnBold3.Text = "B" - Me.btnBold3.UseVisualStyleBackColor = True + Me.tabControlZeilen.Controls.Add(Me.tabPageZeile1) + Me.tabControlZeilen.Controls.Add(Me.tabPageZeile2) + Me.tabControlZeilen.Controls.Add(Me.tabPageZeile3) + Me.tabControlZeilen.Location = New System.Drawing.Point(40, 100) + Me.tabControlZeilen.Name = "tabControlZeilen" + Me.tabControlZeilen.SelectedIndex = 0 + Me.tabControlZeilen.Size = New System.Drawing.Size(1235, 332) + Me.tabControlZeilen.TabIndex = 35 ' - 'btnItalic3 + 'tabPageZeile1 ' - Me.btnItalic3.Location = New System.Drawing.Point(140, 449) - Me.btnItalic3.Name = "btnItalic3" - Me.btnItalic3.Size = New System.Drawing.Size(30, 30) - Me.btnItalic3.TabIndex = 46 - Me.btnItalic3.Text = "I" - Me.btnItalic3.UseVisualStyleBackColor = True + Me.tabPageZeile1.Controls.Add(Me.rtbZeile1) + Me.tabPageZeile1.Location = New System.Drawing.Point(4, 22) + Me.tabPageZeile1.Name = "tabPageZeile1" + Me.tabPageZeile1.Padding = New System.Windows.Forms.Padding(3) + Me.tabPageZeile1.Size = New System.Drawing.Size(1227, 306) + Me.tabPageZeile1.TabIndex = 0 + Me.tabPageZeile1.Text = "Deutsch" + Me.tabPageZeile1.UseVisualStyleBackColor = True ' - 'btnUnderline3 + 'rtbZeile1 ' - Me.btnUnderline3.Location = New System.Drawing.Point(180, 449) - Me.btnUnderline3.Name = "btnUnderline3" - Me.btnUnderline3.Size = New System.Drawing.Size(30, 30) - Me.btnUnderline3.TabIndex = 47 - Me.btnUnderline3.Text = "U" - Me.btnUnderline3.UseVisualStyleBackColor = True + Me.rtbZeile1.Dock = System.Windows.Forms.DockStyle.Fill + Me.rtbZeile1.Location = New System.Drawing.Point(3, 3) + Me.rtbZeile1.Name = "rtbZeile1" + Me.rtbZeile1.Size = New System.Drawing.Size(1221, 300) + Me.rtbZeile1.TabIndex = 0 + Me.rtbZeile1.Text = "" ' - 'btnTextColor3 + 'tabPageZeile2 ' - Me.btnTextColor3.Location = New System.Drawing.Point(302, 449) - Me.btnTextColor3.Name = "btnTextColor3" - Me.btnTextColor3.Size = New System.Drawing.Size(30, 30) - Me.btnTextColor3.TabIndex = 48 - Me.btnTextColor3.Text = "A" - Me.btnTextColor3.UseVisualStyleBackColor = True - ' - 'btnBackColor3 - ' - Me.btnBackColor3.Location = New System.Drawing.Point(342, 449) - Me.btnBackColor3.Name = "btnBackColor3" - Me.btnBackColor3.Size = New System.Drawing.Size(30, 30) - Me.btnBackColor3.TabIndex = 49 - Me.btnBackColor3.Text = "BG" - Me.btnBackColor3.UseVisualStyleBackColor = True - ' - 'btnAlignLeft3 - ' - Me.btnAlignLeft3.Location = New System.Drawing.Point(471, 449) - Me.btnAlignLeft3.Name = "btnAlignLeft3" - Me.btnAlignLeft3.Size = New System.Drawing.Size(30, 30) - Me.btnAlignLeft3.TabIndex = 50 - Me.btnAlignLeft3.Text = "L" - Me.btnAlignLeft3.UseVisualStyleBackColor = True - ' - 'btnAlignCenter3 - ' - Me.btnAlignCenter3.Location = New System.Drawing.Point(511, 449) - Me.btnAlignCenter3.Name = "btnAlignCenter3" - Me.btnAlignCenter3.Size = New System.Drawing.Size(30, 30) - Me.btnAlignCenter3.TabIndex = 51 - Me.btnAlignCenter3.Text = "C" - Me.btnAlignCenter3.UseVisualStyleBackColor = True - ' - 'btnAlignRight3 - ' - Me.btnAlignRight3.Location = New System.Drawing.Point(551, 449) - Me.btnAlignRight3.Name = "btnAlignRight3" - Me.btnAlignRight3.Size = New System.Drawing.Size(30, 30) - Me.btnAlignRight3.TabIndex = 52 - Me.btnAlignRight3.Text = "R" - Me.btnAlignRight3.UseVisualStyleBackColor = True - ' - 'cmbFontFamily3 - ' - Me.cmbFontFamily3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.cmbFontFamily3.FormattingEnabled = True - Me.cmbFontFamily3.Location = New System.Drawing.Point(734, 449) - Me.cmbFontFamily3.Name = "cmbFontFamily3" - Me.cmbFontFamily3.Size = New System.Drawing.Size(150, 21) - Me.cmbFontFamily3.TabIndex = 53 - ' - 'cmbFontSize3 - ' - Me.cmbFontSize3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.cmbFontSize3.FormattingEnabled = True - Me.cmbFontSize3.Location = New System.Drawing.Point(911, 449) - Me.cmbFontSize3.Name = "cmbFontSize3" - Me.cmbFontSize3.Size = New System.Drawing.Size(60, 21) - Me.cmbFontSize3.TabIndex = 54 - ' - 'btnBold2 - ' - Me.btnBold2.Location = New System.Drawing.Point(101, 307) - Me.btnBold2.Name = "btnBold2" - Me.btnBold2.Size = New System.Drawing.Size(30, 30) - Me.btnBold2.TabIndex = 35 - Me.btnBold2.Text = "B" - Me.btnBold2.UseVisualStyleBackColor = True - ' - 'btnItalic2 - ' - Me.btnItalic2.Location = New System.Drawing.Point(141, 307) - Me.btnItalic2.Name = "btnItalic2" - Me.btnItalic2.Size = New System.Drawing.Size(30, 30) - Me.btnItalic2.TabIndex = 36 - Me.btnItalic2.Text = "I" - Me.btnItalic2.UseVisualStyleBackColor = True - ' - 'btnUnderline2 - ' - Me.btnUnderline2.Location = New System.Drawing.Point(181, 307) - Me.btnUnderline2.Name = "btnUnderline2" - Me.btnUnderline2.Size = New System.Drawing.Size(30, 30) - Me.btnUnderline2.TabIndex = 37 - Me.btnUnderline2.Text = "U" - Me.btnUnderline2.UseVisualStyleBackColor = True - ' - 'btnTextColor2 - ' - Me.btnTextColor2.Location = New System.Drawing.Point(303, 307) - Me.btnTextColor2.Name = "btnTextColor2" - Me.btnTextColor2.Size = New System.Drawing.Size(30, 30) - Me.btnTextColor2.TabIndex = 38 - Me.btnTextColor2.Text = "A" - Me.btnTextColor2.UseVisualStyleBackColor = True - ' - 'btnBackColor2 - ' - Me.btnBackColor2.Location = New System.Drawing.Point(343, 307) - Me.btnBackColor2.Name = "btnBackColor2" - Me.btnBackColor2.Size = New System.Drawing.Size(30, 30) - Me.btnBackColor2.TabIndex = 39 - Me.btnBackColor2.Text = "BG" - Me.btnBackColor2.UseVisualStyleBackColor = True - ' - 'btnAlignLeft2 - ' - Me.btnAlignLeft2.Location = New System.Drawing.Point(472, 307) - Me.btnAlignLeft2.Name = "btnAlignLeft2" - Me.btnAlignLeft2.Size = New System.Drawing.Size(30, 30) - Me.btnAlignLeft2.TabIndex = 40 - Me.btnAlignLeft2.Text = "L" - Me.btnAlignLeft2.UseVisualStyleBackColor = True - ' - 'btnAlignCenter2 - ' - Me.btnAlignCenter2.Location = New System.Drawing.Point(512, 307) - Me.btnAlignCenter2.Name = "btnAlignCenter2" - Me.btnAlignCenter2.Size = New System.Drawing.Size(30, 30) - Me.btnAlignCenter2.TabIndex = 41 - Me.btnAlignCenter2.Text = "C" - Me.btnAlignCenter2.UseVisualStyleBackColor = True - ' - 'btnAlignRight2 - ' - Me.btnAlignRight2.Location = New System.Drawing.Point(552, 307) - Me.btnAlignRight2.Name = "btnAlignRight2" - Me.btnAlignRight2.Size = New System.Drawing.Size(30, 30) - Me.btnAlignRight2.TabIndex = 42 - Me.btnAlignRight2.Text = "R" - Me.btnAlignRight2.UseVisualStyleBackColor = True - ' - 'cmbFontFamily2 - ' - Me.cmbFontFamily2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.cmbFontFamily2.FormattingEnabled = True - Me.cmbFontFamily2.Location = New System.Drawing.Point(735, 307) - Me.cmbFontFamily2.Name = "cmbFontFamily2" - Me.cmbFontFamily2.Size = New System.Drawing.Size(150, 21) - Me.cmbFontFamily2.TabIndex = 43 - ' - 'cmbFontSize2 - ' - Me.cmbFontSize2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.cmbFontSize2.FormattingEnabled = True - Me.cmbFontSize2.Location = New System.Drawing.Point(912, 307) - Me.cmbFontSize2.Name = "cmbFontSize2" - Me.cmbFontSize2.Size = New System.Drawing.Size(60, 21) - Me.cmbFontSize2.TabIndex = 44 - ' - 'rtbZeile3 - ' - Me.rtbZeile3.Location = New System.Drawing.Point(100, 363) - Me.rtbZeile3.Name = "rtbZeile3" - Me.rtbZeile3.Size = New System.Drawing.Size(1180, 80) - Me.rtbZeile3.TabIndex = 34 - Me.rtbZeile3.Text = "" + Me.tabPageZeile2.Controls.Add(Me.rtbZeile2) + Me.tabPageZeile2.Location = New System.Drawing.Point(4, 22) + Me.tabPageZeile2.Name = "tabPageZeile2" + Me.tabPageZeile2.Padding = New System.Windows.Forms.Padding(3) + Me.tabPageZeile2.Size = New System.Drawing.Size(1227, 306) + Me.tabPageZeile2.TabIndex = 1 + Me.tabPageZeile2.Text = "Englisch" + Me.tabPageZeile2.UseVisualStyleBackColor = True ' 'rtbZeile2 ' - Me.rtbZeile2.Location = New System.Drawing.Point(101, 221) + Me.rtbZeile2.Dock = System.Windows.Forms.DockStyle.Fill + Me.rtbZeile2.Location = New System.Drawing.Point(3, 3) Me.rtbZeile2.Name = "rtbZeile2" - Me.rtbZeile2.Size = New System.Drawing.Size(1180, 80) - Me.rtbZeile2.TabIndex = 33 + Me.rtbZeile2.Size = New System.Drawing.Size(1221, 300) + Me.rtbZeile2.TabIndex = 0 Me.rtbZeile2.Text = "" ' + 'tabPageZeile3 + ' + Me.tabPageZeile3.Controls.Add(Me.rtbZeile3) + Me.tabPageZeile3.Location = New System.Drawing.Point(4, 22) + Me.tabPageZeile3.Name = "tabPageZeile3" + Me.tabPageZeile3.Padding = New System.Windows.Forms.Padding(3) + Me.tabPageZeile3.Size = New System.Drawing.Size(1227, 306) + Me.tabPageZeile3.TabIndex = 2 + Me.tabPageZeile3.Text = "Türkisch" + Me.tabPageZeile3.UseVisualStyleBackColor = True + ' + 'rtbZeile3 + ' + Me.rtbZeile3.Dock = System.Windows.Forms.DockStyle.Fill + Me.rtbZeile3.Location = New System.Drawing.Point(3, 3) + Me.rtbZeile3.Name = "rtbZeile3" + Me.rtbZeile3.Size = New System.Drawing.Size(1221, 300) + Me.rtbZeile3.TabIndex = 0 + Me.rtbZeile3.Text = "" + ' 'lblNeueTvTextBezeichnung ' Me.lblNeueTvTextBezeichnung.AutoSize = True @@ -590,32 +483,6 @@ Partial Class frmEintragTvNew Me.lblStartDate.TabIndex = 8 Me.lblStartDate.Text = "Startdatum: " ' - 'lblZeile3 - ' - Me.lblZeile3.AutoSize = True - Me.lblZeile3.Location = New System.Drawing.Point(42, 388) - Me.lblZeile3.Name = "lblZeile3" - Me.lblZeile3.Size = New System.Drawing.Size(42, 13) - Me.lblZeile3.TabIndex = 6 - Me.lblZeile3.Text = "Zeile 3:" - ' - 'lblZeile2 - ' - Me.lblZeile2.AutoSize = True - Me.lblZeile2.Location = New System.Drawing.Point(43, 255) - Me.lblZeile2.Name = "lblZeile2" - Me.lblZeile2.Size = New System.Drawing.Size(42, 13) - Me.lblZeile2.TabIndex = 4 - Me.lblZeile2.Text = "Zeile 2:" - ' - 'rtbZeile1 - ' - Me.rtbZeile1.Location = New System.Drawing.Point(100, 79) - Me.rtbZeile1.Name = "rtbZeile1" - Me.rtbZeile1.Size = New System.Drawing.Size(1180, 80) - Me.rtbZeile1.TabIndex = 3 - Me.rtbZeile1.Text = "" - ' 'lblZeile1 ' Me.lblZeile1.AutoSize = True @@ -664,7 +531,7 @@ Partial Class frmEintragTvNew ' 'btnBold ' - Me.btnBold.Location = New System.Drawing.Point(100, 165) + Me.btnBold.Location = New System.Drawing.Point(40, 438) Me.btnBold.Name = "btnBold" Me.btnBold.Size = New System.Drawing.Size(30, 30) Me.btnBold.TabIndex = 23 @@ -673,7 +540,7 @@ Partial Class frmEintragTvNew ' 'btnItalic ' - Me.btnItalic.Location = New System.Drawing.Point(140, 165) + Me.btnItalic.Location = New System.Drawing.Point(80, 438) Me.btnItalic.Name = "btnItalic" Me.btnItalic.Size = New System.Drawing.Size(30, 30) Me.btnItalic.TabIndex = 24 @@ -682,7 +549,7 @@ Partial Class frmEintragTvNew ' 'btnUnderline ' - Me.btnUnderline.Location = New System.Drawing.Point(180, 165) + Me.btnUnderline.Location = New System.Drawing.Point(120, 438) Me.btnUnderline.Name = "btnUnderline" Me.btnUnderline.Size = New System.Drawing.Size(30, 30) Me.btnUnderline.TabIndex = 25 @@ -691,7 +558,7 @@ Partial Class frmEintragTvNew ' 'btnTextColor ' - Me.btnTextColor.Location = New System.Drawing.Point(302, 165) + Me.btnTextColor.Location = New System.Drawing.Point(200, 438) Me.btnTextColor.Name = "btnTextColor" Me.btnTextColor.Size = New System.Drawing.Size(30, 30) Me.btnTextColor.TabIndex = 26 @@ -700,16 +567,16 @@ Partial Class frmEintragTvNew ' 'btnBackColor ' - Me.btnBackColor.Location = New System.Drawing.Point(342, 165) + Me.btnBackColor.Location = New System.Drawing.Point(240, 438) Me.btnBackColor.Name = "btnBackColor" - Me.btnBackColor.Size = New System.Drawing.Size(30, 30) + Me.btnBackColor.Size = New System.Drawing.Size(50, 30) Me.btnBackColor.TabIndex = 27 Me.btnBackColor.Text = "BG" Me.btnBackColor.UseVisualStyleBackColor = True ' 'btnAlignLeft ' - Me.btnAlignLeft.Location = New System.Drawing.Point(471, 165) + Me.btnAlignLeft.Location = New System.Drawing.Point(310, 438) Me.btnAlignLeft.Name = "btnAlignLeft" Me.btnAlignLeft.Size = New System.Drawing.Size(30, 30) Me.btnAlignLeft.TabIndex = 28 @@ -718,7 +585,7 @@ Partial Class frmEintragTvNew ' 'btnAlignCenter ' - Me.btnAlignCenter.Location = New System.Drawing.Point(511, 165) + Me.btnAlignCenter.Location = New System.Drawing.Point(350, 438) Me.btnAlignCenter.Name = "btnAlignCenter" Me.btnAlignCenter.Size = New System.Drawing.Size(30, 30) Me.btnAlignCenter.TabIndex = 29 @@ -727,7 +594,7 @@ Partial Class frmEintragTvNew ' 'btnAlignRight ' - Me.btnAlignRight.Location = New System.Drawing.Point(551, 165) + Me.btnAlignRight.Location = New System.Drawing.Point(390, 438) Me.btnAlignRight.Name = "btnAlignRight" Me.btnAlignRight.Size = New System.Drawing.Size(30, 30) Me.btnAlignRight.TabIndex = 30 @@ -738,7 +605,7 @@ Partial Class frmEintragTvNew ' Me.cmbFontFamily.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.cmbFontFamily.FormattingEnabled = True - Me.cmbFontFamily.Location = New System.Drawing.Point(734, 165) + Me.cmbFontFamily.Location = New System.Drawing.Point(495, 438) Me.cmbFontFamily.Name = "cmbFontFamily" Me.cmbFontFamily.Size = New System.Drawing.Size(150, 21) Me.cmbFontFamily.TabIndex = 31 @@ -747,7 +614,7 @@ Partial Class frmEintragTvNew ' Me.cmbFontSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.cmbFontSize.FormattingEnabled = True - Me.cmbFontSize.Location = New System.Drawing.Point(911, 165) + Me.cmbFontSize.Location = New System.Drawing.Point(670, 438) Me.cmbFontSize.Name = "cmbFontSize" Me.cmbFontSize.Size = New System.Drawing.Size(60, 21) Me.cmbFontSize.TabIndex = 32 @@ -782,7 +649,7 @@ Partial Class frmEintragTvNew 'chkShowInactive ' Me.chkShowInactive.AutoSize = True - Me.chkShowInactive.Location = New System.Drawing.Point(230, 27) + Me.chkShowInactive.Location = New System.Drawing.Point(1205, 29) Me.chkShowInactive.Name = "chkShowInactive" Me.chkShowInactive.Size = New System.Drawing.Size(110, 17) Me.chkShowInactive.TabIndex = 1 @@ -800,6 +667,7 @@ Partial Class frmEintragTvNew Me.Controls.Add(Me.dgvAVISOTV) Me.Controls.Add(Me.lblStandort) Me.Controls.Add(Me.cbxStandort) + Me.Controls.Add(Me.btnOpenSettings) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.MaximizeBox = False Me.Name = "frmEintragTvNew" @@ -808,69 +676,14 @@ Partial Class frmEintragTvNew CType(Me.dgvAVISOTV, System.ComponentModel.ISupportInitialize).EndInit() Me.grpEingabe.ResumeLayout(False) Me.grpEingabe.PerformLayout() + Me.tabControlZeilen.ResumeLayout(False) + Me.tabPageZeile1.ResumeLayout(False) + Me.tabPageZeile2.ResumeLayout(False) + Me.tabPageZeile3.ResumeLayout(False) Me.grpWochentage.ResumeLayout(False) Me.grpWochentage.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub - - Friend WithEvents cbxStandort As ComboBox - Friend WithEvents lblStandort As Label - Friend WithEvents dgvAVISOTV As DataGridView - Friend WithEvents grpEingabe As GroupBox - Friend WithEvents lblNeueTvTextBezeichnung As Label - Friend WithEvents txtNeueTvTextBezeichnung As TextBox - Friend WithEvents chkIsActive As CheckBox - Friend WithEvents chkIsRecurring As CheckBox - Friend WithEvents grpWochentage As GroupBox - Friend WithEvents chkSunday As CheckBox - Friend WithEvents chkSaturday As CheckBox - Friend WithEvents chkFriday As CheckBox - Friend WithEvents chkThursday As CheckBox - Friend WithEvents chkWednesday As CheckBox - Friend WithEvents chkTuesday As CheckBox - Friend WithEvents chkMonday As CheckBox - Friend WithEvents dtpEndTime As DateTimePicker - Friend WithEvents lblEndTime As Label - Friend WithEvents dtpStartTime As DateTimePicker - Friend WithEvents lblStartTime As Label - Friend WithEvents dtpEndDate As DateTimePicker - Friend WithEvents lblEndDate As Label - Friend WithEvents dtpStartDate As DateTimePicker - Friend WithEvents lblStartDate As Label - Friend WithEvents lblZeile3 As Label - Friend WithEvents lblZeile2 As Label - Friend WithEvents lblZeile1 As Label - Friend WithEvents cmbTvTextBezeichnungAuswahl As ComboBox - Friend WithEvents lblBezeichnung As Label - Friend WithEvents lblPosition As Label - Friend WithEvents cmbPosition As ComboBox - Friend WithEvents btnSpeichern As Button - Friend WithEvents btnLoeschen As Button - Friend WithEvents btnAbbrechen As Button - Friend WithEvents chkShowInactive As CheckBox - Private WithEvents rtbZeile3 As RichTextBox - Private WithEvents rtbZeile2 As RichTextBox - Private WithEvents btnBold3 As Button - Private WithEvents btnItalic3 As Button - Private WithEvents btnUnderline3 As Button - Private WithEvents btnTextColor3 As Button - Private WithEvents btnBackColor3 As Button - Private WithEvents btnAlignLeft3 As Button - Private WithEvents btnAlignCenter3 As Button - Private WithEvents btnAlignRight3 As Button - Private WithEvents cmbFontFamily3 As ComboBox - Private WithEvents cmbFontSize3 As ComboBox - Private WithEvents btnBold2 As Button - Private WithEvents btnItalic2 As Button - Private WithEvents btnUnderline2 As Button - Private WithEvents btnTextColor2 As Button - Private WithEvents btnBackColor2 As Button - Private WithEvents btnAlignLeft2 As Button - Private WithEvents btnAlignCenter2 As Button - Private WithEvents btnAlignRight2 As Button - Private WithEvents cmbFontFamily2 As ComboBox - Private WithEvents cmbFontSize2 As ComboBox - End Class diff --git a/Aviso/frmEintragTvNew.resx b/Aviso/frmEintragTvNew.resx index 1af7de1..0a3bfe1 100644 --- a/Aviso/frmEintragTvNew.resx +++ b/Aviso/frmEintragTvNew.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/Aviso/frmEintragTvNew.vb b/Aviso/frmEintragTvNew.vb index 0f4b29d..811a7d4 100644 --- a/Aviso/frmEintragTvNew.vb +++ b/Aviso/frmEintragTvNew.vb @@ -23,8 +23,11 @@ Public Class frmEintragTvNew Private Sub frmEintragTvNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load LadeStandorte() - LadeTvTextBezeichnungen() + ' Erst alle Einträge laden, damit listAll bereits gefüllt ist LadenAlleEintraege() + ' Dann erst die Bezeichnungen laden + LadeTvTextBezeichnungen() + grpWochentage.Enabled = chkIsRecurring.Checked dgvAVISOTV.SelectionMode = DataGridViewSelectionMode.FullRowSelect dgvAVISOTV.MultiSelect = False @@ -35,6 +38,7 @@ Public Class frmEintragTvNew chkIsActive.Checked = True End Sub + Private Sub LadenAlleEintraege() Try AvisoTvNewDAL.LesenAlleAvisoTvNew(listAll) @@ -53,11 +57,11 @@ Public Class frmEintragTvNew Return End If - Dim sql As String = "SELECT DISTINCT Standort FROM StandorteTV ORDER BY Standort" + Dim sql As String = "SELECT DISTINCT StandortBezeichnung FROM StandorteTV ORDER BY StandortBezeichnung" Using cmd As New SqlCommand(sql, conn) Using dr As SqlDataReader = cmd.ExecuteReader() While dr.Read() - Dim standort As String = Convert.ToString(dr("Standort")) + Dim standort As String = Convert.ToString(dr("StandortBezeichnung")) standorte.Add(standort) End While End Using @@ -73,78 +77,56 @@ Public Class frmEintragTvNew If cbxStandort.Items.Count > 0 Then cbxStandort.SelectedIndex = 0 End Sub + ' Neue parameterlose initdgv-Methode Private Sub initdgv() - Try - RemoveHandler dgvAVISOTV.SelectionChanged, AddressOf dgvAVISOTV_SelectionChanged + Dim selectedStandort As String = If(cbxStandort.SelectedItem IsNot Nothing, cbxStandort.SelectedItem.ToString(), "") + initdgv(selectedStandort) + End Sub + + Private Sub initdgv(selectedStandort As String) + Try + ' Entfernen Sie vorhandene Event-Handler, um Doppelbindungen zu vermeiden + RemoveHandler dgvAVISOTV.SelectionChanged, AddressOf dgvAVISOTV_SelectionChanged + RemoveHandler dgvAVISOTV.CellFormatting, AddressOf dgvAVISOTV_CellFormatting + + Dim standortID As Integer = AvisoTvNewDAL.GetStandortID(selectedStandort) - Dim standort As String = cbxStandort.SelectedItem?.ToString() Dim showInactive As Boolean = chkShowInactive.Checked Dim gefilterteListe As List(Of cAvisoTvNew) If showInactive Then - gefilterteListe = list.Where(Function(x) x.Standort = standort).ToList() + gefilterteListe = list.Where(Function(x) x.StandortID = standortID).ToList() Else - gefilterteListe = list.Where(Function(x) x.Standort = standort AndAlso x.IsActive).ToList() + gefilterteListe = list.Where(Function(x) x.StandortID = standortID AndAlso x.IsActive).ToList() End If + ' Zurücksetzen der DataSource und Löschen der Zeilen dgvAVISOTV.DataSource = Nothing dgvAVISOTV.Rows.Clear() If gefilterteListe.Count > 0 Then dgvAVISOTV.DataSource = gefilterteListe - ' Anpassen der Spaltenüberschriften - dgvAVISOTV.Columns("TvTextBezeichnungID").HeaderText = "ID" - dgvAVISOTV.Columns("TvTextBezeichnung").HeaderText = "Bezeichnung" - dgvAVISOTV.Columns("FixeZeile1RTF").HeaderText = "Zeile 1 (Text)" - dgvAVISOTV.Columns("FixeZeile2RTF").HeaderText = "Zeile 2 (Text)" - dgvAVISOTV.Columns("FixeZeile3RTF").HeaderText = "Zeile 3 (Text)" - dgvAVISOTV.Columns("Standort").Visible = False - dgvAVISOTV.Columns("Art").Visible = False - dgvAVISOTV.Columns("StartDate").HeaderText = "Startdatum" - dgvAVISOTV.Columns("EndDate").HeaderText = "Enddatum" - dgvAVISOTV.Columns("StartTime").HeaderText = "Startzeit" - dgvAVISOTV.Columns("EndTime").HeaderText = "Endzeit" - dgvAVISOTV.Columns("IsRecurring").HeaderText = "Wiederholen" - dgvAVISOTV.Columns("IsActive").HeaderText = "Aktiv" - dgvAVISOTV.Columns("IsMonday").Visible = False - dgvAVISOTV.Columns("IsTuesday").Visible = False - dgvAVISOTV.Columns("IsWednesday").Visible = False - dgvAVISOTV.Columns("IsThursday").Visible = False - dgvAVISOTV.Columns("IsFriday").Visible = False - dgvAVISOTV.Columns("IsSaturday").Visible = False - dgvAVISOTV.Columns("IsSunday").Visible = False + ' Anpassen der Spaltenüberschriften und Sichtbarkeiten + ConfigureDataGridViewColumns() - ' Hinzufügen des CellFormatting-Handlers - AddHandler dgvAVISOTV.CellFormatting, AddressOf dgvAVISOTV_CellFormatting + AddFixeZeileTextColumns() + + ' Konvertieren von RTF-Inhalten zu reinem Text + ConvertRtfToPlainText() dgvAVISOTV.AutoResizeColumns() + ' Wiederhinzufügen der Event-Handler AddHandler dgvAVISOTV.SelectionChanged, AddressOf dgvAVISOTV_SelectionChanged - ' **Wiederherstellung der Auswahl basierend auf lastSelectedTVID** - If lastSelectedTVID <> 0 Then - Dim rowToSelect = dgvAVISOTV.Rows.Cast(Of DataGridViewRow)().FirstOrDefault(Function(r) CType(r.DataBoundItem, cAvisoTvNew).TvTextBezeichnungID = lastSelectedTVID) - If rowToSelect IsNot Nothing Then - rowToSelect.Selected = True - - dgvAVISOTV.FirstDisplayedScrollingRowIndex = rowToSelect.Index - dgvAVISOTV.CurrentCell = rowToSelect.Cells(0) - Else - ' Falls die TVID nicht gefunden wird, wähle die erste Zeile aus - If dgvAVISOTV.Rows.Count > 0 Then - dgvAVISOTV.Rows(0).Selected = True - dgvAVISOTV.CurrentCell = dgvAVISOTV.Rows(0).Cells(0) - dgvAVISOTV_SelectionChanged(Nothing, Nothing) - End If - End If - ElseIf dgvAVISOTV.Rows.Count > 0 Then - dgvAVISOTV.Rows(0).Selected = True - dgvAVISOTV.CurrentCell = dgvAVISOTV.Rows(0).Cells(0) - dgvAVISOTV_SelectionChanged(Nothing, Nothing) - End If + ' Wiederherstellung der Auswahl basierend auf lastSelectedTVID + RestoreSelection() Else + ' Wiederhinzufügen der Event-Handler AddHandler dgvAVISOTV.SelectionChanged, AddressOf dgvAVISOTV_SelectionChanged + + ' Felder leeren und Auswahl zurücksetzen ClearFields() myAvisoTvNew = Nothing End If @@ -157,6 +139,129 @@ Public Class frmEintragTvNew End Try End Sub + ' Neue Methode zum Konfigurieren der Spaltenüberschriften und Sichtbarkeiten + Private Sub ConfigureDataGridViewColumns() + ' Anpassen der Spaltenüberschriften + Dim headerTexts As New Dictionary(Of String, String) From { + {"TvTextBezeichnungID", "ID"}, + {"TvTextBezeichnung", "Bezeichnung"}, + {"StartDate", "Startdatum"}, + {"EndDate", "Enddatum"}, + {"StartTime", "Startzeit"}, + {"EndTime", "Endzeit"}, + {"IsRecurring", "Wiederholen"}, + {"IsActive", "Aktiv"} + } + + For Each columnName As String In headerTexts.Keys + If dgvAVISOTV.Columns.Contains(columnName) Then + dgvAVISOTV.Columns(columnName).HeaderText = headerTexts(columnName) + End If + Next + + ' Verstecken der unnötigen Spalten + Dim columnsToHide As String() = { + "FixeZeile1RTF", "FixeZeile2RTF", "FixeZeile3RTF", + "Standort", "Art", + "IsMonday", "IsTuesday", "IsWednesday", + "IsThursday", "IsFriday", "IsSaturday", "IsSunday", "StandortID", "FixeZeile1HTML", "FixeZeile2HTML", "FixeZeile3HTML" + } + + For Each columnName As String In columnsToHide + If dgvAVISOTV.Columns.Contains(columnName) Then + dgvAVISOTV.Columns(columnName).Visible = False + End If + Next + End Sub + + Private Sub AddFixeZeileTextColumns() + Dim textColumns As New List(Of DataGridViewTextBoxColumn) From { + New DataGridViewTextBoxColumn() With { + .Name = "FixeZeile1Text", + .HeaderText = "Deutsch", + .ReadOnly = True + }, + New DataGridViewTextBoxColumn() With { + .Name = "FixeZeile2Text", + .HeaderText = "Englisch", + .ReadOnly = True + }, + New DataGridViewTextBoxColumn() With { + .Name = "FixeZeile3Text", + .HeaderText = "Türkisch", + .ReadOnly = True + } + } + + For Each col As DataGridViewTextBoxColumn In textColumns + If Not dgvAVISOTV.Columns.Contains(col.Name) Then + dgvAVISOTV.Columns.Add(col) + End If + Next + End Sub + + ' Neue Methode zur Konvertierung von RTF zu reinem Text + Private Sub ConvertRtfToPlainText() + For Each row As DataGridViewRow In dgvAVISOTV.Rows + If Not row.IsNewRow Then + Dim rtfValue1 As String = If(row.Cells("FixeZeile1RTF").Value?.ToString(), String.Empty) + Dim rtfValue2 As String = If(row.Cells("FixeZeile2RTF").Value?.ToString(), String.Empty) + Dim rtfValue3 As String = If(row.Cells("FixeZeile3RTF").Value?.ToString(), String.Empty) + + row.Cells("FixeZeile1Text").Value = RtfToPlainText(rtfValue1) + row.Cells("FixeZeile2Text").Value = RtfToPlainText(rtfValue2) + row.Cells("FixeZeile3Text").Value = RtfToPlainText(rtfValue3) + End If + Next + End Sub + + ' Neue Methode zur Wiederherstellung der Auswahl + Private Sub RestoreSelection() + If lastSelectedTVID <> 0 Then + Dim rowToSelect = dgvAVISOTV.Rows.Cast(Of DataGridViewRow)().FirstOrDefault(Function(r) CType(r.DataBoundItem, cAvisoTvNew).TvTextBezeichnungID = lastSelectedTVID) + If rowToSelect IsNot Nothing Then + rowToSelect.Selected = True + dgvAVISOTV.FirstDisplayedScrollingRowIndex = rowToSelect.Index + dgvAVISOTV.CurrentCell = rowToSelect.Cells(0) + Dim selectedAviso As cAvisoTvNew = listAll.FirstOrDefault(Function(x) x.TvTextBezeichnungID = lastSelectedTVID AndAlso x.IsActive) + FillFieldsFromAviso(selectedAviso) + Else + ' Falls die TVID nicht gefunden wird, wähle die erste Zeile aus + SelectFirstRow() + End If + Else + ' Wenn keine letzte Auswahl vorhanden ist, wähle die erste Zeile aus + If dgvAVISOTV.Rows.Count > 0 Then + SelectFirstRow() + End If + End If + lastSelectedTVID = 0 + End Sub + + ' Hilfsmethode zum Auswählen der ersten Zeile + Private Sub SelectFirstRow() + If dgvAVISOTV.Rows.Count > 0 Then + dgvAVISOTV.Rows(0).Selected = True + dgvAVISOTV.CurrentCell = dgvAVISOTV.Rows(0).Cells(0) + dgvAVISOTV_SelectionChanged(Nothing, Nothing) + End If + End Sub + + ' Beispielhafte Implementierung der RtfToPlainText-Methode + Private Function RtfToPlainText(rtf As String) As String + If String.IsNullOrEmpty(rtf) Then Return String.Empty + Using rtb As New RichTextBox() + Try + rtb.Rtf = rtf + Return rtb.Text + Catch ex As Exception + ' Handle invalid RTF format + Return String.Empty + End Try + End Using + End Function + + Private Sub dgvAVISOTV_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) ' Definieren Sie die Namen der RTF-Spalten Dim rtfColumns As String() = {"FixeZeile1RTF", "FixeZeile2RTF", "FixeZeile3RTF"} @@ -191,9 +296,27 @@ Public Class frmEintragTvNew End Try LadeTvTextBezeichnungen() - initdgv() + initdgv(selectedStandort) End Sub + Private Sub btnOpenSettings_Click(sender As Object, e As EventArgs) Handles btnOpenSettings.Click + Dim currentStandort As String = cbxStandort.SelectedItem?.ToString() + Dim currentStandortID As Integer = 0 + + If Not String.IsNullOrEmpty(currentStandort) Then + currentStandortID = AvisoTvNewDAL.GetStandortID(currentStandort) + End If + + If currentStandortID = 0 Then + MessageBox.Show("Bitte wählen Sie einen gültigen Standort aus.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error) + Return + End If + + Dim settingsForm As New frmTvSettings(currentStandortID) + settingsForm.ShowDialog() + End Sub + + Private Sub btnNeu_Click(sender As Object, e As EventArgs) Dim standort As String = cbxStandort.SelectedItem?.ToString() If String.IsNullOrEmpty(standort) Then @@ -232,11 +355,12 @@ Public Class frmEintragTvNew End Class Private Sub cmbTvTextBezeichnungAuswahl_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbTvTextBezeichnungAuswahl.SelectedIndexChanged - If isInitializing Then + If isInitializing OrElse cmbTvTextBezeichnungAuswahl.SelectedIndex = -1 Then Return End If - If cmbTvTextBezeichnungAuswahl.SelectedValue Is Nothing OrElse cmbTvTextBezeichnungAuswahl.SelectedValue Is DBNull.Value Then + If listAll Is Nothing OrElse Not listAll.Any() Then + MessageBox.Show("Die Liste aller AvisoEinträge ist nicht geladen oder leer.", "Datenfehler", MessageBoxButtons.OK, MessageBoxIcon.Error) Return End If @@ -284,184 +408,198 @@ Public Class frmEintragTvNew End Try End Sub - Private Sub InitializeFontComboBoxes() - Dim fontFamilies As New List(Of String)() - For Each font As FontFamily In FontFamily.Families - fontFamilies.Add(font.Name) - Next - - ' Initialisierung für Zeile 1 - cmbFontFamily.DataSource = fontFamilies - cmbFontFamily.SelectedItem = rtbZeile1.Font.FontFamily.Name - - Dim sizes As Integer() = {8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72} - cmbFontSize.DataSource = sizes.Select(Function(s) s.ToString()).ToList() - cmbFontSize.SelectedItem = CInt(rtbZeile1.Font.Size).ToString() - - AddHandler cmbFontFamily.SelectedIndexChanged, AddressOf cmbFontFamily_SelectedIndexChanged - AddHandler cmbFontSize.SelectedIndexChanged, AddressOf cmbFontSize_SelectedIndexChanged - - ' Initialisierung für Zeile 2 - cmbFontFamily2.DataSource = New List(Of String)(fontFamilies) - cmbFontFamily2.SelectedItem = rtbZeile2.Font.FontFamily.Name - - cmbFontSize2.DataSource = sizes.Select(Function(s) s.ToString()).ToList() - cmbFontSize2.SelectedItem = CInt(rtbZeile2.Font.Size).ToString() - - AddHandler cmbFontFamily2.SelectedIndexChanged, AddressOf cmbFontFamily2_SelectedIndexChanged - AddHandler cmbFontSize2.SelectedIndexChanged, AddressOf cmbFontSize2_SelectedIndexChanged - - ' Initialisierung für Zeile 3 - cmbFontFamily3.DataSource = New List(Of String)(fontFamilies) - cmbFontFamily3.SelectedItem = rtbZeile3.Font.FontFamily.Name - - cmbFontSize3.DataSource = sizes.Select(Function(s) s.ToString()).ToList() - cmbFontSize3.SelectedItem = CInt(rtbZeile3.Font.Size).ToString() - - AddHandler cmbFontFamily3.SelectedIndexChanged, AddressOf cmbFontFamily3_SelectedIndexChanged - AddHandler cmbFontSize3.SelectedIndexChanged, AddressOf cmbFontSize3_SelectedIndexChanged + Private Sub tabControlZeilen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tabControlZeilen.SelectedIndexChanged + InitializeFontComboBoxes() End Sub + Private Sub InitializeFontComboBoxes() + Try + isInitializing = True + + ' Schritt 1: Font-Familien sammeln + Dim fontFamilies As New List(Of String)() + For Each font As FontFamily In FontFamily.Families + fontFamilies.Add(font.Name) + Next + + ' Schritt 2: cmbFontFamily initialisieren + cmbFontFamily.Items.Clear() + cmbFontFamily.Items.AddRange(fontFamilies.ToArray()) + + ' Schritt 3: Schriftgrößen sammeln + Dim sizes As Integer() = {8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72} + cmbFontSize.Items.Clear() + cmbFontSize.Items.AddRange(sizes.Select(Function(s) s.ToString()).ToArray()) + + ' Schritt 4: Aktuelle Schriftfamilie und Schriftgröße aus der RichTextBox lesen + If AktuelleRichTextBox IsNot Nothing Then + Dim selectedFont As Font = AktuelleRichTextBox.SelectionFont + + If selectedFont IsNot Nothing Then + ' Setze die Schriftfamilie + If fontFamilies.Contains(selectedFont.FontFamily.Name) Then + cmbFontFamily.SelectedItem = selectedFont.FontFamily.Name + ElseIf cmbFontFamily.Items.Count > 0 Then + cmbFontFamily.SelectedIndex = 0 ' Standard auf erste Schriftart setzen + End If + + ' Setze die Schriftgröße + Dim fontSizeInt As Integer = CInt(Math.Round(selectedFont.Size)) + Dim fontSizeStr As String = fontSizeInt.ToString() + If cmbFontSize.Items.Contains(fontSizeStr) Then + cmbFontSize.SelectedItem = fontSizeStr + ElseIf cmbFontSize.Items.Count > 0 Then + cmbFontSize.SelectedItem = "12" ' Standard auf 12 setzen + End If + Else + ' Falls keine spezifische Schrift ausgewählt ist, setze Standardwerte + If cmbFontFamily.Items.Count > 0 Then + cmbFontFamily.SelectedIndex = 0 + End If + If cmbFontSize.Items.Count > 0 Then + cmbFontSize.SelectedItem = "12" + End If + End If + Else + ' Falls AktuelleRichTextBox nicht gesetzt ist, setze Standardwerte + If cmbFontFamily.Items.Count > 0 Then + cmbFontFamily.SelectedIndex = 0 + End If + If cmbFontSize.Items.Count > 0 Then + cmbFontSize.SelectedItem = "12" + End If + End If + + ' Schritt 5: Event-Handler aktualisieren + ' Entferne alte Event-Handler, um Doppelbindungen zu vermeiden + RemoveHandler cmbFontFamily.SelectedIndexChanged, AddressOf cmbFontFamily_SelectedIndexChanged + RemoveHandler cmbFontSize.SelectedIndexChanged, AddressOf cmbFontSize_SelectedIndexChanged + + ' Füge neue Event-Handler hinzu + AddHandler cmbFontFamily.SelectedIndexChanged, AddressOf cmbFontFamily_SelectedIndexChanged + AddHandler cmbFontSize.SelectedIndexChanged, AddressOf cmbFontSize_SelectedIndexChanged + + isInitializing = False + Catch ex As Exception + MessageBox.Show("Fehler beim Initialisieren der Schriftart-ComboBoxes: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error) + Finally + isInitializing = False + End Try + End Sub + + + ' Schriftfamilie ComboBox SelectionChanged Private Sub cmbFontFamily_SelectedIndexChanged(sender As Object, e As EventArgs) + If isInitializing Then Return UpdateFont() End Sub ' Schriftgröße ComboBox SelectionChanged Private Sub cmbFontSize_SelectedIndexChanged(sender As Object, e As EventArgs) + If isInitializing Then Return UpdateFont() End Sub Private Sub UpdateFont() - Dim selectedFontFamily As String = If(cmbFontFamily.SelectedItem, rtbZeile1.SelectionFont?.FontFamily.Name) + If isInitializing Then Return + + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + + Dim selectedFontFamily As String = If(cmbFontFamily.SelectedItem, AktuelleRichTextBox.SelectionFont?.FontFamily.Name) Dim selectedFontSize As Single If Single.TryParse(cmbFontSize.SelectedItem, selectedFontSize) Then - ' Überprüfen, ob eine Auswahl vorhanden ist - If rtbZeile1.SelectionLength > 0 Then - ' Erstellen einer neuen Schriftart basierend auf der Auswahl - Dim currentFont As Font = rtbZeile1.SelectionFont - If currentFont IsNot Nothing Then - rtbZeile1.SelectionFont = New Font(selectedFontFamily, selectedFontSize, currentFont.Style) - Else - ' Wenn die Auswahl unterschiedliche Schriftarten hat, eine neue Schriftart setzen - rtbZeile1.SelectionFont = New Font(selectedFontFamily, selectedFontSize) - End If + ' Erstellen einer neuen Schriftart basierend auf der Auswahl + Dim currentFont As Font = AktuelleRichTextBox.SelectionFont + If currentFont IsNot Nothing Then + AktuelleRichTextBox.SelectionFont = New Font(selectedFontFamily, selectedFontSize, currentFont.Style) Else - ' Wenn keine Auswahl vorhanden ist, setzen Sie die Standard-Schriftart der RichTextBox - rtbZeile1.Font = New Font(selectedFontFamily, selectedFontSize, rtbZeile1.Font.Style) + ' Wenn die Auswahl unterschiedliche Schriftarten hat, eine neue Schriftart setzen + AktuelleRichTextBox.SelectionFont = New Font(selectedFontFamily, selectedFontSize) End If hatAenderung = True End If End Sub - ' Methode zum Umschalten des Schriftstils - Private Sub ToggleFontStyle(style As FontStyle) - If rtbZeile1.SelectionFont IsNot Nothing Then - Dim currentFont As Font = rtbZeile1.SelectionFont - Dim newFontStyle As FontStyle - - If rtbZeile1.SelectionFont.Style.HasFlag(style) Then - ' Entferne den Stil - newFontStyle = currentFont.Style And Not style - Else - ' Füge den Stil hinzu - newFontStyle = currentFont.Style Or style - End If - - ' Setze die neue Schriftart - rtbZeile1.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, newFontStyle) - hatAenderung = True - End If - End Sub - - ' Fett (Bold) Button Click Private Sub btnBold_Click(sender As Object, e As EventArgs) Handles btnBold.Click + If isInitializing Then Return ToggleFontStyle(FontStyle.Bold) End Sub - ' Kursiv (Italic) Button Click Private Sub btnItalic_Click(sender As Object, e As EventArgs) Handles btnItalic.Click + If isInitializing Then Return ToggleFontStyle(FontStyle.Italic) End Sub - ' Unterstrichen (Underline) Button Click Private Sub btnUnderline_Click(sender As Object, e As EventArgs) Handles btnUnderline.Click + If isInitializing Then Return ToggleFontStyle(FontStyle.Underline) End Sub - ' Textfarbe ändern Button Click Private Sub btnTextColor_Click(sender As Object, e As EventArgs) Handles btnTextColor.Click + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile1.SelectionColor = colorDialogText.Color - hatAenderung = True + AktuelleRichTextBox.SelectionColor = colorDialogText.Color End If End Sub - ' Hintergrundfarbe ändern Button Click Private Sub btnBackColor_Click(sender As Object, e As EventArgs) Handles btnBackColor.Click + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile1.SelectionBackColor = colorDialogText.Color - hatAenderung = True + AktuelleRichTextBox.SelectionBackColor = colorDialogText.Color End If End Sub - ' Links ausrichten Button Click Private Sub btnAlignLeft_Click(sender As Object, e As EventArgs) Handles btnAlignLeft.Click - rtbZeile1.SelectionAlignment = HorizontalAlignment.Left - hatAenderung = True + If isInitializing Then Return + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + AktuelleRichTextBox.SelectionAlignment = HorizontalAlignment.Left End Sub - ' Mitte ausrichten Button Click Private Sub btnAlignCenter_Click(sender As Object, e As EventArgs) Handles btnAlignCenter.Click - rtbZeile1.SelectionAlignment = HorizontalAlignment.Center - hatAenderung = True + If isInitializing Then Return + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + AktuelleRichTextBox.SelectionAlignment = HorizontalAlignment.Center End Sub - ' Rechts ausrichten Button Click Private Sub btnAlignRight_Click(sender As Object, e As EventArgs) Handles btnAlignRight.Click - rtbZeile1.SelectionAlignment = HorizontalAlignment.Right - hatAenderung = True - End Sub - - ' Schriftfamilie ComboBox SelectionChanged - Private Sub cmbFontFamily2_SelectedIndexChanged(sender As Object, e As EventArgs) - UpdateFont2() - End Sub - - ' Schriftgröße ComboBox SelectionChanged - Private Sub cmbFontSize2_SelectedIndexChanged(sender As Object, e As EventArgs) - UpdateFont2() - End Sub - - Private Sub UpdateFont2() - Dim selectedFontFamily As String = If(cmbFontFamily2.SelectedItem, rtbZeile2.SelectionFont?.FontFamily.Name) - Dim selectedFontSize As Single - If Single.TryParse(cmbFontSize2.SelectedItem, selectedFontSize) Then - ' Überprüfen, ob eine Auswahl vorhanden ist - If rtbZeile2.SelectionLength > 0 Then - ' Erstellen einer neuen Schriftart basierend auf der Auswahl - Dim currentFont As Font = rtbZeile2.SelectionFont - If currentFont IsNot Nothing Then - rtbZeile2.SelectionFont = New Font(selectedFontFamily, selectedFontSize, currentFont.Style) - Else - ' Wenn die Auswahl unterschiedliche Schriftarten hat, eine neue Schriftart setzen - rtbZeile2.SelectionFont = New Font(selectedFontFamily, selectedFontSize) - End If - Else - ' Wenn keine Auswahl vorhanden ist, setzen Sie die Standard-Schriftart der RichTextBox - rtbZeile2.Font = New Font(selectedFontFamily, selectedFontSize, rtbZeile2.Font.Style) - End If - hatAenderung = True + If isInitializing Then Return + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return End If + AktuelleRichTextBox.SelectionAlignment = HorizontalAlignment.Right End Sub - ' Methode zum Umschalten des Schriftstils - Private Sub ToggleFontStyle2(style As FontStyle) - If rtbZeile2.SelectionFont IsNot Nothing Then - Dim currentFont As Font = rtbZeile2.SelectionFont + Private Sub ToggleFontStyle(style As FontStyle) + If isInitializing Then Return + ' Nur anwenden, wenn tatsächlich etwas markiert ist + If AktuelleRichTextBox.SelectionLength <= 0 Then + Return + End If + + If AktuelleRichTextBox.SelectionFont IsNot Nothing Then + Dim currentFont As Font = AktuelleRichTextBox.SelectionFont Dim newFontStyle As FontStyle - If rtbZeile2.SelectionFont.Style.HasFlag(style) Then + If AktuelleRichTextBox.SelectionFont.Style.HasFlag(style) Then ' Entferne den Stil newFontStyle = currentFont.Style And Not style Else @@ -470,163 +608,18 @@ Public Class frmEintragTvNew End If ' Setze die neue Schriftart - rtbZeile2.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, newFontStyle) + AktuelleRichTextBox.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, newFontStyle) hatAenderung = True End If End Sub - ' Fett (Bold) Button Click - Private Sub btnBold2_Click(sender As Object, e As EventArgs) Handles btnBold2.Click - ToggleFontStyle2(FontStyle.Bold) - End Sub - - ' Kursiv (Italic) Button Click - Private Sub btnItalic2_Click(sender As Object, e As EventArgs) Handles btnItalic2.Click - ToggleFontStyle2(FontStyle.Italic) - End Sub - - ' Unterstrichen (Underline) Button Click - Private Sub btnUnderline2_Click(sender As Object, e As EventArgs) Handles btnUnderline2.Click - ToggleFontStyle2(FontStyle.Underline) - End Sub - - ' Textfarbe ändern Button Click - Private Sub btnTextColor2_Click(sender As Object, e As EventArgs) Handles btnTextColor2.Click - If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile2.SelectionColor = colorDialogText.Color - hatAenderung = True - End If - End Sub - - ' Hintergrundfarbe ändern Button Click - Private Sub btnBackColor2_Click(sender As Object, e As EventArgs) Handles btnBackColor2.Click - If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile2.SelectionBackColor = colorDialogText.Color - hatAenderung = True - End If - End Sub - - ' Links ausrichten Button Click - Private Sub btnAlignLeft2_Click(sender As Object, e As EventArgs) Handles btnAlignLeft2.Click - rtbZeile2.SelectionAlignment = HorizontalAlignment.Left - hatAenderung = True - End Sub - - ' Mitte ausrichten Button Click - Private Sub btnAlignCenter2_Click(sender As Object, e As EventArgs) Handles btnAlignCenter2.Click - rtbZeile2.SelectionAlignment = HorizontalAlignment.Center - hatAenderung = True - End Sub - - ' Rechts ausrichten Button Click - Private Sub btnAlignRight2_Click(sender As Object, e As EventArgs) Handles btnAlignRight2.Click - rtbZeile2.SelectionAlignment = HorizontalAlignment.Right - hatAenderung = True - End Sub - - ' Schriftfamilie ComboBox SelectionChanged - Private Sub cmbFontFamily3_SelectedIndexChanged(sender As Object, e As EventArgs) - UpdateFont3() - End Sub - - ' Schriftgröße ComboBox SelectionChanged - Private Sub cmbFontSize3_SelectedIndexChanged(sender As Object, e As EventArgs) - UpdateFont3() - End Sub - - Private Sub UpdateFont3() - Dim selectedFontFamily As String = If(cmbFontFamily3.SelectedItem, rtbZeile3.SelectionFont?.FontFamily.Name) - Dim selectedFontSize As Single - If Single.TryParse(cmbFontSize3.SelectedItem, selectedFontSize) Then - ' Überprüfen, ob eine Auswahl vorhanden ist - If rtbZeile3.SelectionLength > 0 Then - ' Erstellen einer neuen Schriftart basierend auf der Auswahl - Dim currentFont As Font = rtbZeile3.SelectionFont - If currentFont IsNot Nothing Then - rtbZeile3.SelectionFont = New Font(selectedFontFamily, selectedFontSize, currentFont.Style) - Else - ' Wenn die Auswahl unterschiedliche Schriftarten hat, eine neue Schriftart setzen - rtbZeile3.SelectionFont = New Font(selectedFontFamily, selectedFontSize) - End If - Else - ' Wenn keine Auswahl vorhanden ist, setzen Sie die Standard-Schriftart der RichTextBox - rtbZeile3.Font = New Font(selectedFontFamily, selectedFontSize, rtbZeile3.Font.Style) - End If - hatAenderung = True - End If - End Sub - - ' Methode zum Umschalten des Schriftstils - Private Sub ToggleFontStyle3(style As FontStyle) - If rtbZeile3.SelectionFont IsNot Nothing Then - Dim currentFont As Font = rtbZeile3.SelectionFont - Dim newFontStyle As FontStyle - - If rtbZeile3.SelectionFont.Style.HasFlag(style) Then - ' Entferne den Stil - newFontStyle = currentFont.Style And Not style - Else - ' Füge den Stil hinzu - newFontStyle = currentFont.Style Or style - End If - - ' Setze die neue Schriftart - rtbZeile3.SelectionFont = New Font(currentFont.FontFamily, currentFont.Size, newFontStyle) - hatAenderung = True - End If - End Sub - - ' Fett (Bold) Button Click - Private Sub btnBold3_Click(sender As Object, e As EventArgs) Handles btnBold3.Click - ToggleFontStyle3(FontStyle.Bold) - End Sub - - ' Kursiv (Italic) Button Click - Private Sub btnItalic3_Click(sender As Object, e As EventArgs) Handles btnItalic3.Click - ToggleFontStyle3(FontStyle.Italic) - End Sub - - ' Unterstrichen (Underline) Button Click - Private Sub btnUnderline3_Click(sender As Object, e As EventArgs) Handles btnUnderline3.Click - ToggleFontStyle3(FontStyle.Underline) - End Sub - - ' Textfarbe ändern Button Click - Private Sub btnTextColor3_Click(sender As Object, e As EventArgs) Handles btnTextColor3.Click - If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile3.SelectionColor = colorDialogText.Color - hatAenderung = True - End If - End Sub - - ' Hintergrundfarbe ändern Button Click - Private Sub btnBackColor3_Click(sender As Object, e As EventArgs) Handles btnBackColor3.Click - If colorDialogText.ShowDialog() = DialogResult.OK Then - rtbZeile3.SelectionBackColor = colorDialogText.Color - hatAenderung = True - End If - End Sub - - ' Links ausrichten Button Click - Private Sub btnAlignLeft3_Click(sender As Object, e As EventArgs) Handles btnAlignLeft3.Click - rtbZeile3.SelectionAlignment = HorizontalAlignment.Left - hatAenderung = True - End Sub - - ' Mitte ausrichten Button Click - Private Sub btnAlignCenter3_Click(sender As Object, e As EventArgs) Handles btnAlignCenter3.Click - rtbZeile3.SelectionAlignment = HorizontalAlignment.Center - hatAenderung = True - End Sub - - ' Rechts ausrichten Button Click - Private Sub btnAlignRight3_Click(sender As Object, e As EventArgs) Handles btnAlignRight3.Click - rtbZeile3.SelectionAlignment = HorizontalAlignment.Right - hatAenderung = True - End Sub Private Sub LadeTvTextBezeichnungen() isInitializing = True + + ' Event-Handler entfernen, um zu verhindern, dass SelectedIndexChanged zu früh feuert + RemoveHandler cmbTvTextBezeichnungAuswahl.SelectedIndexChanged, AddressOf cmbTvTextBezeichnungAuswahl_SelectedIndexChanged + Dim bezeichnungen As New List(Of cTvTextBezeichnung)() Try @@ -634,32 +627,34 @@ Public Class frmEintragTvNew Catch ex As Exception MessageBox.Show("Fehler beim Laden der TvTextBezeichnungen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error) isInitializing = False + ' Event-Handler wieder hinzufügen, bevor wir verlassen + AddHandler cmbTvTextBezeichnungAuswahl.SelectedIndexChanged, AddressOf cmbTvTextBezeichnungAuswahl_SelectedIndexChanged Return End Try Dim items As New List(Of ComboBoxItem)() - For Each bezeichnung In bezeichnungen items.Add(New ComboBoxItem() With { - .ID = bezeichnung.TvTextBezeichnungID, - .DisplayText = bezeichnung.TvTextBezeichnung - }) + .ID = bezeichnung.TvTextBezeichnungID, + .DisplayText = bezeichnung.TvTextBezeichnung + }) Next + cmbTvTextBezeichnungAuswahl.DataSource = Nothing cmbTvTextBezeichnungAuswahl.DataSource = items cmbTvTextBezeichnungAuswahl.DisplayMember = "DisplayText" cmbTvTextBezeichnungAuswahl.ValueMember = "ID" cmbTvTextBezeichnungAuswahl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList cmbTvTextBezeichnungAuswahl.SelectedIndex = -1 cmbPosition.SelectedIndex = -1 + isInitializing = False - Debug.WriteLine("TvTextBezeichnungen geladen:") - For Each item In items - Debug.WriteLine($"ID: {item.ID}, Text: {item.DisplayText}") - Next + ' Event-Handler jetzt, nachdem alles fertig ist, wieder hinzufügen + AddHandler cmbTvTextBezeichnungAuswahl.SelectedIndexChanged, AddressOf cmbTvTextBezeichnungAuswahl_SelectedIndexChanged End Sub + Private Sub txtNeueTvTextBezeichnung_TextChanged(sender As Object, e As EventArgs) Handles txtNeueTvTextBezeichnung.TextChanged If Not String.IsNullOrWhiteSpace(txtNeueTvTextBezeichnung.Text) Then cmbTvTextBezeichnungAuswahl.SelectedIndex = -1 @@ -731,7 +726,6 @@ Public Class frmEintragTvNew chkIsActive.Checked = aviso.IsActive - grpWochentage.Enabled = chkIsRecurring.Checked End Sub @@ -740,138 +734,110 @@ Public Class frmEintragTvNew rtb.Rtf = rtf Dim sb As New System.Text.StringBuilder() - ' Initialisiere die HTML-Struktur - sb.Append("") - - ' Teile den Text in Absätze auf - Dim paragraphs As String() = rtb.Text.Split(New String() {vbCrLf, vbLf}, StringSplitOptions.None) - + Dim defaultFont As System.Drawing.Font = rtb.Font + Dim totalLength As Integer = rtb.TextLength Dim charIndex As Integer = 0 - For Each paragraph As String In paragraphs - ' Wähle den aktuellen Absatz aus - rtb.Select(charIndex, paragraph.Length) + While charIndex < totalLength + ' Wähle das aktuelle Zeichen aus + rtb.Select(charIndex, 1) - ' Erhalte die Ausrichtung des aktuellen Absatzes - Dim alignment As HorizontalAlignment = rtb.SelectionAlignment + ' Hole die Formatierung des aktuellen Zeichens + Dim startFont As System.Drawing.Font = rtb.SelectionFont + Dim startColor As Color = rtb.SelectionColor + Dim startBackColor As Color = rtb.SelectionBackColor + Dim startAlignment As HorizontalAlignment = rtb.SelectionAlignment - ' Öffne einen Div-Tag mit der entsprechenden Textausrichtung - Select Case alignment - Case HorizontalAlignment.Left - sb.Append("
") - Case HorizontalAlignment.Center - sb.Append("
") - Case HorizontalAlignment.Right - sb.Append("
") - Case Else - sb.Append("
") - End Select + If startFont Is Nothing Then + startFont = defaultFont + End If - ' Setze die aktuellen Formatierungsvariablen auf Nothing/Empty, um beim ersten Zeichen zu starten - Dim currentFont As System.Drawing.Font = Nothing - Dim currentColor As Color = Color.Empty - Dim currentBackColor As Color = Color.Empty - Dim currentBold As Boolean = False - Dim currentItalic As Boolean = False - Dim currentUnderline As Boolean = False + ' Initialisiere die Lauf-Länge + Dim runLength As Integer = 1 - ' Iteriere durch die Zeichen im Absatz - For i As Integer = 0 To paragraph.Length - 1 - Dim globalIndex As Integer = charIndex + i - rtb.Select(globalIndex, 1) - Dim font As System.Drawing.Font = rtb.SelectionFont - Dim color As Color = rtb.SelectionColor - Dim backColor As Color = rtb.SelectionBackColor + ' Finde die Länge des Laufs + While (charIndex + runLength < totalLength) + rtb.Select(charIndex + runLength, 1) + Dim currentFont As System.Drawing.Font = rtb.SelectionFont + Dim currentColor As Color = rtb.SelectionColor + Dim currentBackColor As Color = rtb.SelectionBackColor + Dim currentAlignment As HorizontalAlignment = rtb.SelectionAlignment - ' Bestimme die Schriftstile - Dim isBold As Boolean = font IsNot Nothing AndAlso font.Bold - Dim isItalic As Boolean = font IsNot Nothing AndAlso font.Italic - Dim isUnderline As Boolean = font IsNot Nothing AndAlso font.Underline - - ' Überprüfe, ob sich die Formatierung geändert hat - If font IsNot currentFont OrElse color <> currentColor OrElse backColor <> currentBackColor OrElse isBold <> currentBold OrElse isItalic <> currentItalic OrElse isUnderline <> currentUnderline Then - ' Schließe vorherige Font-, Farb- und Hintergrundfarb-Tags - If currentFont IsNot Nothing OrElse color <> Color.Empty OrElse backColor <> Color.Empty OrElse currentBold OrElse currentItalic OrElse currentUnderline Then - sb.Append("") - End If - - ' Öffne ein neues Span-Tag mit den aktuellen Stilen - Dim style As New System.Text.StringBuilder() - - If font IsNot Nothing Then - style.Append($"font-family:{font.FontFamily.Name}; ") - style.Append($"font-size:{font.SizeInPoints}pt; ") - End If - - If color <> Color.Empty Then - style.Append($"color:{ColorTranslator.ToHtml(color)}; ") - End If - - If backColor <> Color.Empty Then - style.Append($"background-color:{ColorTranslator.ToHtml(backColor)}; ") - End If - - If isBold Then - style.Append($"font-weight:bold; ") - End If - - If isItalic Then - style.Append($"font-style:italic; ") - End If - - If isUnderline Then - style.Append($"text-decoration:underline; ") - End If - - If style.Length > 0 Then - sb.Append($"") - End If - - ' Aktualisiere die aktuellen Formatierungsvariablen - currentFont = font - currentColor = color - currentBackColor = backColor - currentBold = isBold - currentItalic = isItalic - currentUnderline = isUnderline + If currentFont Is Nothing Then + currentFont = defaultFont End If - ' Füge das aktuelle Zeichen hinzu (HTML-encodiert) - Dim currentChar As Char = paragraph(i) - Select Case currentChar - Case "<" - sb.Append("<") - Case ">" - sb.Append(">") - Case "&" - sb.Append("&") - Case Else - sb.Append(currentChar) - End Select - Next + ' Überprüfe, ob die Formatierung gleich ist + If Not FontsAreEqual(startFont, currentFont) OrElse + startColor <> currentColor OrElse + startBackColor <> currentBackColor OrElse + startAlignment <> currentAlignment Then + Exit While + End If - ' Schließe verbleibende Tags im Absatz - If currentFont IsNot Nothing OrElse currentColor <> Color.Empty OrElse currentBackColor <> Color.Empty OrElse currentBold OrElse currentItalic OrElse currentUnderline Then - sb.Append("") + runLength += 1 + End While + + ' Hole den Text des Laufs + Dim runText As String = rtb.Text.Substring(charIndex, runLength) + Dim style As New System.Text.StringBuilder() + + Select Case startAlignment + Case HorizontalAlignment.Left + ' nichts hinzufügen, da Standard + Case HorizontalAlignment.Center + style.Append("text-align:center;") + Case HorizontalAlignment.Right + style.Append("text-align:right;") + End Select + + If startFont IsNot Nothing Then + style.Append($"font-family:{startFont.FontFamily.Name};") + style.Append($"font-size:{startFont.SizeInPoints}pt;") + If startFont.Bold Then + style.Append("font-weight:bold;") + End If + If startFont.Italic Then + style.Append("font-style:italic;") + End If + If startFont.Underline Then + style.Append("text-decoration:underline;") + End If End If - ' Schließe den Div-Tag für den Absatz + If startColor <> Color.Empty Then + style.Append($"color:{ColorTranslator.ToHtml(startColor)};") + End If + + If startBackColor <> Color.Empty Then + style.Append($"background-color:{ColorTranslator.ToHtml(startBackColor)};") + End If + + If style.Length > 0 Then + sb.Append($"
") + Else + sb.Append("
") + End If + + Dim encodedText As String = System.Net.WebUtility.HtmlEncode(runText) + sb.Append(encodedText) + sb.Append("
") - ' Aktualisiere den charIndex für den nächsten Absatz (+2 für vbCrLf, könnte je nach Zeilenumbrüchen variieren) - ' Überprüfe den tatsächlichen Zeilenumbruch und passe gegebenenfalls an - If charIndex + paragraph.Length + 2 <= rtb.Text.Length Then - charIndex += paragraph.Length + 2 ' Annahme: \r\n als Zeilenumbruch - Else - charIndex += paragraph.Length - End If - Next + charIndex += runLength + End While - sb.Append("") Return sb.ToString() End Using End Function + Private Function FontsAreEqual(font1 As System.Drawing.Font, font2 As System.Drawing.Font) As Boolean + Return font1.FontFamily.Name = font2.FontFamily.Name AndAlso + font1.SizeInPoints = font2.SizeInPoints AndAlso + font1.Style = font2.Style + End Function + + Private Sub btnSpeichern_Click(sender As Object, e As EventArgs) Handles btnSpeichern.Click Dim verwendeteTvTextBezeichnung As String = "" Dim isNeueTvTextBezeichnung As Boolean = False @@ -978,12 +944,12 @@ Public Class frmEintragTvNew list.Clear() AvisoTvNewDAL.LesenAvisoTvNew(0, "", currentStandort, list) - ' **Nach dem Speichern und Neuladen der Daten** + ' Nach dem Speichern und Neuladen der Daten initdgv() hatAenderung = False If isNeueTvTextBezeichnung Then - ' **Setze lastSelectedTVID auf die TVID des neuen Eintrags** + ' Setze lastSelectedTVID auf die TVID des neuen Eintrags lastSelectedTVID = myAvisoTvNew.TvTextBezeichnungID MessageBox.Show("Die neue TvTextBezeichnung wurde erfolgreich gespeichert.", "Erfolg", MessageBoxButtons.OK, MessageBoxIcon.Information) cmbTvTextBezeichnungAuswahl.SelectedValue = myAvisoTvNew.TvTextBezeichnungID @@ -1009,7 +975,7 @@ Public Class frmEintragTvNew AvisoTvNewDAL.SetzeAufInaktiv(myAvisoTvNew.TvTextBezeichnungID) list.Clear() AvisoTvNewDAL.LesenAvisoTvNew(0, "", cbxStandort.SelectedItem?.ToString(), list) - initdgv() + initdgv() ' Verwende jetzt die parameterlose Methode ClearFields() myAvisoTvNew = Nothing Neuanlage = False @@ -1057,6 +1023,22 @@ Public Class frmEintragTvNew grpWochentage.Enabled = chkIsRecurring.Checked End Sub + Private ReadOnly Property AktuelleRichTextBox As RichTextBox + Get + Select Case tabControlZeilen.SelectedIndex + Case 0 + Return rtbZeile1 + Case 1 + Return rtbZeile2 + Case 2 + Return rtbZeile3 + Case Else + Return rtbZeile1 + End Select + End Get + End Property + + Private Sub ClearFields() cmbTvTextBezeichnungAuswahl.SelectedIndex = -1 cmbPosition.SelectedIndex = -1 diff --git a/Aviso/frmTvSettings.Designer.vb b/Aviso/frmTvSettings.Designer.vb new file mode 100644 index 0000000..8d41e74 --- /dev/null +++ b/Aviso/frmTvSettings.Designer.vb @@ -0,0 +1,286 @@ + +Partial Class frmTvSettings + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + + 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 + + 'Die folgenden Steuerelemente werden benötigt. + Private WithEvents lblTileWidth As Label + Private WithEvents lblTileHeight As Label + Private WithEvents lblFontSizeLkwNummer As Label + Private WithEvents lblFontSizeDateTime As Label + Private WithEvents lblSeitenwechsel As Label + Private WithEvents lblTextBalkenHeight As Label ' Neues Label + Private WithEvents lblLogoSelection As Label ' Neues Label für Logo-Auswahl + Private WithEvents numTileWidth As NumericUpDown + Private WithEvents numTileHeight As NumericUpDown + Private WithEvents numFontSizeLkwNummer As NumericUpDown + Private WithEvents numFontSizeDateTime As NumericUpDown + Private WithEvents numSeitenwechsel As NumericUpDown + Private WithEvents numTextBalkenHeight As NumericUpDown ' Neues NumericUpDown + 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. + + Private Sub InitializeComponent() + Me.lblTileWidth = New System.Windows.Forms.Label() + Me.lblTileHeight = New System.Windows.Forms.Label() + Me.lblFontSizeLkwNummer = New System.Windows.Forms.Label() + Me.lblFontSizeDateTime = New System.Windows.Forms.Label() + Me.lblSeitenwechsel = New System.Windows.Forms.Label() + Me.lblTextBalkenHeight = New System.Windows.Forms.Label() + Me.lblLogoSelection = New System.Windows.Forms.Label() + Me.numTileWidth = New System.Windows.Forms.NumericUpDown() + Me.numTileHeight = New System.Windows.Forms.NumericUpDown() + Me.numFontSizeLkwNummer = New System.Windows.Forms.NumericUpDown() + Me.numFontSizeDateTime = New System.Windows.Forms.NumericUpDown() + Me.numSeitenwechsel = New System.Windows.Forms.NumericUpDown() + Me.numTextBalkenHeight = New System.Windows.Forms.NumericUpDown() + Me.cmbLogoSelection = New System.Windows.Forms.ComboBox() + Me.btnSave = New System.Windows.Forms.Button() + Me.numKachelRowGapInPercent = New System.Windows.Forms.NumericUpDown() + Me.Label1 = New System.Windows.Forms.Label() + CType(Me.numTileWidth, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numTileHeight, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numFontSizeLkwNummer, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numFontSizeDateTime, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numSeitenwechsel, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numTextBalkenHeight, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.numKachelRowGapInPercent, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'lblTileWidth + ' + Me.lblTileWidth.AutoSize = True + Me.lblTileWidth.Location = New System.Drawing.Point(22, 66) + Me.lblTileWidth.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblTileWidth.Name = "lblTileWidth" + Me.lblTileWidth.Size = New System.Drawing.Size(87, 13) + Me.lblTileWidth.TabIndex = 0 + Me.lblTileWidth.Text = "Kachel Breite (%)" + ' + 'lblTileHeight + ' + Me.lblTileHeight.AutoSize = True + Me.lblTileHeight.Location = New System.Drawing.Point(21, 27) + Me.lblTileHeight.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblTileHeight.Name = "lblTileHeight" + Me.lblTileHeight.Size = New System.Drawing.Size(86, 13) + Me.lblTileHeight.TabIndex = 1 + Me.lblTileHeight.Text = "Kachel Höhe (%)" + ' + 'lblFontSizeLkwNummer + ' + Me.lblFontSizeLkwNummer.AutoSize = True + Me.lblFontSizeLkwNummer.Location = New System.Drawing.Point(21, 151) + Me.lblFontSizeLkwNummer.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblFontSizeLkwNummer.Name = "lblFontSizeLkwNummer" + Me.lblFontSizeLkwNummer.Size = New System.Drawing.Size(133, 13) + Me.lblFontSizeLkwNummer.TabIndex = 2 + Me.lblFontSizeLkwNummer.Text = "Schriftgröße LKW Nummer" + ' + 'lblFontSizeDateTime + ' + Me.lblFontSizeDateTime.AutoSize = True + Me.lblFontSizeDateTime.Location = New System.Drawing.Point(21, 191) + Me.lblFontSizeDateTime.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblFontSizeDateTime.Name = "lblFontSizeDateTime" + Me.lblFontSizeDateTime.Size = New System.Drawing.Size(121, 13) + Me.lblFontSizeDateTime.TabIndex = 3 + Me.lblFontSizeDateTime.Text = "Schriftgröße Datum/Zeit" + ' + 'lblSeitenwechsel + ' + Me.lblSeitenwechsel.AutoSize = True + Me.lblSeitenwechsel.Location = New System.Drawing.Point(21, 232) + Me.lblSeitenwechsel.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblSeitenwechsel.Name = "lblSeitenwechsel" + Me.lblSeitenwechsel.Size = New System.Drawing.Size(134, 13) + Me.lblSeitenwechsel.TabIndex = 4 + Me.lblSeitenwechsel.Text = "Seitenwechsel (Sekunden)" + ' + 'lblTextBalkenHeight + ' + Me.lblTextBalkenHeight.AutoSize = True + Me.lblTextBalkenHeight.Location = New System.Drawing.Point(21, 273) + Me.lblTextBalkenHeight.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.lblTextBalkenHeight.Name = "lblTextBalkenHeight" + Me.lblTextBalkenHeight.Size = New System.Drawing.Size(110, 13) + Me.lblTextBalkenHeight.TabIndex = 5 + Me.lblTextBalkenHeight.Text = "Text Balken Höhe (%)" + ' + 'lblLogoSelection + ' + Me.lblLogoSelection.AutoSize = True + Me.lblLogoSelection.Location = New System.Drawing.Point(21, 313) + 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) + Me.lblLogoSelection.TabIndex = 13 + Me.lblLogoSelection.Text = "Logo auswählen" + ' + 'numTileWidth + ' + Me.numTileWidth.DecimalPlaces = 2 + Me.numTileWidth.Location = New System.Drawing.Point(165, 66) + Me.numTileWidth.Margin = New System.Windows.Forms.Padding(2) + Me.numTileWidth.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numTileWidth.Name = "numTileWidth" + Me.numTileWidth.Size = New System.Drawing.Size(90, 20) + Me.numTileWidth.TabIndex = 6 + Me.numTileWidth.Value = New Decimal(New Integer() {30, 0, 0, 0}) + ' + 'numTileHeight + ' + Me.numTileHeight.DecimalPlaces = 2 + Me.numTileHeight.Location = New System.Drawing.Point(164, 25) + Me.numTileHeight.Margin = New System.Windows.Forms.Padding(2) + Me.numTileHeight.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numTileHeight.Name = "numTileHeight" + Me.numTileHeight.Size = New System.Drawing.Size(90, 20) + Me.numTileHeight.TabIndex = 7 + Me.numTileHeight.Value = New Decimal(New Integer() {30, 0, 0, 0}) + ' + 'numFontSizeLkwNummer + ' + Me.numFontSizeLkwNummer.DecimalPlaces = 2 + Me.numFontSizeLkwNummer.Location = New System.Drawing.Point(164, 149) + Me.numFontSizeLkwNummer.Margin = New System.Windows.Forms.Padding(2) + Me.numFontSizeLkwNummer.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numFontSizeLkwNummer.Name = "numFontSizeLkwNummer" + Me.numFontSizeLkwNummer.Size = New System.Drawing.Size(90, 20) + Me.numFontSizeLkwNummer.TabIndex = 8 + Me.numFontSizeLkwNummer.Value = New Decimal(New Integer() {12, 0, 0, 0}) + ' + 'numFontSizeDateTime + ' + Me.numFontSizeDateTime.DecimalPlaces = 2 + Me.numFontSizeDateTime.Location = New System.Drawing.Point(164, 190) + Me.numFontSizeDateTime.Margin = New System.Windows.Forms.Padding(2) + Me.numFontSizeDateTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numFontSizeDateTime.Name = "numFontSizeDateTime" + Me.numFontSizeDateTime.Size = New System.Drawing.Size(90, 20) + Me.numFontSizeDateTime.TabIndex = 9 + Me.numFontSizeDateTime.Value = New Decimal(New Integer() {12, 0, 0, 0}) + ' + 'numSeitenwechsel + ' + Me.numSeitenwechsel.Location = New System.Drawing.Point(164, 230) + Me.numSeitenwechsel.Margin = New System.Windows.Forms.Padding(2) + Me.numSeitenwechsel.Maximum = New Decimal(New Integer() {3600, 0, 0, 0}) + Me.numSeitenwechsel.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numSeitenwechsel.Name = "numSeitenwechsel" + Me.numSeitenwechsel.Size = New System.Drawing.Size(90, 20) + Me.numSeitenwechsel.TabIndex = 10 + Me.numSeitenwechsel.Value = New Decimal(New Integer() {30, 0, 0, 0}) + ' + 'numTextBalkenHeight + ' + Me.numTextBalkenHeight.DecimalPlaces = 2 + Me.numTextBalkenHeight.Location = New System.Drawing.Point(164, 271) + Me.numTextBalkenHeight.Margin = New System.Windows.Forms.Padding(2) + Me.numTextBalkenHeight.Name = "numTextBalkenHeight" + Me.numTextBalkenHeight.Size = New System.Drawing.Size(90, 20) + Me.numTextBalkenHeight.TabIndex = 11 + Me.numTextBalkenHeight.Value = New Decimal(New Integer() {30, 0, 0, 0}) + ' + 'cmbLogoSelection + ' + Me.cmbLogoSelection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cmbLogoSelection.FormattingEnabled = True + Me.cmbLogoSelection.Location = New System.Drawing.Point(164, 311) + Me.cmbLogoSelection.Margin = New System.Windows.Forms.Padding(2) + Me.cmbLogoSelection.Name = "cmbLogoSelection" + Me.cmbLogoSelection.Size = New System.Drawing.Size(91, 21) + Me.cmbLogoSelection.TabIndex = 14 + ' + 'btnSave + ' + Me.btnSave.Location = New System.Drawing.Point(164, 346) + Me.btnSave.Margin = New System.Windows.Forms.Padding(2) + Me.btnSave.Name = "btnSave" + Me.btnSave.Size = New System.Drawing.Size(90, 24) + Me.btnSave.TabIndex = 15 + Me.btnSave.Text = "Speichern" + Me.btnSave.UseVisualStyleBackColor = True + ' + 'numKachelRowGapInPercent + ' + Me.numKachelRowGapInPercent.DecimalPlaces = 2 + Me.numKachelRowGapInPercent.Location = New System.Drawing.Point(164, 106) + Me.numKachelRowGapInPercent.Margin = New System.Windows.Forms.Padding(2) + Me.numKachelRowGapInPercent.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.numKachelRowGapInPercent.Name = "numKachelRowGapInPercent" + Me.numKachelRowGapInPercent.Size = New System.Drawing.Size(90, 20) + Me.numKachelRowGapInPercent.TabIndex = 17 + Me.numKachelRowGapInPercent.Value = New Decimal(New Integer() {12, 0, 0, 0}) + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(21, 108) + Me.Label1.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(123, 13) + Me.Label1.TabIndex = 16 + Me.Label1.Text = "Abstand Kachel Text (%)" + ' + 'frmTvSettings + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(306, 409) + Me.Controls.Add(Me.numKachelRowGapInPercent) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.btnSave) + Me.Controls.Add(Me.cmbLogoSelection) + Me.Controls.Add(Me.numTextBalkenHeight) + Me.Controls.Add(Me.numSeitenwechsel) + Me.Controls.Add(Me.numFontSizeDateTime) + Me.Controls.Add(Me.numFontSizeLkwNummer) + Me.Controls.Add(Me.numTileHeight) + Me.Controls.Add(Me.numTileWidth) + Me.Controls.Add(Me.lblLogoSelection) + Me.Controls.Add(Me.lblTextBalkenHeight) + Me.Controls.Add(Me.lblSeitenwechsel) + Me.Controls.Add(Me.lblFontSizeDateTime) + Me.Controls.Add(Me.lblFontSizeLkwNummer) + Me.Controls.Add(Me.lblTileHeight) + Me.Controls.Add(Me.lblTileWidth) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.Margin = New System.Windows.Forms.Padding(2) + Me.MaximizeBox = False + Me.Name = "frmTvSettings" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "TV Einstellungen" + CType(Me.numTileWidth, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numTileHeight, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numFontSizeLkwNummer, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numFontSizeDateTime, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numSeitenwechsel, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numTextBalkenHeight, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.numKachelRowGapInPercent, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Private WithEvents numKachelRowGapInPercent As NumericUpDown + Private WithEvents Label1 As Label +End Class diff --git a/Aviso/frmTvSettings.resx b/Aviso/frmTvSettings.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Aviso/frmTvSettings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Aviso/frmTvSettings.vb b/Aviso/frmTvSettings.vb new file mode 100644 index 0000000..2d58d38 --- /dev/null +++ b/Aviso/frmTvSettings.vb @@ -0,0 +1,139 @@ +Imports System.Data.SqlClient +Imports AVISO.frmEintragTvNew +Imports VERAG_PROG_ALLGEMEIN + +Partial Class frmTvSettings + Inherits System.Windows.Forms.Form + + Private standortID As Integer + Private AvisoTvNewDAL As New cAvisoTvNewDAL() + Private list As New List(Of cAvisoTvNew)() + + Public Sub New(standortID As Integer) + InitializeComponent() + Me.standortID = standortID + End Sub + + ' Ereignis-Handler für das Laden des Formulars + Private Sub frmTvSettings_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + ' Einstellungen aus der Datenbank laden + Dim settingsList As List(Of cTvSettings) = AvisoTvNewDAL.GetTvSettingsByStandort(standortID) + + ' ComboBox initialisieren + InitializeComboBox() + + If settingsList IsNot Nothing AndAlso settingsList.Count > 0 Then + Dim settings As cTvSettings = settingsList(0) + numTileWidth.Value = If(settings.KachelWidthInPercent >= numTileWidth.Minimum AndAlso settings.KachelWidthInPercent <= numTileWidth.Maximum, CDec(settings.KachelWidthInPercent), 30) + numTileHeight.Value = If(settings.KachelHeightInPercent >= numTileHeight.Minimum AndAlso settings.KachelHeightInPercent <= numTileHeight.Maximum, CDec(settings.KachelHeightInPercent), 30) + numFontSizeLkwNummer.Value = If(settings.KachelFontSizeLkwNummer >= numFontSizeLkwNummer.Minimum AndAlso settings.KachelFontSizeLkwNummer <= numFontSizeLkwNummer.Maximum, CDec(settings.KachelFontSizeLkwNummer), 12) + numFontSizeDateTime.Value = If(settings.KachelFontSizeDateTime >= numFontSizeDateTime.Minimum AndAlso settings.KachelFontSizeDateTime <= numFontSizeDateTime.Maximum, CDec(settings.KachelFontSizeDateTime), 12) + numSeitenwechsel.Value = If(settings.SeitenwechselInSek >= numSeitenwechsel.Minimum AndAlso settings.SeitenwechselInSek <= numSeitenwechsel.Maximum, CDec(settings.SeitenwechselInSek), 30) + numTextBalkenHeight.Value = If(settings.TextBalkenHeightInPercent >= numTextBalkenHeight.Minimum AndAlso settings.TextBalkenHeightInPercent <= numTextBalkenHeight.Maximum, CDec(settings.TextBalkenHeightInPercent), 30) + numKachelRowGapInPercent.Value = If(settings.KachelRowGapInPercent >= numKachelRowGapInPercent.Minimum AndAlso settings.KachelRowGapInPercent <= numKachelRowGapInPercent.Maximum, CDec(settings.KachelRowGapInPercent), 15) + + ' Logo-Auswahl setzen + cmbLogoSelection.SelectedValue = settings.SelectedLogoValue + + ' Überprüfen, ob die Auswahl erfolgreich war + If cmbLogoSelection.SelectedValue Is Nothing Then + ' Wenn nicht, setze auf den ersten Eintrag + cmbLogoSelection.SelectedIndex = 0 + End If + Else + ' Standardwerte verwenden, falls keine Einstellungen vorhanden sind + SetDefaultValues() + End If + Catch ex As Exception + MessageBox.Show("Fehler beim Laden der Einstellungen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error) + SetDefaultValues() + End Try + End Sub + + ' Klasse für ComboBox-Elemente + Public Class ComboBoxItem + Public Property Display As String + Public Property Value As String + + Public Sub New(display As String, value As String) + Me.Display = display + Me.Value = value + End Sub + + Public Overrides Function ToString() As String + Return Display + End Function + End Class + + ' 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"), + New ComboBoxItem("ATILLA TÜRKIYE", "atilla_turkiye.jpg"), + New ComboBoxItem("FRONTOFFICE_SUBEN", "frontoffice_suben.jpg"), + New ComboBoxItem("IMEX", "imex.png"), + 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 + End Sub + + ' Methode zum Setzen der Standardwerte + Private Sub SetDefaultValues() + numTileWidth.Value = 30 + numTileHeight.Value = 30 + numFontSizeLkwNummer.Value = 12 + numFontSizeDateTime.Value = 12 + numSeitenwechsel.Value = 30 + numTextBalkenHeight.Value = 30 + numKachelRowGapInPercent.Value = 15 + + ' Sicherstellen, dass die ComboBox initialisiert ist + If cmbLogoSelection.Items.Count > 0 Then + cmbLogoSelection.SelectedIndex = 0 + End If + 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) + + Dim settings As New cTvSettings() With { + .StandortID = standortID, + .KachelWidthInPercent = CDbl(numTileWidth.Value), + .KachelHeightInPercent = CDbl(numTileHeight.Value), + .KachelFontSizeLkwNummer = CDbl(numFontSizeLkwNummer.Value), + .KachelFontSizeDateTime = CDbl(numFontSizeDateTime.Value), + .SeitenwechselInSek = CDbl(numSeitenwechsel.Value), + .TextBalkenHeightInPercent = CDbl(numTextBalkenHeight.Value), + .KachelRowGapInPercent = CDbl(numKachelRowGapInPercent.Value), + .SelectedLogoValue = selectedValue ' Stellen Sie sicher, dass diese Eigenschaft in cTvSettings existiert + } + + ' Einstellungen in der Datenbank speichern + AvisoTvNewDAL.SaveTvSettings(settings) + + MessageBox.Show("Einstellungen wurden erfolgreich gespeichert!", "Erfolg", MessageBoxButtons.OK, MessageBoxIcon.Information) + Me.Close() + Catch ex As Exception + MessageBox.Show("Fehler beim Speichern der Einstellungen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + +End Class diff --git a/AvisoTV/frmAnzeige.vb b/AvisoTV/frmAnzeige.vb index 13686d6..f1588af 100644 --- a/AvisoTV/frmAnzeige.vb +++ b/AvisoTV/frmAnzeige.vb @@ -394,7 +394,7 @@ Public Class frmAnzeige r.Cells(0).Style.Font = Font1_MESS Dim doimage As Image = Nothing Select Case r.Cells(0).Value.ToString - Case "PASSPORT" : doimage = My.Resources.passport : r.Cells(0).Value = "PASSPORT" ' r.Cells(0).Value = "PASS" + Case ",pn" : doimage = My.Resources.passport : r.Cells(0).Value = "PASSPORT" ' r.Cells(0).Value = "PASS" Case "DOKUMENT" : doimage = My.Resources.passport : r.Cells(0).Value = "PROBLEM" ' r.Cells(0).Value = "PASS" Case "URGENT" : doimage = My.Resources.urgent_qu : r.Cells(0).Value = "PROBLEM" End Select