Always store the state when a button clicked. This does a much better getting ctrl-z to work.
This commit is contained in:
parent
e1060523ab
commit
c705ac0db3
@ -1105,8 +1105,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
ItemClickedOn.Hide();
|
||||
UpdateLinks();
|
||||
UpdateVisuals();
|
||||
@ -1117,7 +1115,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
ProcessChange();
|
||||
ItemClickedOn.PowerOff = false;
|
||||
bool BlowUpOnce = myNetwork.ItemHasTest(ItemClickedOn.hostname, NetTestType.DeviceBlowsUpWithPower) && !myNetwork.ItemTestIsComplete(ItemClickedOn.hostname, NetTestType.DeviceBlowsUpWithPower);
|
||||
bool BlowUpMultiple = myNetwork.ItemHasTest(ItemClickedOn.hostname, NetTestType.DeviceNeedsUPS) && !myNetwork.ItemTestIsComplete(ItemClickedOn.hostname, NetTestType.DeviceNeedsUPS);
|
||||
@ -1155,7 +1152,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
ProcessChange();
|
||||
ItemClickedOn.PowerOff = true;
|
||||
//Mark the replace test as "done"
|
||||
myNetwork.RegisterDeviceReset(ItemClickedOn.hostname);
|
||||
@ -1167,7 +1163,6 @@ namespace EduNetworkBuilder
|
||||
//We will still do this for devices that are spraying the network
|
||||
private void pbNetworkView_Replace_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
if (ItemClickedOn == null) return;
|
||||
@ -1186,8 +1181,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
if (ItemClickedOn == null) return;
|
||||
//Changing a UPS makes sure the power is off when done.
|
||||
ItemClickedOn.PowerOff = true;
|
||||
@ -1235,7 +1228,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_RemoveLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
string released = thing.Text;
|
||||
released = Regex.Replace(released, ".* ", "");
|
||||
@ -1254,8 +1246,6 @@ namespace EduNetworkBuilder
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
if (thing.Tag != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
NetworkLink NL = (NetworkLink)thing.Tag;
|
||||
//This may delete the old link and make a new one
|
||||
LinkEditor LE = new LinkEditor(NL);
|
||||
@ -1268,7 +1258,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_ReplaceNetLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
if (thing.Tag != null)
|
||||
{
|
||||
@ -1291,7 +1280,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_RemoveNetLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
ToolStripItem thing = (ToolStripItem)sender;
|
||||
if (thing.Tag != null)
|
||||
{
|
||||
@ -1307,8 +1295,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_DHCPRequest_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
ItemClickedOn.DHCPRequestFromHere();
|
||||
myNetwork.ProcessPackets();
|
||||
UpdateMessages();
|
||||
@ -1320,7 +1306,6 @@ namespace EduNetworkBuilder
|
||||
private void pbNetworkView_Reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn == null) return;
|
||||
ProcessChange();
|
||||
ItemClickedOn.ClearIPs(); //reset the device
|
||||
UpdateVisuals();
|
||||
}
|
||||
@ -1333,8 +1318,6 @@ namespace EduNetworkBuilder
|
||||
return;
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
DeviceConfig editwindow = new DeviceConfig(ItemClickedOn);
|
||||
editwindow.ShowDialog();
|
||||
}
|
||||
@ -1364,8 +1347,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if(ShapeForEditing != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
myNetwork.RemoveShape(ShapeForEditing);
|
||||
ShapeForEditing = null;
|
||||
UpdateForm();
|
||||
@ -1375,8 +1356,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ShapeForEditing != null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
ShapeEditor SE = new ShapeEditor(ShapeForEditing);
|
||||
SE.ShowDialog();
|
||||
|
||||
@ -1388,7 +1367,6 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_Delete_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessChange();
|
||||
if (ItemsSelected.Count == 0)
|
||||
{
|
||||
TryDeleteOneItem(ItemClickedOn);
|
||||
@ -1439,7 +1417,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (ItemClickedOn == null) return; //we do not have something chosen to ping from
|
||||
ToolStripMenuItem Pressed = (ToolStripMenuItem)sender;
|
||||
ProcessChange();
|
||||
|
||||
string itemname = Pressed.Text;
|
||||
string dest = (string)Pressed.Tag;
|
||||
@ -1455,7 +1432,6 @@ namespace EduNetworkBuilder
|
||||
private void pbNetworkView_Traceroute_Name_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn == null) return; //we do not have something chosen to ping from
|
||||
ProcessChange();
|
||||
ToolStripMenuItem Pressed = (ToolStripMenuItem)sender;
|
||||
string itemname = Pressed.Text;
|
||||
string dest = (string)Pressed.Tag;
|
||||
@ -1500,7 +1476,6 @@ namespace EduNetworkBuilder
|
||||
private void pbNetworkView_ArpClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn == null) return; //we do not have something chosen to arp request from
|
||||
ProcessChange();
|
||||
ItemClickedOn.ClearArps();
|
||||
}
|
||||
|
||||
@ -1570,7 +1545,6 @@ namespace EduNetworkBuilder
|
||||
if (ItemClickedOn != null) PoweredOff = ItemClickedOn.PowerOff;
|
||||
if (!PoweredOff)
|
||||
{
|
||||
ProcessChange();
|
||||
pbNetworkView_Edit_Click(sender, e);
|
||||
}
|
||||
}
|
||||
@ -1608,8 +1582,6 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
//We just made a shape.
|
||||
try
|
||||
{
|
||||
@ -1648,8 +1620,6 @@ namespace EduNetworkBuilder
|
||||
MouseIsDown = false;
|
||||
if (selectedButton == "btnLink")
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
//We are making a link
|
||||
LinkEditor myEditor = new LinkEditor(ItemClickedOn, ReleasedOn);
|
||||
myEditor.ShowDialog();
|
||||
@ -1658,8 +1628,6 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
else if (ItemClickedOn == null)
|
||||
{
|
||||
ProcessChange();
|
||||
|
||||
NetworkComponent NC = null;
|
||||
switch (selectedButton)
|
||||
{
|
||||
@ -1749,7 +1717,6 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (!ItemClickedOn.IsLockedInLocation())
|
||||
{
|
||||
ProcessChange();
|
||||
ItemClickedOn.ChangeLocation(CenteredLocation);
|
||||
ItemClickedOn.UnHide(); //If it was hidden, unhide it
|
||||
UpdateLinks();
|
||||
@ -1769,6 +1736,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
private void pbNetworkView_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
ProcessChange(); //Before anything happens, store this state if we need to.
|
||||
Point location = myNetwork.clickedPos(e.Location);
|
||||
ClickedLocation = location;
|
||||
OrigClickPoint = myNetwork.clickedPosCentered(e.Location);
|
||||
|
Loading…
Reference in New Issue
Block a user