From b3d7b5f722581f5b5ec0c0bf3b54ddbdfe515d1b Mon Sep 17 00:00:00 2001 From: Lukasz Baldyga Date: Sun, 25 Oct 2020 11:11:33 +0000 Subject: [PATCH] Made sure that ErrorWindow didn't send mixed messages --- .../Windows/ErrorWindow.Designer.cs | 33 ++++++++++--------- .../Windows/ErrorWindow.cs | 18 ++++++++++ 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.Designer.cs index 663db46..a83584f 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.Designer.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.Designer.cs @@ -23,28 +23,27 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.Windows.Forms.GroupBox groupBox1; this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); - groupBox1 = new System.Windows.Forms.GroupBox(); - groupBox1.SuspendLayout(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // groupBox1 // - groupBox1.AutoSize = true; - groupBox1.Controls.Add(this.pictureBox1); - groupBox1.Controls.Add(this.label1); - groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; - groupBox1.Location = new System.Drawing.Point(0, 6); - groupBox1.Name = "groupBox1"; - groupBox1.Size = new System.Drawing.Size(336, 98); - groupBox1.TabIndex = 4; - groupBox1.TabStop = false; - groupBox1.Text = "Error"; + this.groupBox1.AutoSize = true; + this.groupBox1.Controls.Add(this.pictureBox1); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.groupBox1.Location = new System.Drawing.Point(0, 6); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(336, 98); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Error"; // // pictureBox1 // @@ -92,7 +91,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(336, 150); - this.Controls.Add(groupBox1); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -100,8 +99,9 @@ this.MinimizeBox = false; this.Name = "ErrorWindow"; this.Text = "Error"; - groupBox1.ResumeLayout(false); - groupBox1.PerformLayout(); + this.Load += new System.EventHandler(this.ErrorWindow_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -114,5 +114,6 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button2; + private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.cs b/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.cs index 8636a76..9e054bf 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Windows/ErrorWindow.cs @@ -48,6 +48,20 @@ namespace Advanced_Software_Engineering { protected void SetPicture(int type) { pictureBox1.Image = IMAGEDIR[type]; pictureBox1.Refresh(); + + switch(type) { + case ERROR_MESSAGE: + groupBox1.Text = "Error"; + break; + + case WARNING_MESSAGE: + groupBox1.Text = "Warning"; + break; + + case INFO_MESSAGE: + groupBox1.Text = "Info"; + break; + } } private void button1_Click(object sender, EventArgs e) { @@ -57,5 +71,9 @@ namespace Advanced_Software_Engineering { private void button2_Click(object sender, EventArgs e) { new DetailsWindow(desc).Show(); } + + private void ErrorWindow_Load(object sender, EventArgs e) { + + } } }