Private
Public Access
Documented ErrorWindow
This commit is contained in:
1 parent
fdb53206b7
commit
528a44da8e
1 file changed
+41
-2
@@ -9,19 +9,36 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Advanced_Software_Engineering {
|
namespace Advanced_Software_Engineering {
|
||||||
|
/// <summary>
|
||||||
|
/// The error window that can show errors, warnings and messages.
|
||||||
|
/// </summary>
|
||||||
public partial class ErrorWindow : Form {
|
public partial class ErrorWindow : Form {
|
||||||
string desc;
|
string desc;
|
||||||
|
/// <summary>
|
||||||
|
/// The error message type.
|
||||||
|
/// </summary>
|
||||||
public const int ERROR_MESSAGE = 0;
|
public const int ERROR_MESSAGE = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// The warning message type
|
||||||
|
/// </summary>
|
||||||
public const int WARNING_MESSAGE = 1;
|
public const int WARNING_MESSAGE = 1;
|
||||||
|
/// <summary>
|
||||||
|
/// The info message type
|
||||||
|
/// </summary>
|
||||||
public const int INFO_MESSAGE = 2;
|
public const int INFO_MESSAGE = 2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The image directory which links the message types to the image to display.
|
||||||
|
/// </summary>
|
||||||
protected Dictionary<int, Image> IMAGEDIR = new Dictionary<int, Image> {
|
protected Dictionary<int, Image> IMAGEDIR = new Dictionary<int, Image> {
|
||||||
{ ERROR_MESSAGE, Properties.Resources.error },
|
{ ERROR_MESSAGE, Properties.Resources.error },
|
||||||
{ WARNING_MESSAGE, Properties.Resources.warning },
|
{ WARNING_MESSAGE, Properties.Resources.warning },
|
||||||
{ INFO_MESSAGE, Properties.Resources.info3 }
|
{ INFO_MESSAGE, Properties.Resources.info3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default error window constructor. Creates an error window with the title "Error", short description "An error has occured", a long description of "None" and message type of ERROR.
|
||||||
|
/// </summary>
|
||||||
public ErrorWindow() {
|
public ErrorWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Text = "Error";
|
this.Text = "Error";
|
||||||
@@ -33,6 +50,14 @@ namespace Advanced_Software_Engineering {
|
|||||||
Focus();
|
Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The error window constructor.
|
||||||
|
/// It is responsible for creating an error form which shows the user information depending on the parameters.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title">Title of the window</param>
|
||||||
|
/// <param name="brief">A brief description of the message</param>
|
||||||
|
/// <param name="desc">A detailed description of the message</param>
|
||||||
|
/// <param name="type">The type of message (can either be: ERROR_MESSAGE, WARNING_MESSAGE or INFO_MESSAGE</param>
|
||||||
public ErrorWindow(string title, string brief, string desc, int type) {
|
public ErrorWindow(string title, string brief, string desc, int type) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Text = title;
|
this.Text = title;
|
||||||
@@ -45,7 +70,11 @@ namespace Advanced_Software_Engineering {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetPicture(int type) {
|
/// <summary>
|
||||||
|
/// Sets the picture of the window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">The type of message (can either be: ERROR_MESSAGE, WARNING_MESSAGE or INFO_MESSAGE</param>
|
||||||
|
public void SetPicture(int type) {
|
||||||
pictureBox1.Image = IMAGEDIR[type];
|
pictureBox1.Image = IMAGEDIR[type];
|
||||||
pictureBox1.Refresh();
|
pictureBox1.Refresh();
|
||||||
|
|
||||||
@@ -64,10 +93,20 @@ namespace Advanced_Software_Engineering {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes the from.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void button1_Click(object sender, EventArgs e) {
|
private void button1_Click(object sender, EventArgs e) {
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show description window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void button2_Click(object sender, EventArgs e) {
|
private void button2_Click(object sender, EventArgs e) {
|
||||||
new DetailsWindow(desc).Show();
|
new DetailsWindow(desc).Show();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user