Able to right-click and replace a broken link.
This commit is contained in:
parent
ac872dff1b
commit
07dc0224c3
@ -953,6 +953,13 @@ namespace EduNetworkBuilder
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("_Edit"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index].Tag = LinkReleasedOn;
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_EditNetLink_Click;
|
||||
|
||||
if (LinkReleasedOn.theLinkType == LinkType.broken)
|
||||
{
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_Replace"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index].Tag = LinkReleasedOn;
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_ReplaceNetLink_Click;
|
||||
}
|
||||
}
|
||||
pbNetworkView.ContextMenuStrip.Visible = true;
|
||||
pbNetworkView.ContextMenuStrip.Show(Cursor.Position);
|
||||
@ -1106,6 +1113,28 @@ namespace EduNetworkBuilder
|
||||
UpdateVisuals();
|
||||
}
|
||||
|
||||
private void pbNetworkView_ReplaceNetLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
if (thing.Tag != null)
|
||||
{
|
||||
NetworkLink NL = (NetworkLink)thing.Tag;
|
||||
//This may delete the old link and make a new one
|
||||
if (NL.theLinkType != LinkType.wireless)
|
||||
{
|
||||
HostNicID source = NL.Src;
|
||||
HostNicID dest = NL.Dst;
|
||||
myNetwork.RemoveComponent(NL);
|
||||
NetworkLink nNL = new NetworkLink(source, dest, LinkType.normal);
|
||||
myNetwork.AddItem(nNL);
|
||||
}
|
||||
}
|
||||
myNetwork.TestForCompletion(true);
|
||||
pbNetworkView.Update();
|
||||
UpdateVisuals();
|
||||
}
|
||||
|
||||
|
||||
private void pbNetworkView_RemoveNetLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
|
Loading…
Reference in New Issue
Block a user