Option for enabling vlans

This commit is contained in:
Tim Young 2016-10-12 11:56:29 -05:00
parent 9b50875c2c
commit ff4badaff8
5 changed files with 45 additions and 13 deletions

View File

@ -86,7 +86,7 @@ namespace EduNetworkBuilder
btnNicMinus.Visible = false; btnNicMinus.Visible = false;
} }
if (ndCLonedItem.DoesVLANs()) if (ndCLonedItem.DoesVLANs() && theNet.VLANsEnabled)
btnVLAN.Visible = true; btnVLAN.Visible = true;
else btnVLAN.Visible = false; else btnVLAN.Visible = false;

View File

@ -25,6 +25,7 @@ namespace EduNetworkBuilder
public double SortOrder = 0; public double SortOrder = 0;
public bool OptionShowLabels = false; public bool OptionShowLabels = false;
public bool ShowLabelsHere = false; public bool ShowLabelsHere = false;
public bool VLANsEnabled = false;
public LanguageStrings NetMessage; public LanguageStrings NetMessage;
public LanguageStrings NetTitle; public LanguageStrings NetTitle;
List<NetworkComponent> NetComponents = new List<NetworkComponent>(); List<NetworkComponent> NetComponents = new List<NetworkComponent>();
@ -128,6 +129,9 @@ namespace EduNetworkBuilder
bool.TryParse(Individual.InnerText, out OptionShowLabels); bool.TryParse(Individual.InnerText, out OptionShowLabels);
ShowLabelsHere = OptionShowLabels; ShowLabelsHere = OptionShowLabels;
break; break;
case "vlansenabled":
bool.TryParse(Individual.InnerText, out VLANsEnabled);
break;
case "itemsize": case "itemsize":
int.TryParse(Individual.InnerText, out itemsize); int.TryParse(Individual.InnerText, out itemsize);
break; break;
@ -176,8 +180,11 @@ namespace EduNetworkBuilder
{ {
int ID; int ID;
int.TryParse(Individual.Attributes["ID"].Value, out ID); int.TryParse(Individual.Attributes["ID"].Value, out ID);
if(ID>1) if (ID > 1)
{
VlanNames.Add(new VLANName(ID, Individual.InnerText)); VlanNames.Add(new VLANName(ID, Individual.InnerText));
VLANsEnabled = true;
}
} }
break; break;
default: default:
@ -260,6 +267,7 @@ namespace EduNetworkBuilder
writer.WriteElementString("sortorder", SortOrder.ToString()); writer.WriteElementString("sortorder", SortOrder.ToString());
writer.WriteElementString("uniqueidentifier", UniqueIdentifier.ToString()); writer.WriteElementString("uniqueidentifier", UniqueIdentifier.ToString());
writer.WriteElementString("startinghelplevel", StartingHelpLevel.ToString()); writer.WriteElementString("startinghelplevel", StartingHelpLevel.ToString());
writer.WriteElementString("vlansenabled", VLANsEnabled.ToString());
//Save all the devices //Save all the devices
for (int loop = 0; loop < NetComponents.Count; loop++) for (int loop = 0; loop < NetComponents.Count; loop++)
{ {

View File

@ -49,6 +49,7 @@
this.lblSortOrder = new System.Windows.Forms.Label(); this.lblSortOrder = new System.Windows.Forms.Label();
this.cbStartingHelpLevel = new System.Windows.Forms.ComboBox(); this.cbStartingHelpLevel = new System.Windows.Forms.ComboBox();
this.lblStartingHelp = new System.Windows.Forms.Label(); this.lblStartingHelp = new System.Windows.Forms.Label();
this.cbVLANs = new System.Windows.Forms.CheckBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnDone // btnDone
@ -235,12 +236,23 @@
this.lblStartingHelp.TabIndex = 20; this.lblStartingHelp.TabIndex = 20;
this.lblStartingHelp.Text = "Starting Help Level"; this.lblStartingHelp.Text = "Starting Help Level";
// //
// cbVLANs
//
this.cbVLANs.AutoSize = true;
this.cbVLANs.Location = new System.Drawing.Point(341, 44);
this.cbVLANs.Name = "cbVLANs";
this.cbVLANs.Size = new System.Drawing.Size(129, 21);
this.cbVLANs.TabIndex = 21;
this.cbVLANs.Text = "VLANs Enabled";
this.cbVLANs.UseVisualStyleBackColor = true;
//
// OptionsWindow // OptionsWindow
// //
this.AcceptButton = this.btnDone; this.AcceptButton = this.btnDone;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(836, 307); this.ClientSize = new System.Drawing.Size(836, 307);
this.Controls.Add(this.cbVLANs);
this.Controls.Add(this.lblStartingHelp); this.Controls.Add(this.lblStartingHelp);
this.Controls.Add(this.cbStartingHelpLevel); this.Controls.Add(this.cbStartingHelpLevel);
this.Controls.Add(this.lblSortOrder); this.Controls.Add(this.lblSortOrder);
@ -292,5 +304,6 @@
private System.Windows.Forms.Label lblSortOrder; private System.Windows.Forms.Label lblSortOrder;
private System.Windows.Forms.ComboBox cbStartingHelpLevel; private System.Windows.Forms.ComboBox cbStartingHelpLevel;
private System.Windows.Forms.Label lblStartingHelp; private System.Windows.Forms.Label lblStartingHelp;
private System.Windows.Forms.CheckBox cbVLANs;
} }
} }

