From cc0da518653fa0f094ac4d175fd5f1946b3cb342 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Mon, 6 Mar 2017 23:02:28 -0500 Subject: [PATCH] Added new enigma main form that runs in debug mode that allows the system to either load from registry or manually test stations on a machine. Not operational yet, something is going wrong with class inheritence. --- Enigma/Enigma.csproj | 9 ++ Enigma/EnigmaMain.Designer.cs | 110 +++++++++++++++++++++++ Enigma/EnigmaMain.cs | 61 +++++++++++++ Enigma/EnigmaMain.resx | 120 +++++++++++++++++++++++++ Enigma/Program.cs | 4 +- Enigma/StationsGUI/DebugStationView.cs | 2 +- 6 files changed, 302 insertions(+), 4 deletions(-) create mode 100644 Enigma/EnigmaMain.Designer.cs create mode 100644 Enigma/EnigmaMain.cs create mode 100644 Enigma/EnigmaMain.resx diff --git a/Enigma/Enigma.csproj b/Enigma/Enigma.csproj index 4959c33..e38a033 100644 --- a/Enigma/Enigma.csproj +++ b/Enigma/Enigma.csproj @@ -62,6 +62,12 @@ + + Form + + + EnigmaMain.cs + Form @@ -78,6 +84,9 @@ + + EnigmaMain.cs + DebugStationView.cs diff --git a/Enigma/EnigmaMain.Designer.cs b/Enigma/EnigmaMain.Designer.cs new file mode 100644 index 0000000..fab225f --- /dev/null +++ b/Enigma/EnigmaMain.Designer.cs @@ -0,0 +1,110 @@ +namespace Enigma +{ + partial class EnigmaMain + { + /// + /// 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.hostButton = new MetroFramework.Controls.MetroButton(); + this.waiterbutton = new MetroFramework.Controls.MetroButton(); + this.chefButton = new MetroFramework.Controls.MetroButton(); + this.adminButton = new MetroFramework.Controls.MetroButton(); + this.debugButton = new MetroFramework.Controls.MetroButton(); + this.SuspendLayout(); + // + // hostButton + // + this.hostButton.Location = new System.Drawing.Point(32, 93); + this.hostButton.Name = "hostButton"; + this.hostButton.Size = new System.Drawing.Size(165, 99); + this.hostButton.TabIndex = 0; + this.hostButton.Text = "Start Host Station"; + this.hostButton.UseSelectable = true; + this.hostButton.Click += new System.EventHandler(this.hostButton_Click); + // + // waiterbutton + // + this.waiterbutton.Location = new System.Drawing.Point(203, 93); + this.waiterbutton.Name = "waiterbutton"; + this.waiterbutton.Size = new System.Drawing.Size(165, 99); + this.waiterbutton.TabIndex = 1; + this.waiterbutton.Text = "Start Waiter Station"; + this.waiterbutton.UseSelectable = true; + // + // chefButton + // + this.chefButton.Location = new System.Drawing.Point(374, 93); + this.chefButton.Name = "chefButton"; + this.chefButton.Size = new System.Drawing.Size(165, 99); + this.chefButton.TabIndex = 2; + this.chefButton.Text = "Start Chef Station"; + this.chefButton.UseSelectable = true; + // + // adminButton + // + this.adminButton.Location = new System.Drawing.Point(545, 93); + this.adminButton.Name = "adminButton"; + this.adminButton.Size = new System.Drawing.Size(165, 99); + this.adminButton.TabIndex = 3; + this.adminButton.Text = "Start Admin Station"; + this.adminButton.UseSelectable = true; + // + // debugButton + // + this.debugButton.Location = new System.Drawing.Point(32, 198); + this.debugButton.Name = "debugButton"; + this.debugButton.Size = new System.Drawing.Size(165, 45); + this.debugButton.TabIndex = 4; + this.debugButton.Text = "Start Debug Station"; + this.debugButton.UseSelectable = true; + this.debugButton.Click += new System.EventHandler(this.debugButton_Click); + // + // EnigmaMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(740, 286); + this.Controls.Add(this.debugButton); + this.Controls.Add(this.adminButton); + this.Controls.Add(this.chefButton); + this.Controls.Add(this.waiterbutton); + this.Controls.Add(this.hostButton); + this.Name = "EnigmaMain"; + this.Text = "Enigma Main Control Panel"; + this.Load += new System.EventHandler(this.EnigmaMain_Load); + this.ResumeLayout(false); + + } + + #endregion + + private MetroFramework.Controls.MetroButton hostButton; + private MetroFramework.Controls.MetroButton waiterbutton; + private MetroFramework.Controls.MetroButton chefButton; + private MetroFramework.Controls.MetroButton adminButton; + private MetroFramework.Controls.MetroButton debugButton; + } +} \ No newline at end of file diff --git a/Enigma/EnigmaMain.cs b/Enigma/EnigmaMain.cs new file mode 100644 index 0000000..c977b6d --- /dev/null +++ b/Enigma/EnigmaMain.cs @@ -0,0 +1,61 @@ +using MetroFramework.Forms; +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; +using Enigma.Stations; +using EnigmaX.Classes; +namespace Enigma +{ + public partial class EnigmaMain : MetroForm + { + + bool debugmode = false; + public List loadedStations = new List(); + + public EnigmaMain(bool debugmode) + { + InitializeComponent(); + this.debugmode = debugmode; + } + + private void EnigmaMain_Load(object sender, EventArgs e) + { + if (!debugmode) + { + Visible = false; + ShowInTaskbar = false; + ShowIcon = false; + + } + else { + Visible = true; + ShowInTaskbar = true; + ShowIcon = true; + } + } + + private void runConfiguredStation() { + //this is where, when not in debug mode, this will load some registry to see what station and id it should load and execute + } + + private void hostButton_Click(object sender, EventArgs e) + { + HostStation station = new HostStation("debughost"); + loadedStations.Add(station); + station.showView(); + } + + private void debugButton_Click(object sender, EventArgs e) + { + DebugStation station = new DebugStation(EnigmaX.Classes.StationTypeDef.host, "debug"); + loadedStations.Add(station); + station.showView(); + } + } +} diff --git a/Enigma/EnigmaMain.resx b/Enigma/EnigmaMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Enigma/EnigmaMain.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/Enigma/Program.cs b/Enigma/Program.cs index 5ca2335..5cf3411 100644 --- a/Enigma/Program.cs +++ b/Enigma/Program.cs @@ -18,9 +18,7 @@ static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - DebugStation station = new DebugStation(EnigmaX.Classes.StationTypeDef.host, "debug"); - station.showView(); - Application.Run(); + Application.Run(new EnigmaMain(true)); } } } diff --git a/Enigma/StationsGUI/DebugStationView.cs b/Enigma/StationsGUI/DebugStationView.cs index 845914e..be3102b 100644 --- a/Enigma/StationsGUI/DebugStationView.cs +++ b/Enigma/StationsGUI/DebugStationView.cs @@ -16,7 +16,7 @@ namespace Enigma public partial class DebugStationView : MetroForm { - private Station _station; + private DebugStation _station; public DebugStationView(DebugStation station) {