Right-clicking microwave and light result in "delete" being the only option

This commit is contained in:
Tim Young 2015-08-26 17:10:55 -07:00
parent 290e025ea9
commit 9136a0aa74
2 changed files with 23 additions and 9 deletions

View File

@ -538,7 +538,7 @@ namespace EduNetworkBuilder
pbNetworkView.ContextMenuStrip = new ContextMenuStrip(); pbNetworkView.ContextMenuStrip = new ContextMenuStrip();
} }
pbNetworkView.ContextMenuStrip.Items.Clear(); pbNetworkView.ContextMenuStrip.Items.Clear();
if (ReleasedOn != null) if (ReleasedOn != null && ReleasedOn.IsNotNetDevice())
{ {
foreach (string tStr in myNetwork.GetIncompleteTestDestinations(ReleasedOn.hostname, true)) foreach (string tStr in myNetwork.GetIncompleteTestDestinations(ReleasedOn.hostname, true))
{ {
@ -551,12 +551,15 @@ namespace EduNetworkBuilder
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Arp_Name_Click; pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Arp_Name_Click;
} }
} }
pbNetworkView.ContextMenuStrip.Items.Add("Ping [host]"); if (ReleasedOn != null && ReleasedOn.IsNotNetDevice())
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Ping_Click; {
pbNetworkView.ContextMenuStrip.Items.Add("Arp Request [host]"); pbNetworkView.ContextMenuStrip.Items.Add("Ping [host]");
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Arp_Click; pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Ping_Click;
pbNetworkView.ContextMenuStrip.Items.Add("Clear Arp Table"); pbNetworkView.ContextMenuStrip.Items.Add("Arp Request [host]");
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_ArpClear_Click; pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Arp_Click;
pbNetworkView.ContextMenuStrip.Items.Add("Clear Arp Table");
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_ArpClear_Click;
}
if (ReleasedOn != null) if (ReleasedOn != null)
{ {
if (!myNetwork.ItemIsCritical(ReleasedOn.hostname)) if (!myNetwork.ItemIsCritical(ReleasedOn.hostname))
@ -565,8 +568,11 @@ namespace EduNetworkBuilder
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Delete_Click; pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Delete_Click;
} }
} }
pbNetworkView.ContextMenuStrip.Items.Add("Edit"); if (ReleasedOn != null && ReleasedOn.IsNotNetDevice())
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Edit_Click; {
pbNetworkView.ContextMenuStrip.Items.Add("Edit");
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Edit_Click;
}
if (ReleasedOn != null) if (ReleasedOn != null)
{ {

View File

@ -2164,6 +2164,14 @@ namespace EduNetworkBuilder
if (myType == NetworkComponentType.wrouter) return true; if (myType == NetworkComponentType.wrouter) return true;
return false; return false;
} }
public bool IsNotNetDevice()
{
if (GetNetType() == NetworkComponentType.fluorescent)
return false;
if (GetNetType() == NetworkComponentType.microwave)
return false;
return true;
}
public override void DoOutput(Packet tPacket) public override void DoOutput(Packet tPacket)
{ {