Change colors of devices if VLANS are enabled
This commit is contained in:
parent
ff4badaff8
commit
852ced630f
@ -645,7 +645,20 @@ namespace EduNetworkBuilder
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_RemoveLink_Click;
|
||||
}
|
||||
}
|
||||
if(ReleasedOn == null)
|
||||
if(ReleasedOn != null && myNetwork.VLANsEnabled)
|
||||
{
|
||||
int MenuIndex = pbNetworkView.ContextMenuStrip.Items.Count;
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_ColorStr"));
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Blue"),null, pbNetworkView_Color_Click);
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Purple"), null, pbNetworkView_Color_Click);
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Yellow"), null, pbNetworkView_Color_Click);
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Green"), null, pbNetworkView_Color_Click);
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Orange"), null, pbNetworkView_Color_Click);
|
||||
(pbNetworkView.ContextMenuStrip.Items[MenuIndex] as ToolStripMenuItem).DropDownItems.Add(NB.Translate("NB_Cyan"), null, pbNetworkView_Color_Click);
|
||||
|
||||
|
||||
}
|
||||
if (ReleasedOn == null)
|
||||
{
|
||||
pbNetworkView.ContextMenuStrip.Visible = false;
|
||||
}
|
||||
@ -656,6 +669,27 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
private void pbNetworkView_Color_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripMenuItem TSMI = (ToolStripMenuItem)sender;
|
||||
if(ItemClickedOn != null)
|
||||
{
|
||||
if (TSMI.Text == NB.Translate("NB_Blue"))
|
||||
ItemClickedOn.ChangeColor(Color.Empty);
|
||||
if (TSMI.Text == NB.Translate("NB_Purple"))
|
||||
ItemClickedOn.ChangeColor(Color.Purple);
|
||||
if (TSMI.Text == NB.Translate("NB_Yellow"))
|
||||
ItemClickedOn.ChangeColor(Color.Yellow);
|
||||
if (TSMI.Text == NB.Translate("NB_Green"))
|
||||
ItemClickedOn.ChangeColor(Color.Green);
|
||||
if (TSMI.Text == NB.Translate("NB_Orange"))
|
||||
ItemClickedOn.ChangeColor(Color.Orange);
|
||||
if (TSMI.Text == NB.Translate("NB_Cyan"))
|
||||
ItemClickedOn.ChangeColor(Color.Cyan);
|
||||
UpdateVisuals();
|
||||
}
|
||||
}
|
||||
|
||||
private void pbNetworkView_RemoveLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
|
@ -2502,6 +2502,11 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeColor(Color ColorTo)
|
||||
{
|
||||
MorphColor = ColorTo;
|
||||
}
|
||||
|
||||
public List<ArpEntry> GetArps()
|
||||
{
|
||||
return ArpTable;
|
||||
|
@ -1537,6 +1537,34 @@
|
||||
<value>VLANs</value>
|
||||
<comment>Text used in the program on buttons and the like</comment>
|
||||
</data>
|
||||
<data name="NB_Blue" xml:space="preserve">
|
||||
<value>Blue</value>
|
||||
<comment>NB_Blue = Blue</comment>
|
||||
</data>
|
||||
<data name="NB_ColorStr" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
<comment>NB_ColorStr = Color</comment>
|
||||
</data>
|
||||
<data name="NB_Cyan" xml:space="preserve">
|
||||
<value>Cyan</value>
|
||||
<comment>NB_Cyan = Cyan</comment>
|
||||
</data>
|
||||
<data name="NB_Green" xml:space="preserve">
|
||||
<value>Green</value>
|
||||
<comment>NB_Green = Green</comment>
|
||||
</data>
|
||||
<data name="NB_Orange" xml:space="preserve">
|
||||
<value>Orange</value>
|
||||
<comment>NB_Orange = Orange</comment>
|
||||
</data>
|
||||
<data name="NB_Purple" xml:space="preserve">
|
||||
<value>Purple</value>
|
||||
<comment>NB_Purple = Purple</comment>
|
||||
</data>
|
||||
<data name="NB_Yellow" xml:space="preserve">
|
||||
<value>Yelow</value>
|
||||
<comment>NB_Yellow = Yellow</comment>
|
||||
</data>
|
||||
<data name="OW_cbVLANs" xml:space="preserve">
|
||||
<value>VLANs Enabled</value>
|
||||
<comment>OW_cbVLANs = VLANs Enabled</comment>
|
||||
|
Loading…
Reference in New Issue
Block a user