From ce979fb82e37ac4202d9c9b0e9bd757a69b7ec39 Mon Sep 17 00:00:00 2001 From: Melissa Date: Sun, 6 Oct 2019 08:54:02 +0100 Subject: [PATCH] Database validation is required again when Validate DB Settings button is clicked --- DiscordBot/frmConfigure.Designer.cs | 26 +++++++++++++------------- DiscordBot/frmConfigure.cs | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/DiscordBot/frmConfigure.Designer.cs b/DiscordBot/frmConfigure.Designer.cs index ebb4ac9..bcb1fb9 100644 --- a/DiscordBot/frmConfigure.Designer.cs +++ b/DiscordBot/frmConfigure.Designer.cs @@ -41,7 +41,7 @@ private void InitializeComponent() this.txtBotToken = new System.Windows.Forms.TextBox(); this.panel2 = new System.Windows.Forms.Panel(); this.label16 = new System.Windows.Forms.Label(); - this.label15 = new System.Windows.Forms.Label(); + this.lblDatabaseName = new System.Windows.Forms.Label(); this.txtDbPass = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.txtDbUser = new System.Windows.Forms.TextBox(); @@ -163,7 +163,7 @@ private void InitializeComponent() this.panel2.BackColor = System.Drawing.Color.LavenderBlush; this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel2.Controls.Add(this.label16); - this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.lblDatabaseName); this.panel2.Controls.Add(this.txtDbPass); this.panel2.Controls.Add(this.label12); this.panel2.Controls.Add(this.txtDbUser); @@ -190,14 +190,14 @@ private void InitializeComponent() "e enter the details to your server below."; this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label15 + // lblDatabaseName // - this.label15.Location = new System.Drawing.Point(3, 126); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(277, 20); - this.label15.TabIndex = 17; - this.label15.Text = "Database Name:"; - this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.lblDatabaseName.Location = new System.Drawing.Point(3, 126); + this.lblDatabaseName.Name = "lblDatabaseName"; + this.lblDatabaseName.Size = new System.Drawing.Size(277, 20); + this.lblDatabaseName.TabIndex = 17; + this.lblDatabaseName.Text = "Database Name:"; + this.lblDatabaseName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // txtDbPass // @@ -456,7 +456,7 @@ private void InitializeComponent() // toolStripStatusLabel3 // this.toolStripStatusLabel3.Name = "toolStripStatusLabel3"; - this.toolStripStatusLabel3.Size = new System.Drawing.Size(31, 17); + this.toolStripStatusLabel3.Size = new System.Drawing.Size(46, 17); this.toolStripStatusLabel3.Spring = true; // // toolStripStatusLabel4 @@ -485,7 +485,7 @@ private void InitializeComponent() // toolStripStatusLabel6 // this.toolStripStatusLabel6.Name = "toolStripStatusLabel6"; - this.toolStripStatusLabel6.Size = new System.Drawing.Size(31, 17); + this.toolStripStatusLabel6.Size = new System.Drawing.Size(46, 17); this.toolStripStatusLabel6.Spring = true; // // tslblDonate @@ -612,7 +612,7 @@ private void InitializeComponent() this.label13.Text = "6. Licensing and Terms"; this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // frmConfigure + // FrmConfigure // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -681,7 +681,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtDbHost; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label16; - private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label14; @@ -706,5 +705,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel9; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel8; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; + private System.Windows.Forms.Label lblDatabaseName; } } \ No newline at end of file diff --git a/DiscordBot/frmConfigure.cs b/DiscordBot/frmConfigure.cs index ea4e38f..cf37e3a 100644 --- a/DiscordBot/frmConfigure.cs +++ b/DiscordBot/frmConfigure.cs @@ -144,31 +144,26 @@ private void lblGenerateNewToken_Click(object sender, EventArgs e) #region 3. Database Settings private void txtDbHost_TextChanged(object sender, EventArgs e) { - _validDbSettings = false; InvalidateDbValidationLabel(); } private void txtDbPort_TextChanged(object sender, EventArgs e) { - _validDbSettings = false; InvalidateDbValidationLabel(); } private void txtDbName_TextChanged(object sender, EventArgs e) { - _validDbSettings = false; InvalidateDbValidationLabel(); } private void txtDbUser_TextChanged(object sender, EventArgs e) { - _validDbSettings = false; InvalidateDbValidationLabel(); } private void txtDbPass_TextChanged(object sender, EventArgs e) { - _validDbSettings = false; InvalidateDbValidationLabel(); } @@ -179,13 +174,17 @@ private void btnValidateDbSettings_Click(object sender, EventArgs e) private void InvalidateDbValidationLabel() { + _validDbSettings = false; + tslblDbValidation.Text = @"Database Validation Required."; tslblDbValidation.ForeColor = Color.Red; } private void TestDatabaseValues() { + InvalidateDbValidationLabel(); lblDatabaseSetup.ForeColor = Color.Black; + lblDatabaseName.ForeColor = Color.Black; int port = 3306; try @@ -216,6 +215,7 @@ private void TestDatabaseValues() if (result != DialogResult.Yes) { + lblDatabaseName.ForeColor = Color.Red; return; } }