Do delete device using DoActions

This commit is contained in:
2018-05-07 10:37:27 -05:00
parent 06ca7c59f3
commit d5a04c9d77
3 changed files with 45 additions and 12 deletions

View File

@ -1354,18 +1354,19 @@ namespace EduNetworkBuilder
private void TryDeleteOneItem(NetworkDevice Item)
{
//Deleting the item is easy, but we also need to delete any links to that item
List<HostNicID> NicIDs = new List<HostNicID>();
if (Item != null)
{
if (myNetwork.ItemIsCritical(Item.hostname))
return; //we cannot delete this
NicIDs = Item.GetHostNicIDs();
foreach (HostNicID nicID in NicIDs)
{
myNetwork.RemoveLinksToNic(nicID);
}
myNetwork.RemoveComponent(Item);
}
//List<HostNicID> NicIDs = new List<HostNicID>();
//if (Item != null)
//{
// if (myNetwork.ItemIsCritical(Item.hostname))
// return; //we cannot delete this
// NicIDs = Item.GetHostNicIDs();
// foreach (HostNicID nicID in NicIDs)
// {
// myNetwork.RemoveLinksToNic(nicID);
// }
// myNetwork.RemoveComponent(Item);
//}
NB.DoActionDeleteComponent(Item.GetUniqueIdentifier);
}
private void pbNetworkView_DeleteShape_Click(object sender, EventArgs e)