IPAddress edit box should now appear inside the network box.
This commit is contained in:
parent
4a5450ac54
commit
f4ab85f359
@ -432,7 +432,7 @@ namespace EduNetworkBuilder
|
|||||||
//selectedNIC = Regex.Replace(selectedNIC, " .*", "");
|
//selectedNIC = Regex.Replace(selectedNIC, " .*", "");
|
||||||
//selectedNIC = Regex.Replace(selectedNIC, "\\*", "");
|
//selectedNIC = Regex.Replace(selectedNIC, "\\*", "");
|
||||||
|
|
||||||
ndCLonedItem.EditNicInterface(selectedNIC, lbAddresses.SelectedIndex);
|
ndCLonedItem.EditNicInterface(selectedNIC, lbAddresses.SelectedIndex, this);
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,7 +483,7 @@ namespace EduNetworkBuilder
|
|||||||
if (NB.GetComponentType(ClonedItem) == GeneralComponentType.device)
|
if (NB.GetComponentType(ClonedItem) == GeneralComponentType.device)
|
||||||
{
|
{
|
||||||
NetworkDevice nd = (NetworkDevice)ClonedItem;
|
NetworkDevice nd = (NetworkDevice)ClonedItem;
|
||||||
nd.EditGateway();
|
nd.EditGateway(this);
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,17 +96,17 @@ namespace EduNetworkBuilder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Edit(NetworkDevice FromWhat, string message="")
|
public bool Edit(NetworkDevice FromWhat, Form ParentForm, string message="")
|
||||||
{
|
{
|
||||||
IPAddressEntry IPe = new IPAddressEntry(this, FromWhat);
|
IPAddressEntry IPe = new IPAddressEntry(this, FromWhat, ParentForm);
|
||||||
if (message != "")
|
if (message != "")
|
||||||
IPe.Text = message;
|
IPe.Text = message;
|
||||||
return IPe.Edit();
|
return IPe.Edit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Edit(NetworkDevice FromWhat, IPAddress DHCPif)
|
public bool Edit(NetworkDevice FromWhat, IPAddress DHCPif, Form ParentForm)
|
||||||
{
|
{
|
||||||
IPAddressEntry IPe = new IPAddressEntry(this, FromWhat);
|
IPAddressEntry IPe = new IPAddressEntry(this, FromWhat, ParentForm);
|
||||||
return IPe.Edit(FromWhat, DHCPif);
|
return IPe.Edit(FromWhat, DHCPif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,14 @@ namespace EduNetworkBuilder
|
|||||||
NetworkDevice ParentDevice = null;
|
NetworkDevice ParentDevice = null;
|
||||||
|
|
||||||
|
|
||||||
public IPAddressEntry(IPAddress toEdit, NetworkDevice ToEdit)
|
public IPAddressEntry(IPAddress toEdit, NetworkDevice ToEdit, Form ParentForm)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LanguagifyComponents();
|
LanguagifyComponents();
|
||||||
|
if(ParentForm != null)
|
||||||
|
{
|
||||||
|
Location = new Point(ParentForm.Location.X + (ParentForm.Width / 2), ParentForm.Location.Y + (ParentForm.Height / 2));
|
||||||
|
}
|
||||||
ParentDevice = ToEdit;
|
ParentDevice = ToEdit;
|
||||||
Network myNet = NB.GetNetwork();
|
Network myNet = NB.GetNetwork();
|
||||||
IPAddress lastIP = myNet.RetrieveLastIP();
|
IPAddress lastIP = myNet.RetrieveLastIP();
|
||||||
|
@ -385,7 +385,7 @@ namespace EduNetworkBuilder
|
|||||||
private void AddRoute()
|
private void AddRoute()
|
||||||
{
|
{
|
||||||
IPAddress newip = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, NB.ZeroIPString);
|
IPAddress newip = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, NB.ZeroIPString);
|
||||||
newip.Edit(myNetDevice,NB.Translate("LBW_AddRouteCreate"));
|
newip.Edit(myNetDevice, this, NB.Translate("LBW_AddRouteCreate"));
|
||||||
myNetDevice.AddRoute(newip);
|
myNetDevice.AddRoute(newip);
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
@ -398,12 +398,12 @@ namespace EduNetworkBuilder
|
|||||||
if (lbWindowData.SelectedIndex >= EditableCount) return;
|
if (lbWindowData.SelectedIndex >= EditableCount) return;
|
||||||
if (lbWindowData.SelectedIndex < 1) return;
|
if (lbWindowData.SelectedIndex < 1) return;
|
||||||
//we always subtract 1 since we have added one line of comment to the list
|
//we always subtract 1 since we have added one line of comment to the list
|
||||||
myNetDevice.EditRoute(lbWindowData.SelectedIndex - 1);
|
myNetDevice.EditRoute(lbWindowData.SelectedIndex - 1, this);
|
||||||
}
|
}
|
||||||
if(MyMode == LBContents.dhcp)
|
if(MyMode == LBContents.dhcp)
|
||||||
{
|
{
|
||||||
//We always add one since we are skipping the loopback device
|
//We always add one since we are skipping the loopback device
|
||||||
myNetDevice.EditDHCP(lbWindowData.SelectedIndex + 1);
|
myNetDevice.EditDHCP(lbWindowData.SelectedIndex + 1, this);
|
||||||
}
|
}
|
||||||
if (MyMode == LBContents.puzzles)
|
if (MyMode == LBContents.puzzles)
|
||||||
{
|
{
|
||||||
|
@ -773,7 +773,7 @@ namespace EduNetworkBuilder
|
|||||||
bool todo = true;
|
bool todo = true;
|
||||||
if (ItemClickedOn == null) return; //we do not have something chosen to ping from
|
if (ItemClickedOn == null) return; //we do not have something chosen to ping from
|
||||||
IPAddress destination = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, IPAddressType.ip_only);
|
IPAddress destination = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, IPAddressType.ip_only);
|
||||||
todo = destination.Edit(ItemClickedOn, NB.Translate("_Ping"));
|
todo = destination.Edit(ItemClickedOn, this, NB.Translate("_Ping"));
|
||||||
if(todo)
|
if(todo)
|
||||||
{
|
{
|
||||||
ItemClickedOn.PingFromHere(destination);
|
ItemClickedOn.PingFromHere(destination);
|
||||||
@ -815,7 +815,7 @@ namespace EduNetworkBuilder
|
|||||||
bool todo = true;
|
bool todo = true;
|
||||||
if (ItemClickedOn == null) return; //we do not have something chosen to arp request from
|
if (ItemClickedOn == null) return; //we do not have something chosen to arp request from
|
||||||
IPAddress destination = new IPAddress(NB.ZeroIPString, "255.255.255.255", IPAddressType.ip_only);
|
IPAddress destination = new IPAddress(NB.ZeroIPString, "255.255.255.255", IPAddressType.ip_only);
|
||||||
todo = destination.Edit(ItemClickedOn, NB.Translate("H_ARP_Title2"));
|
todo = destination.Edit(ItemClickedOn, this, NB.Translate("H_ARP_Title2"));
|
||||||
if (todo)
|
if (todo)
|
||||||
{
|
{
|
||||||
ItemClickedOn.AskArpFromHere(destination);
|
ItemClickedOn.AskArpFromHere(destination);
|
||||||
@ -1155,7 +1155,7 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
bool todo = true;
|
bool todo = true;
|
||||||
IPAddress destination = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, IPAddressType.ip_only);
|
IPAddress destination = new IPAddress(NB.ZeroIPString, NB.ZeroIPString, IPAddressType.ip_only);
|
||||||
todo = destination.Edit(null, NB.Translate("NB_NetViewPng"));
|
todo = destination.Edit(null, this, NB.Translate("NB_NetViewPng"));
|
||||||
if (todo)
|
if (todo)
|
||||||
{
|
{
|
||||||
myNetwork.DoAllPing(destination);
|
myNetwork.DoAllPing(destination);
|
||||||
|
@ -7,6 +7,7 @@ using System.Runtime.Serialization.Formatters.Binary;
|
|||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|
||||||
namespace EduNetworkBuilder
|
namespace EduNetworkBuilder
|
||||||
@ -251,11 +252,11 @@ namespace EduNetworkBuilder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditInterface(int index)
|
public void EditInterface(int index, Form ParentForm)
|
||||||
{
|
{
|
||||||
if (index < 0 || index > interfaces.Count())
|
if (index < 0 || index > interfaces.Count())
|
||||||
return;
|
return;
|
||||||
interfaces[index].EditAddress();
|
interfaces[index].EditAddress(ParentForm);
|
||||||
}
|
}
|
||||||
public void DeleteInterface(int index)
|
public void DeleteInterface(int index)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
MyNicToEdit.TunnelEndpoint = new IPAddress(NB.ZeroIPString, "255.255.255.0", IPAddressType.ip_only);
|
MyNicToEdit.TunnelEndpoint = new IPAddress(NB.ZeroIPString, "255.255.255.0", IPAddressType.ip_only);
|
||||||
}
|
}
|
||||||
MyNicToEdit.TunnelEndpoint.Edit(nd, NB.Translate("_Endpt"));
|
MyNicToEdit.TunnelEndpoint.Edit(nd, this, NB.Translate("_Endpt"));
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,9 +293,9 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditGateway()
|
public void EditGateway(Form ParentForm)
|
||||||
{
|
{
|
||||||
DefaultGW.Edit(this,NB.Translate("ND_EdtGteway"));
|
DefaultGW.Edit(this,ParentForm,NB.Translate("ND_EdtGteway"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPAddress GetGateway()
|
public IPAddress GetGateway()
|
||||||
@ -703,11 +703,11 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditNicInterface(int NicIndex, int ifIndex)
|
public void EditNicInterface(int NicIndex, int ifIndex, Form ParentForm)
|
||||||
{
|
{
|
||||||
if(NicIndex >=0 && NicIndex < NICs.Count())
|
if(NicIndex >=0 && NicIndex < NICs.Count())
|
||||||
{
|
{
|
||||||
NICs[NicIndex].EditInterface(ifIndex);
|
NICs[NicIndex].EditInterface(ifIndex, ParentForm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void DeleteNicInterface(int NicIndex, int ifIndex)
|
public void DeleteNicInterface(int NicIndex, int ifIndex)
|
||||||
@ -717,12 +717,12 @@ namespace EduNetworkBuilder
|
|||||||
NICs[NicIndex].DeleteInterface(ifIndex);
|
NICs[NicIndex].DeleteInterface(ifIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void EditNicInterface(string NicName, int ifIndex)
|
public void EditNicInterface(string NicName, int ifIndex, Form ParentForm)
|
||||||
{
|
{
|
||||||
NetworkCard nic = NicFromName(NicName);
|
NetworkCard nic = NicFromName(NicName);
|
||||||
if (nic != null)
|
if (nic != null)
|
||||||
{
|
{
|
||||||
nic.EditInterface(ifIndex);
|
nic.EditInterface(ifIndex, ParentForm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2402,11 +2402,11 @@ namespace EduNetworkBuilder
|
|||||||
return RouteTable;
|
return RouteTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EditRoute(int index)
|
public void EditRoute(int index, Form ParentForm)
|
||||||
{
|
{
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
if (index >= RouteTable.Count) return;
|
if (index >= RouteTable.Count) return;
|
||||||
RouteTable[index].Edit(this);
|
RouteTable[index].Edit(this, ParentForm);
|
||||||
}
|
}
|
||||||
public void DeleteRoute(int index)
|
public void DeleteRoute(int index)
|
||||||
{
|
{
|
||||||
@ -2740,7 +2740,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public void EditDHCP(int index)
|
public void EditDHCP(int index, Form ParentForm)
|
||||||
{
|
{
|
||||||
if (index > DHCPRanges.Count) return;
|
if (index > DHCPRanges.Count) return;
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
@ -2756,7 +2756,7 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) return;
|
if (!found) return;
|
||||||
DHCPRanges[index].Edit(this, ifIP); //We need to pass the interface that is local to this
|
DHCPRanges[index].Edit(this, ifIP, ParentForm); //We need to pass the interface that is local to this
|
||||||
DHCPLeases.Clear();
|
DHCPLeases.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Windows.Forms;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace EduNetworkBuilder
|
namespace EduNetworkBuilder
|
||||||
@ -167,11 +168,11 @@ namespace EduNetworkBuilder
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pop up a window to edit this address.
|
/// Pop up a window to edit this address.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void EditAddress()
|
public void EditAddress(Form ParentForm)
|
||||||
{
|
{
|
||||||
Network myNet = NB.GetNetwork();
|
Network myNet = NB.GetNetwork();
|
||||||
NetworkDevice ND = myNet.GetDeviceFromID(AttachedToHostNic);
|
NetworkDevice ND = myNet.GetDeviceFromID(AttachedToHostNic);
|
||||||
IPAddressEntry ipe = new IPAddressEntry(myIP,ND);
|
IPAddressEntry ipe = new IPAddressEntry(myIP,ND, ParentForm);
|
||||||
ipe.ShowDialog();
|
ipe.ShowDialog();
|
||||||
}
|
}
|
||||||
public bool isLocal(IPAddress tIp, bool AllowZeroMatch = true)
|
public bool isLocal(IPAddress tIp, bool AllowZeroMatch = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user