Add context menu item to replace a device
This commit is contained in:
parent
d3124c95bb
commit
0df4b14e01
@ -944,7 +944,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
foreach (NetTest nt in NetTests)
|
||||
{
|
||||
if (nt.sHost == host || WhatToCheck == NetTestType.LockVLANNames)
|
||||
if (nt.sHost == host)
|
||||
{
|
||||
if (WhatToCheck == nt.TheTest && (dest == "" || dest == nt.dHost))
|
||||
return true;
|
||||
@ -958,6 +958,24 @@ namespace EduNetworkBuilder
|
||||
return ItemHasTest(host, "", WhatToCheck);
|
||||
}
|
||||
|
||||
public bool ItemTestIsComplete(string host, string dest, NetTestType WhatToCheck)
|
||||
{
|
||||
foreach (NetTest nt in NetTests)
|
||||
{
|
||||
if (nt.sHost == host)
|
||||
{
|
||||
if (WhatToCheck == nt.TheTest && (dest == "" || dest == nt.dHost))
|
||||
return nt.TestComplete(this);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ItemTestIsComplete(string host, NetTestType WhatToCheck)
|
||||
{
|
||||
return ItemTestIsComplete(host, "", WhatToCheck);
|
||||
}
|
||||
|
||||
|
||||
private void MarkAsSolved()
|
||||
{
|
||||
@ -1671,6 +1689,17 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterDeviceReset(string source)
|
||||
{
|
||||
foreach(NetTest one in NetTests)
|
||||
{
|
||||
if(one.sHost == source && one.TheTest == NetTestType.DeviceIsBad)
|
||||
{
|
||||
one.SetDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************
|
||||
* Do On All Devices
|
||||
* **************************************/
|
||||
|
@ -878,7 +878,15 @@ namespace EduNetworkBuilder
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_PowerOff"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_PowerOff_Click;
|
||||
}
|
||||
|
||||
if(myNetwork.ItemHasTest(ReleasedOn.hostname,NetTestType.DeviceIsBad))
|
||||
{
|
||||
if(!myNetwork.ItemTestIsComplete(ReleasedOn.hostname, NetTestType.DeviceIsBad))
|
||||
{
|
||||
//If the item is bad and has not been replaced, then add a context menu to replace it
|
||||
pbNetworkView.ContextMenuStrip.Items.Add(NB.Translate("NB_Replace"));
|
||||
pbNetworkView.ContextMenuStrip.Items[index++].Click += pbNetworkView_Replace_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //we are locked out.
|
||||
@ -944,6 +952,18 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
private void pbNetworkView_Replace_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
{
|
||||
if (ItemClickedOn == null) return;
|
||||
ItemClickedOn.ClearIPs(); //reset the device
|
||||
//Mark the replace test as "done"
|
||||
myNetwork.RegisterDeviceReset(ItemClickedOn.hostname);
|
||||
UpdateVisuals();
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorizeDevice(NetworkDevice Item, string Text)
|
||||
{
|
||||
if (ItemClickedOn != null)
|
||||
|
@ -1993,6 +1993,10 @@
|
||||
<value>Translate</value>
|
||||
<comment>TW_Translate = Translate</comment>
|
||||
</data>
|
||||
<data name="NB_Replace" xml:space="preserve">
|
||||
<value>Replace</value>
|
||||
<comment>NB_Replace = Replace</comment>
|
||||
</data>
|
||||
<data name="NT_TstDscriptBadDevice" xml:space="preserve">
|
||||
<value>Something seems broken with this device</value>
|
||||
<comment>NT_TstDscriptBadDevice = Something seems broken with this device</comment>
|
||||
|
Loading…
Reference in New Issue
Block a user