From aeea08f021c79643d61b461d5a4798c1a74c7374 Mon Sep 17 00:00:00 2001 From: Lukasz Baldyga Date: Mon, 19 Oct 2020 01:32:46 +0100 Subject: [PATCH] Added some code for the Error Windows --- .../Advanced Software Engineering.csproj | 9 +++ .../ErrorWindow.Designer.cs | 64 +++++++++---------- .../ErrorWindow.cs | 33 ++++++++++ 3 files changed, 74 insertions(+), 32 deletions(-) diff --git a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj index 84f9125..b2ac684 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj +++ b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj @@ -80,6 +80,12 @@ DrawPreview.cs + + Form + + + ErrorDetailWindow.cs + Form @@ -107,6 +113,9 @@ DrawPreview.cs + + ErrorDetailWindow.cs + ErrorWindow.cs diff --git a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs index 0bd78f3..2bcb9aa 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs @@ -25,42 +25,14 @@ private void InitializeComponent() { System.Windows.Forms.GroupBox groupBox1; this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.button1 = new System.Windows.Forms.Button(); 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(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point(6, 19); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(56, 60); - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // button1 - // - this.button1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.button1.Location = new System.Drawing.Point(0, 127); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(336, 23); - this.button1.TabIndex = 1; - this.button1.Text = "Exit"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(68, 19); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(60, 13); - this.label1.TabIndex = 2; - this.label1.Text = "Error Name"; - // // groupBox1 // groupBox1.AutoSize = true; @@ -74,6 +46,34 @@ groupBox1.TabStop = false; groupBox1.Text = "Error"; // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point(6, 19); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(56, 60); + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(68, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(60, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Error Name"; + // + // button1 + // + this.button1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.button1.Location = new System.Drawing.Point(0, 127); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(336, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Exit"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // button2 // this.button2.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -83,6 +83,7 @@ this.button2.TabIndex = 5; this.button2.Text = "Show Details"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // ErrorWindow // @@ -97,10 +98,9 @@ this.MinimizeBox = false; this.Name = "ErrorWindow"; this.Text = "Error"; - this.TopMost = true; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs index 8de704d..63fb531 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs @@ -10,12 +10,45 @@ using System.Windows.Forms; namespace Advanced_Software_Engineering { public partial class ErrorWindow : Form { + string desc; + + public const int ERROR_MESSAGE = 0; + public const int WARNING_MESSAGE = 1; + public const int INFO_MESSAGE = 2; + public ErrorWindow() { InitializeComponent(); + this.Text = "Error"; + label1.Text = "An error has occured"; + desc = "None"; + } + + public ErrorWindow(string title, string brief, string desc, int type) { + InitializeComponent(); + this.Text = title; + label1.Text = brief; + this.desc = desc; + + switch(type) { + case INFO_MESSAGE: + + break; + case WARNING_MESSAGE: + + break; + + case ERROR_MESSAGE: + default: + break; + } } private void button1_Click(object sender, EventArgs e) { Close(); } + + private void button2_Click(object sender, EventArgs e) { + new ErrorDetailWindow(desc).Show(); + } } }