Get power on/off to work through Actions.

This commit is contained in:
Tim Young 2018-05-14 14:14:15 -05:00
parent 871f4132fe
commit 1d917fd097
4 changed files with 12 additions and 3 deletions

View File

@ -1475,7 +1475,7 @@ namespace EduNetworkBuilder
ActionClass AC = new ActionClass();
AC.Action = NBAction.changecomponent;
AC.SourceID = HostID;
AC.ChangedComponent = Changed;
AC.ChangedComponent = NetworkComponent.Clone(Changed);
RegisterAction(AC);

View File

@ -1167,6 +1167,8 @@ namespace EduNetworkBuilder
ItemClickedOn.IsBurned = true;
ItemClickedOn.PowerOff = true; //It remains off.
}
NB.DoActionChangeComponent(ItemClickedOn);
UpdateLinks();
UpdateVisuals();
}
@ -1178,6 +1180,7 @@ namespace EduNetworkBuilder
{
ItemClickedOn.PowerOff = true;
//Mark the replace test as "done"
NB.DoActionChangeComponent(ItemClickedOn);
myNetwork.RegisterDeviceReset(ItemClickedOn.hostname);
UpdateLinks();
UpdateVisuals();
@ -1194,6 +1197,7 @@ namespace EduNetworkBuilder
ItemClickedOn.IsBurned = false; //If it had been burned before, it is no longer burned
ItemClickedOn.PowerOff = true;
ItemClickedOn.BadSprayCount = 0;
NB.DoActionChangeComponent(ItemClickedOn);
//Mark the replace test as "done"
myNetwork.RegisterDeviceReset(ItemClickedOn.hostname); //replacing something powers it off

View File

@ -1511,6 +1511,7 @@ namespace EduNetworkBuilder
{
if (CopyFrom.GetType() != this.GetType()) return; //we cannot copy from it if it is different
NetworkDevice ndCopyFrom = (NetworkDevice)CopyFrom;
if (Object.ReferenceEquals(this, CopyFrom)) return; //No need to copy values to itself
hostname = ndCopyFrom.hostname;
Size = ndCopyFrom.Size;
DefaultGW = ndCopyFrom.DefaultGW;
@ -1539,6 +1540,9 @@ namespace EduNetworkBuilder
DHCPRanges.AddRange(ndCopyFrom.DHCPRanges);
DHCPLeases.Clear();
DHCPLeases.AddRange(ndCopyFrom.DHCPLeases);
PowerOff = ndCopyFrom.PowerOff;
IsBurned = ndCopyFrom.IsBurned;
}
public void DHCPRequestFromHere()

View File

@ -267,8 +267,9 @@ namespace EduNetworkBuilder
deleteme = true;
}
}
if (sNic.isWireless() != dNic.isWireless())
deleteme = true;
if (sNic != null && dNic != null)
if (sNic.isWireless() != dNic.isWireless())
deleteme = true;
if(deleteme)
{
sDev.RemoveLinkTo(dDev.hostname); //this removes this link