Change solved / unsolved menu items to use the new enums. This standardizes the loading of the solved / unsolved networks.

This commit is contained in:
Tim Young 2017-08-24 14:19:27 -05:00
parent 931ba44b69
commit 985821fa5a
3 changed files with 52 additions and 196 deletions

View File

@ -34,6 +34,7 @@
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -61,19 +62,7 @@
this.samplesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.puzzlesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.solvedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dHCPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.oneNetworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.twoNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.threeNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.firewallsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.VLANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toSolveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.solvedDHCPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.solvedOneNetworkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.solvedTwoNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SolvedThreeNetworksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.firewallsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.SolvedVLANToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.panelChoices = new System.Windows.Forms.Panel();
this.lbMessages = new System.Windows.Forms.ListBox();
this.lblStatus = new System.Windows.Forms.Label();
@ -86,7 +75,6 @@
this.HelpPanel = new System.Windows.Forms.Panel();
this.cbViewTitles = new System.Windows.Forms.CheckBox();
this.myProgressBar = new System.Windows.Forms.ProgressBar();
this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.msMainMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbNetworkView)).BeginInit();
this.HelpPanel.SuspendLayout();
@ -124,35 +112,42 @@
// newToolStripMenuItem
//
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.newToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.loadToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.loadToolStripMenuItem.Text = "Load";
this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
//
// reloadToolStripMenuItem
//
this.reloadToolStripMenuItem.Name = "reloadToolStripMenuItem";
this.reloadToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.reloadToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.reloadToolStripMenuItem.Text = "Reload";
this.reloadToolStripMenuItem.Click += new System.EventHandler(this.reloadToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.saveToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// logoutToolStripMenuItem
//
this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem";
this.logoutToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.logoutToolStripMenuItem.Text = "Logout";
this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(131, 26);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@ -345,120 +340,22 @@
// puzzlesToolStripMenuItem
//
this.puzzlesToolStripMenuItem.Name = "puzzlesToolStripMenuItem";
this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(140, 26);
this.puzzlesToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.puzzlesToolStripMenuItem.Text = "Puzzles";
this.puzzlesToolStripMenuItem.Click += new System.EventHandler(this.puzzlesToolStripMenuItem_Click);
//
// solvedToolStripMenuItem
//
this.solvedToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.dHCPToolStripMenuItem,
this.oneNetworkToolStripMenuItem,
this.twoNetworksToolStripMenuItem,
this.threeNetworksToolStripMenuItem,
this.firewallsToolStripMenuItem,
this.VLANToolStripMenuItem});
this.solvedToolStripMenuItem.Name = "solvedToolStripMenuItem";
this.solvedToolStripMenuItem.Size = new System.Drawing.Size(140, 26);
this.solvedToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.solvedToolStripMenuItem.Text = "Solved";
//
// dHCPToolStripMenuItem
//
this.dHCPToolStripMenuItem.Name = "dHCPToolStripMenuItem";
this.dHCPToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.dHCPToolStripMenuItem.Text = "DHCP";
this.dHCPToolStripMenuItem.Click += new System.EventHandler(this.dHCPToolStripMenuItem_Click);
//
// oneNetworkToolStripMenuItem
//
this.oneNetworkToolStripMenuItem.Name = "oneNetworkToolStripMenuItem";
this.oneNetworkToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.oneNetworkToolStripMenuItem.Text = "One Network";
this.oneNetworkToolStripMenuItem.Click += new System.EventHandler(this.oneNetworkToolStripMenuItem_Click);
//
// twoNetworksToolStripMenuItem
//
this.twoNetworksToolStripMenuItem.Name = "twoNetworksToolStripMenuItem";
this.twoNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.twoNetworksToolStripMenuItem.Text = "Two Networks";
this.twoNetworksToolStripMenuItem.Click += new System.EventHandler(this.twoNetworksToolStripMenuItem_Click);
//
// threeNetworksToolStripMenuItem
//
this.threeNetworksToolStripMenuItem.Name = "threeNetworksToolStripMenuItem";
this.threeNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.threeNetworksToolStripMenuItem.Text = "Three Networks";
this.threeNetworksToolStripMenuItem.Click += new System.EventHandler(this.threeNetworksToolStripMenuItem_Click);
//
// firewallsToolStripMenuItem
//
this.firewallsToolStripMenuItem.Name = "firewallsToolStripMenuItem";
this.firewallsToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.firewallsToolStripMenuItem.Text = "Firewalls";
this.firewallsToolStripMenuItem.Click += new System.EventHandler(this.firewallsToolStripMenuItem_Click);
//
// VLANToolStripMenuItem
//
this.VLANToolStripMenuItem.Name = "VLANToolStripMenuItem";
this.VLANToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.VLANToolStripMenuItem.Text = "VLAN";
this.VLANToolStripMenuItem.Click += new System.EventHandler(this.VLANToolStripMenuItem_Click);
//
// toSolveToolStripMenuItem
//
this.toSolveToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.solvedDHCPToolStripMenuItem,
this.solvedOneNetworkToolStripMenuItem,
this.solvedTwoNetworksToolStripMenuItem,
this.SolvedThreeNetworksToolStripMenuItem,
this.firewallsToolStripMenuItem1,
this.SolvedVLANToolStripMenuItem1});
this.toSolveToolStripMenuItem.Name = "toSolveToolStripMenuItem";
this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(140, 26);
this.toSolveToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.toSolveToolStripMenuItem.Text = "To Solve";
//
// solvedDHCPToolStripMenuItem
//
this.solvedDHCPToolStripMenuItem.Name = "solvedDHCPToolStripMenuItem";
this.solvedDHCPToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.solvedDHCPToolStripMenuItem.Text = "DHCP";
this.solvedDHCPToolStripMenuItem.Click += new System.EventHandler(this.solvedDHCPToolStripMenuItem_Click);
//
// solvedOneNetworkToolStripMenuItem
//
this.solvedOneNetworkToolStripMenuItem.Name = "solvedOneNetworkToolStripMenuItem";
this.solvedOneNetworkToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.solvedOneNetworkToolStripMenuItem.Text = "One Network";
this.solvedOneNetworkToolStripMenuItem.Click += new System.EventHandler(this.solvedOneNetworkToolStripMenuItem_Click);
//
// solvedTwoNetworksToolStripMenuItem
//
this.solvedTwoNetworksToolStripMenuItem.Name = "solvedTwoNetworksToolStripMenuItem";
this.solvedTwoNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.solvedTwoNetworksToolStripMenuItem.Text = "Two Networks";
this.solvedTwoNetworksToolStripMenuItem.Click += new System.EventHandler(this.solvedTwoNetworksToolStripMenuItem_Click);
//
// SolvedThreeNetworksToolStripMenuItem
//
this.SolvedThreeNetworksToolStripMenuItem.Name = "SolvedThreeNetworksToolStripMenuItem";
this.SolvedThreeNetworksToolStripMenuItem.Size = new System.Drawing.Size(187, 26);
this.SolvedThreeNetworksToolStripMenuItem.Text = "Three Networks";
this.SolvedThreeNetworksToolStripMenuItem.Click += new System.EventHandler(this.SolvedThreeNetworksToolStripMenuItem_Click);
//
// firewallsToolStripMenuItem1
//
this.firewallsToolStripMenuItem1.Name = "firewallsToolStripMenuItem1";
this.firewallsToolStripMenuItem1.Size = new System.Drawing.Size(187, 26);
this.firewallsToolStripMenuItem1.Text = "Firewalls";
this.firewallsToolStripMenuItem1.Click += new System.EventHandler(this.firewallsToolStripMenuItem1_Click);
//
// SolvedVLANToolStripMenuItem1
//
this.SolvedVLANToolStripMenuItem1.Name = "SolvedVLANToolStripMenuItem1";
this.SolvedVLANToolStripMenuItem1.Size = new System.Drawing.Size(187, 26);
this.SolvedVLANToolStripMenuItem1.Text = "VLAN";
this.SolvedVLANToolStripMenuItem1.Click += new System.EventHandler(this.SolvedVLANToolStripMenuItem1_Click);
//
// panelChoices
//
this.panelChoices.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -609,13 +506,6 @@
this.myProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.myProgressBar.TabIndex = 11;
//
// logoutToolStripMenuItem
//
this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem";
this.logoutToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
this.logoutToolStripMenuItem.Text = "Logout";
this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click);
//
// BuilderWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@ -678,15 +568,7 @@
private System.Windows.Forms.ToolStripMenuItem pingToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem samplesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem solvedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem oneNetworkToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem twoNetworksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dHCPToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toSolveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem solvedOneNetworkToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem solvedTwoNetworksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem solvedDHCPToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem threeNetworksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SolvedThreeNetworksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.Button btnHelp;
@ -696,13 +578,9 @@
private System.Windows.Forms.RadioButton rbHelp1;
private System.Windows.Forms.Panel HelpPanel;
private System.Windows.Forms.ToolStripMenuItem puzzlesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem firewallsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem firewallsToolStripMenuItem1;
private System.Windows.Forms.ProgressBar myProgressBar;
private System.Windows.Forms.ToolStripMenuItem changeLanguageToolStripMenuItem;
private System.Windows.Forms.CheckBox cbViewTitles;
private System.Windows.Forms.ToolStripMenuItem VLANToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SolvedVLANToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem classSetupToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem profileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addToClassworkToolStripMenuItem;

