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 7033171..cca31bb 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj +++ b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj @@ -46,6 +46,12 @@ + + Form + + + Console.cs + Form @@ -55,6 +61,9 @@ + + Console.cs + Menu.cs diff --git a/Advanced Software Engineering/Advanced Software Engineering/Console.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/Console.Designer.cs new file mode 100644 index 0000000..991b614 --- /dev/null +++ b/Advanced Software Engineering/Advanced Software Engineering/Console.Designer.cs @@ -0,0 +1,47 @@ +namespace Advanced_Software_Engineering +{ + partial class Console + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // Console + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Name = "Console"; + this.Text = "Console"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Console_FormClosed); + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/Advanced Software Engineering/Advanced Software Engineering/Console.cs b/Advanced Software Engineering/Advanced Software Engineering/Console.cs new file mode 100644 index 0000000..b32f29a --- /dev/null +++ b/Advanced Software Engineering/Advanced Software Engineering/Console.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Advanced_Software_Engineering +{ + public partial class Console : Form + { + public Console() + { + InitializeComponent(); + } + + private void Console_FormClosed(object sender, FormClosedEventArgs e) + { + SettingsAndHelperFunctions.NumberOfWindows--; + + } + } +} diff --git a/Advanced Software Engineering/Advanced Software Engineering/Console.resx b/Advanced Software Engineering/Advanced Software Engineering/Console.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Advanced Software Engineering/Advanced Software Engineering/Console.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/Advanced Software Engineering/Advanced Software Engineering/Menu.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/Menu.Designer.cs index cd8ef5f..a44bf48 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Menu.Designer.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Menu.Designer.cs @@ -111,6 +111,7 @@ this.Name = "Menu"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "Menu"; + this.Load += new System.EventHandler(this.Menu_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Advanced Software Engineering/Advanced Software Engineering/Menu.cs b/Advanced Software Engineering/Advanced Software Engineering/Menu.cs index adaa859..596930d 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Menu.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Menu.cs @@ -19,22 +19,36 @@ namespace Advanced_Software_Engineering private void button1_Click(object sender, EventArgs e) { - Settings.NumberOfWindows++; + SettingsAndHelperFunctions.NumberOfWindows++; + new Console().Show(); + this.Hide(); } private void button2_Click(object sender, EventArgs e) { - Settings.NumberOfWindows++; + SettingsAndHelperFunctions.NumberOfWindows++; + this.Hide(); } private void button3_Click(object sender, EventArgs e) { - Settings.NumberOfWindows++; + SettingsAndHelperFunctions.NumberOfWindows++; + this.Hide(); } private void button4_Click(object sender, EventArgs e) { this.Close(); } + + public static void CheckWindows() + { + if (SettingsAndHelperFunctions.NumberOfWindows == 0) Menu.Show(); + } + + private void Menu_Load(object sender, EventArgs e) + { + //Do things on load + } } } diff --git a/Advanced Software Engineering/Advanced Software Engineering/Settings.cs b/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs similarity index 77% rename from Advanced Software Engineering/Advanced Software Engineering/Settings.cs rename to Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs index 3915be9..c5a2b31 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Settings.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/SettingsAndHelperFunctions.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace Advanced_Software_Engineering { - class Settings + class SettingsAndHelperFunctions { public static int NumberOfWindows = 0; }