Locked NIC locks VLANs on that NIC
This commit is contained in:
parent
852ced630f
commit
a863fa3709
@ -18,6 +18,7 @@ namespace EduNetworkBuilder
|
|||||||
DataTable VlanBindings = new DataTable();
|
DataTable VlanBindings = new DataTable();
|
||||||
List<NetworkInterface> interfaces = new List<NetworkInterface>();
|
List<NetworkInterface> interfaces = new List<NetworkInterface>();
|
||||||
BindingList<VLANName> StashedVLANNameList = new BindingList<VLANName>();
|
BindingList<VLANName> StashedVLANNameList = new BindingList<VLANName>();
|
||||||
|
List<bool> LockedIFs = new List<bool>();
|
||||||
|
|
||||||
bool processing = false;
|
bool processing = false;
|
||||||
|
|
||||||
@ -30,13 +31,26 @@ namespace EduNetworkBuilder
|
|||||||
this.Icon = Properties.Resources.NBIco;
|
this.Icon = Properties.Resources.NBIco;
|
||||||
processing = false;
|
processing = false;
|
||||||
|
|
||||||
|
dgv_VLANAssignments.DataBindingComplete += AssignmentsDataBindingComplete;
|
||||||
|
|
||||||
UpdateForm();
|
UpdateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssignmentsDataBindingComplete(object Sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//Lock any interfaces / NICs that are locked by tests
|
||||||
|
for (int i = 0; i < LockedIFs.Count; i++)
|
||||||
|
{
|
||||||
|
if (i < dgv_VLANAssignments.Rows.Count)
|
||||||
|
dgv_VLANAssignments.Rows[i].ReadOnly = LockedIFs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateForm()
|
private void UpdateForm()
|
||||||
{
|
{
|
||||||
if (processing) return;
|
if (processing) return;
|
||||||
|
|
||||||
|
LockedIFs.Clear();
|
||||||
UpdateNamesFromForm(); //Read in any changes so far
|
UpdateNamesFromForm(); //Read in any changes so far
|
||||||
|
|
||||||
processing = true;
|
processing = true;
|
||||||
@ -77,8 +91,14 @@ namespace EduNetworkBuilder
|
|||||||
if (NIC.GetNicType == NicType.vpn) continue;
|
if (NIC.GetNicType == NicType.vpn) continue;
|
||||||
if (NIC.GetNicType == NicType.none) continue;
|
if (NIC.GetNicType == NicType.none) continue;
|
||||||
if (NIC.GetNicType == NicType.tun) continue;
|
if (NIC.GetNicType == NicType.tun) continue;
|
||||||
|
bool locked = false;
|
||||||
|
string hostname = "";
|
||||||
|
if (TheDevice != null) { hostname = TheDevice.hostname;
|
||||||
|
if (theNet.ItemIsLocked(hostname, oneNic, NetTestType.LockNic))
|
||||||
|
{
|
||||||
|
locked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < NIC.IFCount; i++)
|
for (int i = 0; i < NIC.IFCount; i++)
|
||||||
{
|
{
|
||||||
NetworkInterface nif = NIC.GetInterface(i);
|
NetworkInterface nif = NIC.GetInterface(i);
|
||||||
@ -90,6 +110,7 @@ namespace EduNetworkBuilder
|
|||||||
DR[vn.Name] = nif.GetVLANTag(vn.ID).ToString();
|
DR[vn.Name] = nif.GetVLANTag(vn.ID).ToString();
|
||||||
}
|
}
|
||||||
VlanBindings.Rows.Add(DR);
|
VlanBindings.Rows.Add(DR);
|
||||||
|
LockedIFs.Add(locked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dgv_VLANAssignments.AutoGenerateColumns = false;
|
dgv_VLANAssignments.AutoGenerateColumns = false;
|
||||||
@ -124,6 +145,7 @@ namespace EduNetworkBuilder
|
|||||||
if (many > 3) many = 3;
|
if (many > 3) many = 3;
|
||||||
int checksize = 50 + 120 + (many * 80) + 25; //the record indicator, and the size of the name. + width of each item
|
int checksize = 50 + 120 + (many * 80) + 25; //the record indicator, and the size of the name. + width of each item
|
||||||
if (Width < checksize) Width = checksize; //Make it fit better
|
if (Width < checksize) Width = checksize; //Make it fit better
|
||||||
|
|
||||||
processing = false;
|
processing = false;
|
||||||
|
|
||||||
if (selectedcol >=0 && selectedcol < dgv_VLANAssignments.Columns.Count && selectedrow < dgv_VLANAssignments.Rows.Count)
|
if (selectedcol >=0 && selectedcol < dgv_VLANAssignments.Columns.Count && selectedrow < dgv_VLANAssignments.Rows.Count)
|
||||||
|
Loading…
Reference in New Issue
Block a user