View File

@ -45,23 +45,24 @@ namespace EduNetworkBuilder
myToolTip.SetToolTip(tbLevel, NB.Translate("OW_OWLevel")); myToolTip.SetToolTip(tbLevel, NB.Translate("OW_OWLevel"));
myToolTip.SetToolTip(lblSortOrder, NB.Translate("OW_OWSort")); myToolTip.SetToolTip(lblSortOrder, NB.Translate("OW_OWSort"));
myToolTip.SetToolTip(tbSortOrder, NB.Translate("OW_OWSort")); myToolTip.SetToolTip(tbSortOrder, NB.Translate("OW_OWSort"));
myToolTip.SetToolTip(cbVLANs, NB.Translate("OW_OWVLANs"));
LoadValuesFromNetwork(); LoadValuesFromNetwork();
} }
private void LanguagifyComponents() private void LanguagifyComponents()
{ {
Text = NB.Translate("_Done"); Text = NB.Translate("_Done");
Text = NB.Translate("OW_lblNetTitle"); lblNetTitle.Text = NB.Translate("OW_lblNetTitle");
Text = NB.Translate("OW_cbDisplayTitles"); cbDisplayTitles.Text = NB.Translate("OW_cbDisplayTitles");
Text = NB.Translate("OW_lblNetSize"); lblNetSize.Text = NB.Translate("OW_lblNetSize");
Text = NB.Translate("OW_lblItemSize"); lblNetSize.Text = NB.Translate("OW_lblItemSize");
Text = NB.Translate("OW_lblNetMessage"); lblNetMessage.Text = NB.Translate("OW_lblNetMessage");
Text = NB.Translate("OW_lblTests"); lblTests.Text = NB.Translate("OW_lblTests");
Text = NB.Translate("OW_lblTags"); lblTags.Text = NB.Translate("OW_lblTags");
Text = NB.Translate("OW_lblLevel"); lblLevel.Text = NB.Translate("OW_lblLevel");
Text = NB.Translate("OW_lblSortOrder"); lblSortOrder.Text = NB.Translate("OW_lblSortOrder");
Text = NB.Translate("OW_lblStartingHelp"); lblStartingHelp.Text = NB.Translate("OW_lblStartingHelp");
cbVLANs.Text = NB.Translate("OW_cbVLANs");
Text = NB.Translate("OW_Form"); Text = NB.Translate("OW_Form");
} }
@ -72,6 +73,7 @@ namespace EduNetworkBuilder
tbMessage.Text = myNet.NetMessage.GetText(); tbMessage.Text = myNet.NetMessage.GetText();
tbNetworkTitle.Text = myNet.NetTitle.GetText(); tbNetworkTitle.Text = myNet.NetTitle.GetText();
cbDisplayTitles.Checked = myNet.OptionShowLabels; cbDisplayTitles.Checked = myNet.OptionShowLabels;
cbVLANs.Checked = myNet.VLANsEnabled;
tbNetworkX.Text = myNet.myWidth.ToString(); tbNetworkX.Text = myNet.myWidth.ToString();
tbNetworkY.Text = myNet.myHeight.ToString(); tbNetworkY.Text = myNet.myHeight.ToString();
tbLevel.Text = myNet.Level.ToString(); tbLevel.Text = myNet.Level.ToString();
@ -108,6 +110,7 @@ namespace EduNetworkBuilder
myNet.NetMessage.Add( tbMessage.Text); myNet.NetMessage.Add( tbMessage.Text);
myNet.NetTitle.Add(tbNetworkTitle.Text); myNet.NetTitle.Add(tbNetworkTitle.Text);
myNet.OptionShowLabels = cbDisplayTitles.Checked; myNet.OptionShowLabels = cbDisplayTitles.Checked;
myNet.VLANsEnabled = cbVLANs.Checked;
myNet.ShowLabelsHere = myNet.OptionShowLabels; myNet.ShowLabelsHere = myNet.OptionShowLabels;
int.TryParse(tbNetworkX.Text, out myNet.myWidth); int.TryParse(tbNetworkX.Text, out myNet.myWidth);
int.TryParse(tbNetworkY.Text, out myNet.myHeight); int.TryParse(tbNetworkY.Text, out myNet.myHeight);

View File

@ -1537,4 +1537,12 @@
<value>VLANs</value> <value>VLANs</value>
<comment>Text used in the program on buttons and the like</comment> <comment>Text used in the program on buttons and the like</comment>
</data> </data>
<data name="OW_cbVLANs" xml:space="preserve">
<value>VLANs Enabled</value>
<comment>OW_cbVLANs = VLANs Enabled</comment>
</data>
<data name="OW_OWVLANs" xml:space="preserve">
<value>Enable VLANs on this network. Otherwise, the vlan configuration stuff is kept hidden to keep it simple</value>
<comment>OW_OWVLANs = Enable VLANs on this network. Otherwise, the vlan configuration stuff is kept hidden to keep it simple</comment>
</data>
</root> </root>