View File

@ -103,6 +103,7 @@ namespace EduNetworkBuilder
//Set this so we can intercept the esc key. We want to un-set the selected items if esc is pressed
KeyPreview = true;
CreateSolvedUnsolvedToolstripItems();
LoadPuzzleInfo();
}
@ -146,17 +147,7 @@ namespace EduNetworkBuilder
samplesToolStripMenuItem.Text = NB.Translate("NB_samplesToolStripMenuItem", OurSettings);
puzzlesToolStripMenuItem.Text = NB.Translate("NB_puzzlesToolStripMenuItem", OurSettings);
solvedToolStripMenuItem.Text = NB.Translate("_Solved", OurSettings);
dHCPToolStripMenuItem.Text = NB.Translate("_DHCP", OurSettings);
oneNetworkToolStripMenuItem.Text = NB.Translate("NB_OneNetwork", OurSettings);
twoNetworksToolStripMenuItem.Text = NB.Translate("NB_TwoNetworks", OurSettings);
threeNetworksToolStripMenuItem.Text = NB.Translate("NB_ThreeNetworks", OurSettings);
firewallsToolStripMenuItem.Text = NB.Translate("NB_Firewalls", OurSettings);
toSolveToolStripMenuItem.Text = NB.Translate("NB_toSolveToolStripMenuItem", OurSettings);
solvedDHCPToolStripMenuItem.Text = NB.Translate("_DHCP", OurSettings);
solvedOneNetworkToolStripMenuItem.Text = NB.Translate("NB_OneNetwork", OurSettings);
solvedTwoNetworksToolStripMenuItem.Text = NB.Translate("NB_TwoNetworks", OurSettings);
SolvedThreeNetworksToolStripMenuItem.Text = NB.Translate("NB_ThreeNetworks", OurSettings);
firewallsToolStripMenuItem1.Text = NB.Translate("NB_Firewalls", OurSettings);
lblStatus.Text = NB.Translate("NB_lblStatus", OurSettings);
btnHelp.Text = NB.Translate("NB_btnHelp", OurSettings);
addToClassworkToolStripMenuItem.Text = NB.Translate("NB_AddToClasswork");
@ -1657,58 +1648,37 @@ namespace EduNetworkBuilder
LoadSolvedResource(what);
//Then "unsolve" it
myNetwork.DoAllClearIPs();
myNetwork.OverrideFromResources();
UpdateForm();
UpdateMessages();
}
private void oneNetworkToolStripMenuItem_Click(object sender, EventArgs e)
private void CreateSolvedUnsolvedToolstripItems()
{
LoadSolvedResource("OneNet");
foreach(SolvedNetworkNames one in Enum.GetValues(typeof(SolvedNetworkNames)))
{
//add a solved one
ToolStripMenuItem tsmi = new ToolStripMenuItem(NB.Translate("NB_"+one.ToString()));
tsmi.Name = one.ToString();
tsmi.Click += MenuItemLoadSolved;
solvedToolStripMenuItem.DropDownItems.Add(tsmi);
//Add one for the unsolved
tsmi = new ToolStripMenuItem(NB.Translate("NB_" + one.ToString()));
tsmi.Name = one.ToString();
tsmi.Click += MenuItemLoadUnsolved;
toSolveToolStripMenuItem.DropDownItems.Add(tsmi);
}
}
private void twoNetworksToolStripMenuItem_Click(object sender, EventArgs e)
private void MenuItemLoadSolved(object sender, EventArgs e)
{
LoadSolvedResource("TwoNets");
ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
LoadSolvedResource(tsmi.Name);
}
private void dHCPToolStripMenuItem_Click(object sender, EventArgs e)
private void MenuItemLoadUnsolved(object sender, EventArgs e)
{
LoadSolvedResource("DHCP");
}
private void solvedOneNetworkToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadUnsolvedResource("OneNet");
}
private void solvedTwoNetworksToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadUnsolvedResource("TwoNets");
}
private void solvedDHCPToolStripMenuItem_Click(object sender, EventArgs e)
{
//Umm. The function name is solved, but we are doing the unsolved version?
LoadUnsolvedResource("DHCP");
}
private void VLANToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadSolvedResource("VLAN");
}
private void SolvedVLANToolStripMenuItem1_Click(object sender, EventArgs e)
{
LoadUnsolvedResource("VLAN");
}
private void threeNetworksToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadSolvedResource("ThreeNets");
}
private void SolvedThreeNetworksToolStripMenuItem_Click(object sender, EventArgs e)
{
LoadUnsolvedResource("ThreeNets");
ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
LoadUnsolvedResource(tsmi.Name);
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -221,19 +221,19 @@
<value>DHCP</value>
<comment>DeviceConfig btnDHCP = DHCP</comment>
</data>
<data name="NB_OneNetwork" xml:space="preserve">
<data name="NB_OneNet" xml:space="preserve">
<value>One Network</value>
<comment>NetworkBuilder solvedOneNetworkToolStripMenuItem = One Network</comment>
</data>
<data name="NB_TwoNetworks" xml:space="preserve">
<data name="NB_TwoNets" xml:space="preserve">
<value>Two Networks</value>
<comment>NetworkBuilder solvedTwoNetworksToolStripMenuItem = Two Networks</comment>
</data>
<data name="NB_ThreeNetworks" xml:space="preserve">
<data name="NB_ThreeNets" xml:space="preserve">
<value>Three Networks</value>
<comment>NetworkBuilder SolvedThreeNetworksToolStripMenuItem = Three Networks</comment>
</data>
<data name="NB_Firewalls" xml:space="preserve">
<data name="NB_firewalls" xml:space="preserve">
<value>Firewalls</value>
<comment>NetworkBuilder firewallsToolStripMenuItem1 = Firewalls</comment>
</data>
@ -1917,4 +1917,12 @@
<value>Auto DHCP on network Load</value>
<comment>PPF_AutoDHCP = Auto DHCP on network Load</comment>
</data>
<data name="NB_DHCP" xml:space="preserve">
<value>DHCP</value>
<comment>DHCP</comment>
</data>
<data name="NB_VLAN" xml:space="preserve">
<value>VLAN</value>
<comment>VLAN</comment>
</data>
</root>